How to Use Variables in Atmosphere® SmartFlows

Variables are a very powerful tool in SmartFlows and can be used for a number of purposes. A variable is a named placeholder for information. It can be used to customize messaging, build business logic in flows, or send data to external systems or analytics.

Most actions have a section in the right-side navigation called ‘Available Variables’. This section will list variables that can be used in that action. When a variable is invoked in the course of a flow being executed, it will be replaced with the value it contains at that time. Here are some examples:

  • When a person calls a phone number with an Inbound Call trigger, their phone number is stored in a variable called $ANI. Use the $ANI variable to send an SMS follow-up message to the caller after the call wraps up.
  • When someone texts an Inbound SMS flow, the message is stored in a variable like this: $ISMS_1.message. Use this variable as the ‘Text Feed’ on the Sentiment action to analyze the message for positive or negative sentiment.
  • Add variables to the Body of a post request in the External Web Call to send the information they contain into another system; use them to build a URL in a GET request to bring back specific information about a particular record (ex. Find customer account balance based on the $ANI).


 

System-Wide Variables

SmartFlows offers some variables out-of-the-box for use in any flows, like $DateTime.currentDateText, which supplies the flow with the current date in a text form that can be send to other systems or read by text-to-speech functions.

*Note: Date- and time-specific variables can be customized to a specific time zone by ensuring that the desired time zone is set for the flow in the Flow Configuration section (click anywhere on the canvas to open).


Where to Find Variables

Drag-and-Drop Variables in Available Variables Section

Most of the time, variables will appear in the Available Variables section of an action’s configuration panel to be dropped into input fields or free-form messages.

 
Variable Dropdowns

In some cases, variables are not drag-and-drop but must be chosen from a dropdown. This is the case on the Switch and Condition actions.


Setting Variables

There are several areas in SmartFlows that allow or require users to set their own variables. When setting variables, remember to keep these constraints in mind:

  • Cannot contain spaces
  • Cannot contain underscores
  • Case sensitive
  • If variable is updated, it must be manually updated everywhere else it is used in the flow; changes to variable names do not propagate automatically

Set Variable Action

The ‘Set’ action offers users the ability to create their own custom variables or rename existing variables.

This can be used in several ways:

  • Create a ’store address’ variable to avoid having to retype the same value in multiple text-to-speech areas
  • Rename $DateTime.currentDateText to $date to avoid having to retype
  • For text-to-speech controls, such as ‘breathiness’ or ‘pace’, set the tags as variables so they can be controlled across all TTS in the flow from one place for a consistent voice sound

Setting Variables in the External Web Call

There are also other areas of the application where users must create variables. One example is when using the GET request type on the External Web Call, which is designed to retrieve information from an external source. The ‘Response Variables’ section prompts to user to store this retrieved information in a variable. In the diagram below, the query expression (input box on the right) is the JSON text written to work with the external system; the name for the new variable goes on the left.


Setting Variables in the Inbound API

The Inbound API can also be set up to accept inputs from an external source and store them in variables that can be used in other parts of the flow. To do this, the incoming POST request to SmartFlows should include the Flow ID for the flow being called by the API (found in the Flow Configuration section) and the required values in the selected format (JSON or XML). In addition, the inbound API currently requires a value for an ANI and a DNIS in the request, though these need not be used in the flow.

Any values needed in the flow should be configured in the Expected Input section on the Inbound API as shown in the diagram below (FIRSTNAME, LASTNAME, PHONE, BIRTHDAY).

 
Setting Variables in the Jump To & Jump From Actions

Variables from a source flow (a flow containing a Jump To action) can be passed to a destination flow (a flow containing a Jump From action, connected to a source flow). They must be explicitly configured in the ‘Send Variables’ section on the source flow (a), and they must also be explicitly configured as ‘Expected Variables’ on the Jump From action in the destination flow (b).

a.

b.