Use one or more combinations of filters based on Keyname. The Keyname can be exact text or a pattern/regular expression.
Shorthand Approach
Up to three combinations can be used in a single contactHistory expression function, and can be placed in any order.
Example 1
This example shows a combination of Message and Channel filters in a single contactHistory function.
Criteria: -Qualify if: -Message M1 has been extended or responded to the customer -In Channel 'SMS' Expression: set("extendedOrResponded", contactHistory("message", "msg1", "channel", "sms")) && count(extendedOrResponded) > 0
Example 2
This example shows a combination of Response and Message filter.
Criteria: -Qualify if: -Message 'M1' has been extended at least twice -On Any Channel -For Any Message Strategy Expression: set("extended", contactHistory("response", "extended", "message", "msg1")) && count(extended) >= 2
Example 3
These examples show three filters: Response, Message, and Channel.
Criteria: -Qualify if: -Message 'M1' has been extended at least twice -On Channel 'SMS' -For Any Message Strategy Expression: set("extended", contactHistory("response", "extended", "message", "msg1", "channel", "sms")) && count(extended) >= 2
Example 4
Criteria: -Qualify if: -Message 'M1' has been extended at least twice -On any Channel that starts with 'sms' -For Any Message Strategy Expression: set("extended", contactHistory("response", "extended", "message", "msg1", "channel", pattern("sms.*"))) && count(extended) >= 2
Example 5
This example shows a combination of Response, Message, and Message Strategy filters.
Criteria: -Qualify if: -Any Message that contains the text 'spring2020' has been extended at least twice -For Any Message Strategy with Keyname that ends with 'recharge' Expression: set("extended", contactHistory("response", "extended", "message", pattern(".*spring2020.*"), "messageStrategy", pattern(".*recharge"))) && count(extended) >= 2
Longhand Approach
It is also possible to use a single filter and use the resulting filtered List as an input to the next contactHistory expression, which is based on a different filter.
Example 6
Criteria: -Qualify if: -Message M1 has been extended or responded to the customer -In Channel 'SMS' Expression: set("messageCH", contactHistory("message", "msg1")) && set("channelMessageCH", contactHistory(messageCH, "channel", "sms")) && count(channelMessageCH) > 0
In the previous example, the initial filter is on Message and the resulting List is placed in the "messageCH" variable. This variable, a List, becomes an input to another contactHistory function which uses a different filter, on Channel.
Example 7
Criteria: -Qualify if: -Any Message that contains the text 'spring2020' has been extended at least twice -For Any Message Strategy with Keyname that ends with 'recharge' Expression: set("extended", contactHistory("response", "extended", "message", pattern(".*spring2020.*"))) && set("messageStrategyCH", contactHistory(extended, "messageStrategy", pattern(".*recharge")))) && count(extended) >= 2