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 in UI), Decimal, Integer (whole number), String (Text), Date or Date Time depending on the functions and operators you use to create your expression.
See Expression Language Reference for more information.
Why Use 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 (such as the time of day).
This is managed within People and Moments 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.
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 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 to DD/MM/YYYY depending on your location
- Generate a unique personal URL to send to send to collect customer feedback
Concatenate a URL ( concat() )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.