Create or update person

This action lets you update a person. You can update the person currently in your campaign workflow, or you can update a related person. If this related person doesn’t exist, this action creates a new person!

How it works

You can use the Create or update person action in any campaign workflow. When you update the person currently in your campaign, you can set attributes from static values, the event that triggered your campaign, other profileAn instance of a person. Generally, a person is synonymous with their profile; there should be a one-to-one relationship between a real person and their profile in Customer.io. You reference a person’s profile attributes in liquid using customer—e.g. {{customer.email}}. attributes—or any other value you could otherwise set with liquidA syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person’s first name, you might use the variable {{customer.first_name}}..

If you want to update another person—or you use the action in a webhook-triggered campaignA campaign triggered by an incoming webhook, in which the data is the subject of the campaign instead of a person. Webhook-triggered campaigns help you integrate with external APIs without writing your own code or using a middleware product like Zapier. From a webhook-triggered campaign, you can manipulate your incoming data to create people, update people, and trigger events.—you’ll select a value representing the other person’s identifierThe attributes you use to add, modify, and target people. Each unique identifier value represents an individual person in your workspace.. If the person exists, we’ll update their attributes accordingly. If the person does not exist, we’ll create them and set their attributes accordingly.

You might use this action to:

  • Update a person’s subscription date, for “account anniversary” campaigns.
  • Calculate a customer’s lifetime value (with a total_purchase_value attribute, for example).
  • Create a person based on an incoming webhook.
  • Create or update a new person based on a referral from a person in your current campaign—like a friend or family referral.
flowchart LR a{Is the update for
the current person}-->|Yes|b[Update
current person] a-->|No: someone else
or webhook-triggered campaign|c{Does this person exist?} c-->|Yes|d[Update
other person] c-->|No|e[Create
new person]

Create or update a person

In the Workflow step of your campaign:

  1. Drag the Create or update person block into your workflow.
  2. Give the action a Name and click Add Details. You can also set Action Conditions if you don’t want everybody in your workflow to trigger this action.
    Add create or add person block to your workflow
    Add create or add person block to your workflow
  3. Select whether you want to update the The person in the workflow or Someone else. If you select Someone else, you’ll need a value to use as an identifierThe attributes you use to add, modify, and target people. Each unique identifier value represents an individual person in your workspace. for that person.
  4. Click Add attribute and set attribute values for the new person.
    • Attribute represents the name for the new attribute.
    • Value lets you select where your value comes and the value itself. For example, if you want to use an event property as a new attribute value, you’ll select event attribute and then the specific attribute in the event that you want to set as a person’s attribute.

       You can set nested attributes with JSON dot notation

      Use JSON dot notation to set attributes inside other attributes or create an array of values. See Storing and using JSON for more information about dot notation in Customer.io.

      Set attributes on the person you want to update
      Set attributes on the person you want to update
  5. Click Save Changes when you’re done.

 Setting an attribute value to an empty string or null is the same as removing that attribute from a person. Use the Remove attribute option if you want to “un-set” a person’s attribute.

Webhook-triggered campaigns or the Someone Else option

When you use Create or update person in a webhook-triggered campaignA campaign triggered by an incoming webhook, in which the data is the subject of the campaign instead of a person. Webhook-triggered campaigns help you integrate with external APIs without writing your own code or using a middleware product like Zapier. From a webhook-triggered campaign, you can manipulate your incoming data to create people, update people, and trigger events. or select the Someone else option, you’ll select an identifierThe attributes you use to add, modify, and target people. Each unique identifier value represents an individual person in your workspace. that we’ll use to find or create a person. Customer.io looks for the person represented by this value. If that person exists, we’ll update them normally. If we can’t find a person matching the identifier you provide, we’ll create one.

In general, this means that either the incoming data or the current person in your workflow must have a value representing another person.

What values can I use to set attributes?

The types of values you can set depend on whether your campaign is triggered by people or by a webhookA campaign triggered by an incoming webhook, in which the data is the subject of the campaign instead of a person. Webhook-triggered campaigns help you integrate with external APIs without writing your own code or using a middleware product like Zapier. From a webhook-triggered campaign, you can manipulate your incoming data to create people, update people, and trigger events.. In a campaign triggered by people—entering a segment, performing an event, etc—your trigger also determines the types of data you can access to set attributes. You can select these values directly, or use liquidA syntax that supports variables, letting you personalize messages for your audience. For example, if you want to reference a person’s first name, you might use the variable {{customer.first_name}}. to manipulate the values that you want to set as attributes (like reformatting a timestamp).

When you use liquid, you access Profile attributes using customer—like {{customer.email}} to get a person’s email attribute.

Campaign TriggerprofileAn instance of a person. Generally, a person is synonymous with their profile; there should be a one-to-one relationship between a real person and their profile in Customer.io. You reference a person’s profile attributes in liquid using customer—e.g. {{customer.email}}. attributeevent attributewebhook trigger attributestatic value
A person meets conditions
A person performs an event
A specific time
A person submits a form
Data arrives via webhook
API-triggered broadcast

Using Liquid in attribute updates

You might use liquid to manipulate the values you set as attributes—if you need to convert timestamps, append values, or access a specific set of values from an array, etc. See the liquid tag list for a list of ways you can transform data.

An attribute can contain JSON. However, when you reference an array or object, you’ll need use | to_json. By default, liquid maps objects and arrays to strings (or integers, where applicable). Use this tag, like {{event.object | to_json}} when you reference an object or array to avoid errors and maintain the original shape of your data!

Use JavaScript in attribute updates

You can manipulate attribute values with JavaScript. When using Javascript, you’ll write a return statement for each attribute value you want to set. You can set properties from any source available in your campaign—trigger data, attributesA key-value pair that you associate with a person or an object—like a person’s name, the date they were created in your workspace, or a company’s billing date etc. Use attributes to target people and personalize messages. Attributes are analogous to traits in Data Pipelines., event properties, snippetsA common value that you can reuse with Liquid in messages and other workflow actions—like your company address. You can store Liquid inside a snippet, making it easy to save and reuse advanced values and statements across your messages., etc.

For example, if you wanted to access a person’s id from within the identifers object in your campaign’s trigger, you would write return triggers.identifiers.id;.

See our JavaScript quick reference guide for more examples to help you take advantage of JavaScript in your workflow.

 You can’t use Liquid inside JavaScript

When you use the JavaScript option, you must manipulate values with JavaScript. If you try to return a snippet value that contains Liquid, you’ll receive an error.

use javascript to manipulate attributes
use javascript to manipulate attributes
Copied to clipboard!
  Contents
Is this page helpful?