Articles on: Flows

Contact Variables

Contact Variables



@contact - references the contact receiving the message. This is the active contact - the person whose responses are being handled by the workflow. When using the Send a Message to Someone Else action, @contact refers to the contact or group of contacts to which the message is being sent.
Each extension, e.g. @contact.name or @contact.fields.field_name, references a specific contact field.

@contact - The full name of the contact if one is set, otherwise their phone number if not set, e.g. "Ben Haggerty"

@contact.name - Also the full name of the contact if one is set, e.g. "Ben Haggerty"

@contact.first_name - The first name of the contact if one is set, e.g. "Ben"

@contact.groups - The groups in which the contact has been placed. 

@contact.uuid - The universally unique identifier assigned to each contact. 

@contact.display - The name or URN of the contact.

@contact.language - The language iso code for the contact. 

@contact.created_on - The creation date of the contact.

@contact.channel - The preferred channel of the contact.

@contact.fields.field_name - any contact fields you've created for your contacts, e.g. @contact.age



Contact URNs



 To access URNs of particular types for your contacts, use the @urns variable.

@urns - all URNs for the contact

@urns.mailto - The email address assigned to the contact.

@urns.tel - The phone number of the contact.

@urns.channel type - This will be whatever channel type the contact has, such as @urns.facebook, @urns.whatsapp, or @urns.jiochat, to name a few.

@urns.line - The line ID for the contact.

Contact Fields



@fields variables refer to the custom contact fields for a contact. 

@fields - The custom fields for the contact.

@fields.field_name - The custom field created for the contact, such as @fields.age or @fields.baby_name.

Flow Result Variables



@run.results, or for short, @results variables refer to values collected at each Wait for Response within a flow. @results variables only reference values collected by the flow run in which they're called. This allows you to refer to previously collected values in the run or update contact fields with a value sent by a contact.

The name of the variable will correspond with the name of the result of the Wait for Response action that collects it:



When you type @results. into a node's text dialogue, an auto-completion drop-down menu will appear listing the current variables in the flow:



For example...



We've created a very simple flow that collects and updates a contact's name and age using @results.contact_field.



Here's the Wait for Response Split Action named "Name" which collect's the contact's name. Note that we used the response rule has any of the words to leave it open-ended.



Your contact's responses can then be referenced using the @results. prefix:



We can then use @results.name to save a contact's name to a new contact field of the same name:



Here's a list of extensions that give you the power to filter flow result variables depending on your needs. variable_name is a placeholder for any result present in a flow:

@results - All flow variables collected to this point, e.g. "Name: Jane, Age: 32"

@results.variable_name.value- The value collected, e.g. "32"

@results.variable-name.category - The category a response is evaluated to, e.g. "Valid".

@flow.variable-name.created_on - The date and time when a flow value was collected, e.g. "2014-05-02 19:11:50" (dependent on your timezone and date format settings).

Input Variables



The @input variable references the most recent input.

@input - The most recent input.

@input.text - The text of the last message; e.g. "help"

@input.created_on - The date and time when the last message was received, e.g. "11-12-2015 13:24"

@input.type - the type of the last input.

@input.uuid - The UUID of the last input.

@input.channel - The channel type on which the last input was received.

@input.attachments - The attachments from the last message.

@input.external_id - The external ID associated with the input.

Date Variables



Date values are now function calls, such as @(today()) and @(now()). See more here for information on functions.

Parent & Child Variables



In child flows, entered through Start Another Flow actions and subflow Split Actions, @parent can be used to reference the flow result fields collected in the previous (parent) flow, e.g. @parent.field.

Likewise, @child can be placed in the parent flow to reference flow fields collected by the child flow up to the point the contact either finished the child flow or expired from it.

External Variables



When referencing external variables from a Webhook, such as with Airtable, use the @webhook variable.

Alternately, when you are passing an external variable when initiating a flow with Zapier or an external API, use @trigger.params.variable_name

Additionally, you can use @trigger.user in your flows to see the email address of the user who started the flow broadcast and @trigger.origin to view how and where the user started the flow; i.e. UI, API, or Zapier.

Global Variables



Globals are shared values that can be referenced in flows, as well as broadcasts and campaigns, within your account referenced by @globals.value_name. They allow you to create a value once and use it repeatedly without having to reenter the value.

See how to use globals here

Advanced Usage



Like in Javascript, variables can also be referenced using square brackets notation. Though note that this requires using parentheses around the entire expression, e.g.

@contact.name is equivalent to @(contact["name"])

The name of the property can be a variable itself so for example if the value of Response 1 was "name", you could write the above example as:

@(contact[results.response_1])

Send us a message via the support widget in the bottom right corner with any questions!

Updated on: 24/07/2023

Was this article helpful?

Share your feedback

Cancel

Thank you!