The condition module is a Boolean module that evaluates an expression and returns a result (success or failure) to determine the next steps in the contact flow. If the result of the expression is true, the contact flow follows the success branch (based on a successful event) and if the result of the conditional expression is false, the contact flow follows the failure branch (based on a failed event).
- The condition module is used only for an outbound or inbound contact flow.
- The condition module uses the Condition Expression property.
To allow unexpected responses sent by your customers, consider using an all-encompassing expression.
Example:
Suppose that a regex in the condition module to unsubscribe from SMS contains the syntax ^STOP$. If a customer sends an SMS that contains not only the keyword (for example, Stop sending me SMS), the inbound SMS is not recognized because the syntax can recognize only that SMS whose entire body contains only the keyword "Stop" (case-insensitive). Therefore, consider using an expression that can recognize an inbound SMS if the keyword is present anywhere in the body of the SMS. An example of such an expression is as follows.
/(^|\W)(STOP|END|CANCEL|UNSUBSCRIBE|QUIT)(\W+|$)/gi.test(`{"type":"tts","name":"sms_message","source":"system"}`)
You must enclose the entire variable in single quotes. For example:
'{"name":"support_level","default_value":"","contact_field":"","interaction_field":"","tts_type":"","callflow_variable":true,"source":"callflow"}' == 'Platinum'
Examples
Here are some sample conditions that the Condition Expression supports:
Condition Description | Expression |
---|---|
Is alternate_phone the same as the first position of EXTRA_13 (the value before the first | delimiter)? | alternate_phone==unescape(plan_amount).split(\'|\')[0] |
Is the current time:
|
|
Does variable A contain an asterisk(*)? | /\*/gi.test(A) |
Is the area code 303 or 719? | phone_dialed.substring(0,3)==\'303\' || phone_dialed.substring(0,3)==\'719\' |
Is the call center open? | callData.call_center_open == 1 |