Expression Language
Expression Language is a special purpose language designed to compile and evaluate expressions from directly within the web interface.
An expression is a combination or formula created from one or more constants, attributes, functions, and operators. This formula is then calculated to determine an expression value which can then be used within Infobip products, Moments and People, to provide extensive customization beyond out the box functionality.
The values that an expression can output include:
- Boolean (True/False)
- Decimal
- Integer (whole number)
- String (text)
- Date or Date Time, depending on the functions and operators you use to create your expression
Why Expression Language
Expression Language, in conjunction with Infobip products, enables you to create variables and attributes that are context and user-sensitive, giving your users an enhanced user experience. For example, you can change the behavior and contents of messages you send depending on a user’s details, past actions, or conditions.
This is managed within People (opens in a new tab) and Moments (opens in a new tab) by creating computed attributes, through flow variables and directly inside flows to extend functionality and do things like:
- Order status tracking and calculating time delay of orders and then sending a response
- Generate unique personal URL to send link to collect feedback
- Format date time in a format that customers will better understand in their country
- Generate one time pin code
For instance, using the following examples you can build a form in Moments that gather feedback from a user over multiple SMS interactions, then branch the flow based on the responses. You can then capture the responses and changes as attributes in People profiles.
Example scenarios
Take a look at the following common examples of when you might use expressions in the web interface:
- Generate a random one time pin code - Use the
generatePin()
function to generate a one time pin code that can be then sent to customers via Flow. - Keep your CDP data clean - Use the
Find()
function to find data and then replace it or merge in order to keep data clean. - Format the date/time format to a local country style - For example, switch from a
MM/DD/YYYY
toDD/MM/YYYY
depending on your location. - Generate a unique personal URL to collect customer feedback - Concatenate a URL from profile attributes and variables to create a unique URL to collect feedback.
- Service-level tracking for your orders - Calculate time of delay on orders and escalate automatically.
- Perform calculations on values (such as addition or multiplication) - Calculating values for scenarios like counting the number of attempts a user has made in a competition campaign.
- Comparing values and acting on the result - For checking user responses or if a date is in the past or future.
- Identifying content in text or timestamps - Perhaps you want to capture a post/ZIP code, a keyword, or date inside a message.
Take a look at Expression Language reference to learn how to build an expression that works for your scenario.