Check for conditions to proceed
This trigger allows to have custom conditions to be checked before rest of the triggers can be processed.
One of the few possible scenarios can be
- Collecting multiple fields before next trigger can be executed
- Comparing user message with internal chat variable. E.g you set chat variable and later you want that visitor entered correct text.
Attribute supported placeholders
Attribute
supports these placeholders
lhc.<main chat attribute>
E.glhc.email
,lhc.nick
,lhc.phone
etc. See swagger for all attributes.<identifier>
- this can be either custom attributeField identifier
or just array key fromchat_variables
<chat_variable>
- identical to{args.chat.chat_variables_array.<variable_key>}
It can be set usingUpdate current chat response
response type
So if you set variablebot_touched
in attribute field you can use eitherbot_touched
or{args.chat.chat_variables_array.bot_touched}
{args.chat.<main chat attr>}
or{args.msg.msg}
you can use text matching for visitor message.online_department
use as attribute to check is department online (respects department online hours and operators online statuses). In value field 1 means online, 0 - means offlineonline_op_department
use as attribute to check is department online (ignores department online hours) and checks only for operators. In value field 1 means online, 0 - means offlineonline_department_hours
use as attribute to check is department online by online hours settings (ignores ignores operators statuses). In value field 1 means online, 0 - means offlinesiteaccess
you can use this attribute to check whatsiteaccess
visitor is on and execute appropriate trigger. E.g if you want different response by language.eng
,lit
list of default siteacesschat_files
check does chat has fileschat_files
>
0
- chat has fileschat_files
contains
pdf,jpg
- chat has pdf or jpg
operator_files
same checks aschat_files
except only for operator filesuser_files
same checks aschat_files
except only for visitor files{validation_event__<event_name>}
E.g{validation_event__my_event_validator}
event withmy_event_validator
will be dispatched and result afterwards compared with expected output.my_event_validator
=
1
If you do not enter Value
means it's empty.
E.g
- so
lhc.email != <empty>
as in screenshot. Means I'm checking that e-mail would not be an empty string. {args.msg.msg}
I'm expecting message to contain one of the wordsdispute, chargeback, refund{2}, money back, contact bank
.Refund
word can have two typos.
How to validate {validation_event__<event_name>}
class erLhcoreClassExtensionValidateevent
{
public $configData = false;
public function __construct()
{
}
public function run()
{
$dispatcher = erLhcoreClassChatEventDispatcher::getInstance();
$dispatcher->listen('chat.genericbot_event_handler', 'erLhcoreClassExtensionValidateevent::genericEventHandler');
}
public static function genericEventHandler($params)
{
if ($params['render'] == 'my_event_validator') {
return array(
'status' => erLhcoreClassChatEventDispatcher::STOP_WORKFLOW,
'validation_result' => 1
);
}
}
}
Value supported placeholders
Value supports only {args.
type placeholders. E.g {args.msg.msg}
or {args.chat.chat_variables_array.<variable>}
How do I check visitor message with internally stored chat variable?
Example condition can look like
Collect all information and write information was collected.
Main trigger can look like this.
And each collecting information step can look like this
Allow to execute rest of the triggers only if e-mail is not empty
In this example we forward to e-mail collecting workflow if visitor e-mail is empty.
How to add custom icon if visitor writes some message containing specific text?
For that we will need
- Webhooks
- Trigger setup
Trigger setup can look like
Webhook setup can look like