Skip to main content

Accessing Dynamic Data

All fields within the designer or an adhoc automation can be pointed to dynamic data using a special refs object syntax.

The refs object has access to the following properties:

  • brand
    • type: string
    • description: A unique identifier that represents the brand that should be used for rendering the notification.
  • data
    • type: object
    • description: An object that includes any data you want to pass to a message template or accessor type. The data will populate the corresponding template variables.
  • profile
    • type: object
    • description: an object that includes any key-value pairs required by your chosen Integrations (see our Provider Documentation for the requirements for each Integration.) If profile information is included in the request and that information already exists in the profile for the recipientId, that information will be merged.
  • template
    • type: string
    • description: A unique identifier that can be mapped to an individual Notification. This could be the "Notification ID” on Notification detail pages (see the Notifications page in the Courier app) or a custom string mapped to the event in settings.
  • recipient
    • type: string
    • description: A unique identifier associated with the recipient of the delivered message, which can optionally map to a Courier managed profile. -->

These properties can all be set using the invoke api. Additionally, the data property can be initialized by triggers such as Segment, or modified by actions such as Fetch Data.

For example, you can access the userId supplied by segment in a send node using refs.data.userId

Accessing userId dynamically using refs.data.userId within the send node

Mapping dynamic data to notification templates

By default, all data passed into an automation is passed through to the notification template in a send call. However, there are cases where you want to map specific data attributes to different variables.

  1. Open a send node, click on the advanced section, and then click edit next to the Data field
  1. You can either the user the interactive JSON editor, or just modify the JSON in the text editor directly. The syntax to map the attribute is as follows:
  "<new_attribute>": {
"$ref": "data.<some_attribute>"
}

Example

Let's say we have a segment event as a trigger for our automation. The event has a vendor_name attribute in the segment properties object and we want to map that to a vendor attribute in our send call.

We would use the following syntax:

  "vendor": {
"$ref": "data.properties.vendor_name"
}

In the notification template, you are now able to access the vendor property directly in a template variable {vendor} rather than destructing the data object {data.properties.vendor_name}

Reserved Field values

The following field values are reserved for current and future interpolation features. They can not be used literally in an input field.

  • refs
  • data
  • profile
Was this helpful?