Table of Contents

Referencing the variables

Tales Souza Updated by Tales Souza

Contact's Variables

@contact rules represent contact's field values, individually for each respective contact.

The following expressions can be used in a flow to extract contact's data:

  - @contact or @contact.name - Contact's full name if present, if not, contact's ID. eg.: "Ben Haggerty".

  - @contact.first_name - Contact's first name, parsed from contact's full name stored at name if present, if not, phone number or contact's ID. eg.: "Ben".

  - @contact.display - Contact's full name if present, if not, contact's URN. eg.: "Ben Haggerty".   - @contact.fields - Contact's field and respecive values.   - @contact.urn - Contact's full URN address.   - @contact.language - Contact's primary language in ISO code 639-2.   - @contact.created_on - Contact's creation date in timestamp.   - @contact.groups - Contact's groups membership.   - @contact.urns - Contact's full URN address in array for all workspace's channels.   - @contact.uuid - Contact's UUID.   - @contact.channel - Contact's preferred channel name.

While @contact refers to the active contact that is receiving the message. But using the Send somebody else a message@contact refers to another contact that will receive the message (you will also see it's possible to set a contact's group).

Flow Variables

Flow variables refer to values collected in each flow. @results variables just inform the values collected by the flow as they are in use. This allows you to refer to the values previously collected or update contact's fields with a value sent by a contact. The default variable name matches the result name from the flow step.

When you type @results in a step, you will see a drop-down menu with a list of variables on the flow that will be filled automatically.

Examples

Below we will register a simple client using an e-mail, phone number, and age.

The Wait for Phone Number step collects answers from "…What is your phone number?" Send Message saving the response in a flow variable named phone_number:

Contact's responses can be referred to as@results.[prefix], in the case of the phone number we can use @results.phone_number saving to the respective contact's field.

See some possibilities that you can use to filter flow's variables according to your strategy. [variable name] is a reserved space for any result present on the flow.

@results - All flow variables collected until this point. eg.: "Name: Jane, Age: 32";

@results.[variable name] - The collected value. eg.: @results.age, "32";

@results.[variable name].category - The category is evaluated for. eg.: "valid phone";

@results.[variable name].value - The entire text is evaluated using a Rule Set. eg.: "I am 32 years old";

@results.[variable name].input - The date and time when a flow value was collected. eg.: "02/04/2016 19:11:50" (according to the date/time format).

Channel's expressions

@contact.channel refers to a channel a message is flowing through. For example, if a contact sends a message through Facebook, the variable @contact.channel will be referred to like a Facebook account ID.

@contact.channel.name - the name of the contact's preferred channel. eg.: "my Facebook page".

@contact.channel.uuid - the UUID of the contact's preferred channel. eg.: "6b85e123-c717-49f7-951e-1ab5a08961a0"

@contact.channel.address - the address of the contact's preferred channel. eg.: "Facebook (316455289259123)"

Date' expressions

The date's expressions refer to the timezone option set on the workspace settings. Observe that the variable format depends on the data template configuration.

@(now()) - The actual date and time in timestamp template. eg.: "2019-12-05T22:07:42.583440+03:00"

Use @(format_datetime(now())) to get date and time. eg.: "05-12-2019 22:09"

@(format_date(today())) - The actual date. eg.: "05-12-2019"

@(format_date(datetime_add(now(), 1, "D"))) - Tomorrow's  date. eg.: "06-12-2019"

@(format_date(datetime_add(now(), -1, "D"))) - Yesterday's date. eg.: "04-12-2019"

Webhook expression

@webhook refers to variables extracted from an external application through a webhook. It will always return the parsed JSON payload of the last webhook call, if necessary to call for previous steps webhook you must use the respective variable name for that webhook.

How did we do?

Logic expressions

Expressões

Contact