Create or update profile

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

How it works

You can use the Create or update profile action in any automation workflow. When you update the profile currently in your automation, you can set attributes from static values, the event that triggered your automation, other profile attributes—or any other value you could otherwise set with liquid or JavaScript.

If you want to update another profile—or you use the action in a webhook-triggered automation—you’ll select a value representing the other profile’s identifier. If the profile exists, we’ll update their attributes accordingly. If the profile does not exist, we’ll create them and set their attributes accordingly.

You might use this action to:

  • Update a profile’s subscription date for “account anniversary” automations.
  • Calculate a customer’s lifetime value (with a total_purchase_value attribute, for example).
  • Create a profile based on an incoming webhook.
  • Set a customer’s next appointment time.

You don't need a delay after this action

Your automation workflow will automatically wait for the attribute update to finish before moving to the next step. You don’t need to add a delay after a Create or update profile action—the workflow won’t proceed until the update finishes.

flowchart LR a{Is the update for<br>the current profile}-->|Yes|b[Update<br>current profile] a-->|No: someone else<br>or webhook-triggered automation|c{Does this profile exist?} c-->|Yes|d[Update<br>other profile] c-->|No|e[Create<br>new profile]

Create or update a profile

In the Workflow step of your automation:

  1. Drag the Create or update profile 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 profile block to your workflow
  3. Select whether you want to update The profile in the workflow or Someone else. If you select Someone else, you’ll need a value to use as an identifier for that profile.

    Set attributes on the profile you want to update
  4. Click Add attribute and set attribute values for the profile.

    • 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 profile’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.

  5. Click Save Changes when you’re done.

Use the Remove attribute option if you want to unset a profile's attribute

Setting an attribute value to an empty string or null is the same as removing that attribute from a profile.

You don't need a delay after this action

Your workflow automatically waits for the attribute update to complete before moving to the next action. You don’t need to add a delay after a Create or update profile action—the workflow won’t proceed until the update finishes.

Webhook-triggered automations or the Someone Else option

When you use Create or update profile in a webhook-triggered automation or select the Someone else option, you’ll select an identifier that we’ll use to find or create a profile. Customer.io looks for the profile represented by this value. If that profile exists, we’ll update them normally. If we can’t find a profile matching the identifier you provide, we’ll create one.

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

Set attributes

In most automations, you can set an attribute to one of these data types:

  • Profile attribute
  • Journey attribute
  • Static value
  • Liquid
  • Javascript

In automations triggered by events, form submissions, objects, or relationships, you can also set an attribute equal to trigger data.

  • For event or form-triggered automations, you’ll choose “Event attribute” from the dropdown then click beside an event attribute from the left-hand panel of sample data.
    /images/create-person-event-attribute.png
  • For object or relationship-triggered automations, 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 profile from the sample data on the left who has a relationship to the object.
    /images/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 automation—trigger data, attributes, event properties, snippets, etc.

For example, if you wanted to access a profile’s id from within the identifers object in your automation’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