Triggers (auto-messages)

Triggers are actions started automatically based on defined conditions. You can set automatic messages to visitors with triggers.

{ "active": true, "name": "Name", "description": "Description", "event": "onload", "only_once": true, "constraints": "all", "conditions": [...], "actions": [...] }
NameDescription
activetrue or false.
nameInternal name of the trigger
descInternal description of trigger
eventEvent that triggers a trigger (described lower)
only_oncetrue or false. true to launch trigger only once for each visitor.
constraintsall or any. If value is all, then all conditions must be met to activate trigger.
conditionsTrigger conditions (described lower)
actionsTrigger actions (described lower)

Events

  • onload - when visitor open page
  • onmessage - when visitor send a message

Conditions

Condition consists of 3 items: name, value and cmp. name and value are required fields and cmp is optional. cmp is a comparator and can be modified. If comparator is not specified, the condition uses eq comparator.

Example:

{ "name": "delay_site", "cmp": "eq", "value": 60 }

Comparator types

integer

NameDescription
eq= equals
neq!= not equals
lt< is smaller than
gt> is higher than
lte<= is smaller than or equals
gte>= is higher than or equals

string

NameDescription
eq= equals
neq!= not equals
like? contains
nlike!?not contains
regex$ matches regular expression

boolean

Boolean has no comparator.

Condition types (condition`s name)

Visitor states

Name Type Description
is_visitor_served True if visitor is(was) served by agent
is_visitor_communicate True if visitor is in a conversation or chat is active
is_visitor_send_message True if visitor sent any message
is_triggered True if visitor was triggered (received message from trigger)
visitor_group Visitor`s group. Groups are created in dashboard or by REST api.

Site/Page Delays

Name Type Description
delay_site Wait num of seconds until next condition will be evaluated. Minimum value is 1.
delay_page Wait num of seconds until next condition will be evaluated. Minimum value is 1. This delay is canceled when user go to other page.

Dates and times

Name Type Description
hour_of_day Value between 0 and 23.
day_of_week Value between 1 and 7. 1 is Monday, 7 is Sunday
month_of_year Value between 0 and 11. 0 is January, 11 is December
month_of_year Value between 0 and 11. 0 is January, 11 is December

Visitor location

Name Type Description
visitor_ip Visitor`s IP address. (e.g. 85.93.112.251)
visitor_city Visitor`s city. Works only if city is detected.
visitor_country_code Visitor`s country. Use short country names in lowercase format, e.g. pl for Poland

Visitor activity

Name Type Description
number_of_visits Num of visits your page by visitor. Visit is one online session. When visitor leave site at least 30s, and then return back, is num of visits increased by 1. Minimal value is 1.
number_of_chats Num of finished chats by visitor. Minimal value is 0.

Current page info

Name Type Description
visitor_page_url Current page url started with http://. If you want use only path in condition, recommended comparator is like
visitor_page_title Current page title
visitor_referer Visitor`s referer. Not changed by site browsing.

Visitor technologies

Name Type Description
visitor_browser Visitor`s browser.
visitor_platform Visitor`s OS. Most used platforms: Windows, Windows, Mac, Linux, iOS, iPAD. Recommended comparator is like

Account

Name Type Description
account_status Value represent "best" status of account. If one operator is "online", and second is "offline", account status will be "online". Allowed values are: online and away.

Actions

Action is executed after defined conditions are met. Typically it can be a message to the visitor. We currently support only one action message per trigger.

message - Send message to visitor

{ "name": "message", "agent_nick": "Support", "message": "Hello, we have noticed you are here for the 1st time. If you have any questions, do not hesitate to get in touch." }
Param Type Description
agent_nick string Name of the agent, who sent a message. (doesn't have to be name of a real agent, only visible in chat)
message string Message sent to the visitor

Examples (most used triggers)

  • Event is onload. Trigger is fired 60s after visitor opens the website
  • Trigger is fired only once per visit
  • Trigger is not fired if the visitor sends a message earlier than 60 seconds after coming to the website
  • Trigger is not fired if the visitor is in a conversation (either an agent or the visitor sent a message)
  • Trigger is sent only when the visitor is on the website for the 1st time
  • If all conditions are met, action is triggered (message is sent to the visitor)

{ "active": true, "name": "1st visit greeting", "description": "Greeting message to a visitor who visits your website for the 1st time", "event": "onload", "only_once": true, "constraints": "all", "conditions": [{ "name": "delay_site", "value": 60 }, { "name": "is_visitor_send_message", "value": false }, { "name": "is_visitor_served", "value": false }, { "name": "number_of_visits", "value": 1 }], "actions": [{ "name": "message", "agent_nick": "Support", "message": "Hello, we have noticed you are here for the 1st time. If you have any questions, do not hesitate to get in touch." }] }

  • Event is onload. Trigger is fired 60s after visitor opens the website
  • Trigger is fired only once per visit
  • Trigger is not fired if the visitor sends a message earlier than 60 seconds after coming to the website
  • Trigger is not fired if the visitor is in a conversation (either an agent or the visitor sent a message)
  • Trigger is sent only when the visitor is on the website for the 2nd time
  • If all conditions are met, action is triggered (message is sent to the visitor)

{ "active": true, "name": "2nd visit greeting", "description": "Greeting message to a visitor who visits your website for the 2nd time", "event": "onload", "only_once": true, "constraints": "all", "conditions": [{ "name": "delay_site", "value": 60 }, { "name": "is_visitor_send_message", "value": false }, { "name": "is_visitor_served", "value": false }, { "name": "number_of_visits", "value": 2 }], "actions": [{ "name": "message", "agent_nick": "Support", "message": "Hello, we are glad you're back! If you have any questions, we would be happy to help." }] }

  • Event is onmessage, so visitor must send a message first for the trigger to be fired
  • Trigger is fired only once per visit
  • If the visitor sends a message and no agent answers in 45s, trigger is fired (message is sent to the visitor)

{ "active": true, "name": "We are busy message", "description": "Message sent to visitors when you are busy", "event": "onmessage", "only_once": true, "constraints": "all", "conditions":[{ "name": "delay_site", "value":45 }, { "name": "is_visitor_served", "value": false }], "actions": [{ "name": "message", "agent_nick": "Support", "message": "We are busy at the moment. Sorry about that. Leave us your email and we will contact you as soon as possible." }] }