Create or update person

Updated

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}}. or JavaScript.

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.
  • Set a customer’s next appointment time.
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 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 person.
    • Attribute represents the name of the attribute you want to set.
    • Value is the type of value you want to populate your attribute with. For example, if you want to use an event property as the person’s attribute value, select Event attribute. Then in the field to the right, choose the event 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.

Set attributes

You can set people’s attributes based on the type of campaign you’re creating. In any campaign, you can set a person’s profile attribute to:

  • another profile attribute
  • a static value
  • liquid
  • Javascript

In campaigns triggered by events, form submissions, objects, or relationships, you can also set a person’s attribute equal to trigger data.

  • For event or form-triggered campaigns, you’ll choose “Event attribute” from the dropdown then click beside an event attribute from the left-hand panel of sample data.
    create-person-event-attribute.png
    create-person-event-attribute.png
  • For object or relationship-triggered campaigns, you’ll choose “Trigger object attribute” or “Trigger relationship attribute” from the dropdown. Then choose an attribute from the list of available values. To see a preview of the payload, make sure you select a person from the sample data on the left who has a relationship to the object.
    create-person-trigger-object-attr-2.png
    create-person-trigger-object-attr-2.png

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?