When configuring the trigger, suppose you specify a list/array of objects in the payload (or sometimes headers). These values are presented in a special syntax when creating a condition or configuring a notification event action and are called an Index or Indices.

For instance, let's say our payload looks like this.

{
    "batch": [
        {
            "email": "[email protected]",
            "name": "John Doe"
        },
        {
            "email": "[email protected]",
            "name": "Jane Doe"
        }
    ]
}

Now, the email and name will appear as input.body.batch.[#index#].email and input.body.batch.[#index#].name respectively when configuring the Condition or the Notification Event.

The #index# syntax is called an "Index". When dealing with Indices in an Automation, you should provide a substitute value (either a number or 'all') which the automation uses when invoked.

Indices in a Condition

When a key containing #index# is selected as a variable in a condition, you will need specify a numeric index value.

For example, let's say that you know that the first email in the list is always going to be [email protected] when you invoke the automation.

We specify the condition input.body.batch to build this condition.[#index#].email equals [email protected] and type in the index value as 0.

🚧

Indices can only be numeric and always start with 0 !

When the automation evaluates this condition, it replaces the #index# with 0 to check if the first email in the list is [email protected].

Indices in a Notification Event

When a key containing #index# is selected in either the To or Data sections of an notification event, we see 2 options:

  1. Send to all
  2. Send by index

For instance, if we select input.body.batch.[#index#].email when configuring the email channel and select "Send to all" as the index, the automation will send the email to all the emails specified in the list. However, if we select "Send by index" and set a numeric value, say 1, the email will be sent only to the second email in the list - [email protected] in our example.

Each sections' values for body, query etc depend on the location where they appear when configuring the trigger. The below table has the complete list.

Location in triggerSection value (to be selected)
Methodmethod
Headerheader
Query Paramquery
Payload (json)body
Payload (form/url-encoded)formdata
Payload (text)body

📘

Good to Remember

  1. If the payload contains multiple lists/arrays, the same list/array should be chosen if configuring multiple channels or if configuring the distinct id and a channel. Similarly, if the data or additional data also contains a list type, it should be the same list/array as used in the channel/distinct Id configuration.
  2. The data or additional data cannot have a list/array type if the channel and/or distinct Id do not.
  3. When using indexes across the distinct Id/channels and data, the index value should either be 'Send to all' or 'Send by index'. It can never be a combination of the two.