Automations

Contact Update

Update a contact's name, subscription status, or custom properties during an automation.

The contact update step modifies the current contact's fields as the automation runs. You can update the contact's name, subscription status, or custom properties. See Using automations for the surrounding workflow.

Common use cases:

  • Enrich profiles — copy event data into the contact record.
  • Set flags — mark contacts as VIP or churned based on their activity.
  • Sync properties — keep custom properties up to date as events flow in.

How it works

Add a contact_update step to the steps array and set the fields you want to change.

import { MailBlastr } from 'mailblastr';

const mb = new MailBlastr('mb_xxxxxxxxx');

const { data, error } = await mb.automations.create({
  "name": "Enrich contact on signup",
  "domain": "yourdomain.com",
  "steps": [
    {
      "key": "start",
      "type": "trigger",
      "config": { "event_name": "user.created" }
    },
    {
      "key": "update",
      "type": "contact_update",
      "config": {
        "first_name": { "var": "event.firstName" },
        "last_name": { "var": "event.lastName" },
        "properties": {
          "company": { "var": "event.company" },
          "vip": true
        }
      }
    }
  ],
  "connections": [
    { "from": "start", "to": "update", "type": "default" }
  ]
});
console.log({ data, error });

Dynamic variables

Each field value can be a hardcoded value (string, number, boolean) or a dynamic variable reference using the { "var": "..." } syntax. Variable references use dot-notation with one of these scopes:

  • event.* — references a field from the triggering event payload (e.g. event.firstName).
  • contact.* — references a field from the current contact (e.g. contact.last_name, contact.properties.company).

For more on variables, see the Send Email step documentation.

{
  "key": "update",
  "type": "contact_update",
  "config": {
    "first_name": { "var": "event.firstName" },
    "last_name": { "var": "event.lastName" },
    "properties": {
      "company": { "var": "event.company" },
      "vip": true
    }
  }
}

Configuration

config.first_namestring | objectoptional

The contact's first name. Accepts a hardcoded string or a variable reference.

config.last_namestring | objectoptional

The contact's last name. Accepts a hardcoded string or a variable reference.

config.unsubscribedboolean | objectoptional

The contact's unsubscribed status. Accepts a boolean or a variable reference.

config.propertiesobjectoptional

A map of custom contact properties to update. Keys correspond to your contact properties. Each value is a hardcoded value or a variable reference.