Skip to main content


There are two events types

  • Hook based event - webhook allows to send a request to third party service once some event happens in Live Helper Chat. E.g chat being closed/started.
  • A continuous event - it's and event executed only if more than one action happens in a row.

There is also video tutorial

How to active?

First you have to enable them in your settings.ini.php

'webhooks' =>
'enabled' => true,
'worker' => 'http', // resque

Location of these settings

If you are updating from older version than 3.47v you have to add these settings manually.

Worker options

By default we will execute events in http mode. Means if some events happens we will execute event at the same moment. This has disatvantage as it can slow down UI for the visitor or operator.

If you are using lhc-php-resque extensions I suggest to use resque as worker. It will execute all events in the background.

How to setup hook based event?

I'll give a sample how to setup an event on chat close.

  • First you have to find what event you want to listen to from hooks. Looking at list we find chat.close event and it has two arguments
  • chat - Chat instance.
  • user_data - User instance.
  • Their model's descriptions we can find in
  • You can those variables in rest API with new placeholder like {{}} or {{} you can access as deep as you want into these variables.

So our webhook configuration can look like this.

As you can see I have chosen a bot and trigger to execute on that event Execute if conditions are valid.

Execute if conditions are NOT valid this is usefull in continuous webhooks. E.g

If conditions A is met we add an alert icon if conditions is not met we remove alert icon.

How to setup a continuous chat hook event?

General purpose is the same as hooks based events. Execute trigger if conditions are valid. E.g add an alert icon to the chat.

Conditions are checked only for Active, Bot, Pending chats.

First of all there are three conditions you can check before event is executed.

  • Visitor message contains - in this checking last chat message has to be a visitor message
  • Compare attribute - you can compare any chat attribute for conditions to be matched
  • Start of OR - you can have OR conditions between conditions groups

Related cronjobs

Visitor message contains

This allows you to check does visitor message contains specific keywords. Text matching rules can be found here

Compare attribute

You can compare any chat attribute using this condition. You also have access to special placeholder {time} it's timestamp. You can also use mathematical expressions.

Supported placeholders

  • {<any chat attr>} you can use for comparison including sub attribute like {<any_department_attribute>}. Chat object also see __get method for magic attributes like
    • department or user
      • {} name visible in the widget or
      • {} name visible in the back office
  • {time} - current timestamp
  • {} - last time visitor was seen online or checked for messages.
  • {} - check for chat sub-status
    • const STATUS_SUB_DEFAULT = 0;
      const STATUS_SUB_CONTACT_FORM = 2;
      const STATUS_SUB_START_ON_KEY_UP = 4;
      const STATUS_SUB_SURVEY_SHOW = 5;
      const STATUS_SUB_ON_HOLD = 8;
  • {} - check for chat status
    • const STATUS_PENDING_CHAT = 0;
      const STATUS_ACTIVE_CHAT = 1;
      const STATUS_CLOSED_CHAT = 2;
      const STATUS_CHATBOX_CHAT = 3;
      const STATUS_OPERATORS_CHAT = 4;
      const STATUS_BOT_CHAT = 5;
  • {} - operator object with it's own attributes
  • {} - you cannot use this attribute in bot chat status because while chatting with bot it remains zero always. Use {} as bot should always respond within few seconds.
  • {} Chat object also see __get method for magic attributes like
    • department or user
      • {} name visible in the widget or
      • {} name visible in the back office

These are the main classes

All classes can be found here


When a customer writes hello or are you there or hi and there’s no reply from the agent in 25 seconds.

When a customer writes hello or are you there more than once in a row.

You can combine these two rules into single continuous webhook using Start of OR

When bot does not respond for 60 seconds


  • First we check that chat is in bot status {} = 5
  • From visitor last message time passed more than 60 seconds. {} < {time}-60 OR {} < {time}-60
  • Widget is not closed {} != 3
  • Visitor was seen in the last two minutes {} > {time}-120. Remove that rule in third party integrated chats! as this attribute is always zero in that case. WhatsApp etc...
  • Last message was a visitor message {} = 0. We do not want to terminate chat if visitor is not replying.

When user is not responding to bot for 60 seconds?


  • First we check that chat is in bot status {} = 5
  • From bot last message time passed more than 60 seconds. {} < {time}-60
  • Widget is not closed {} != 3
  • Last message was a bot message {} = -2.

When an agent chat duration time is > 1.5 department average chat time.

Here we do few tricks.

  • We check that check status has to be active {} = 1
  • Chat sub status indicate that visitor has not closed chat explicitly {} != 3. You can find possible values in api documentation.
  • {time}-({}+{}) > 1.5*{}
  • On left side we get how chat chat is going. Curren time (time when chat become pending + time how long visitor waited for chat being accepted)
  • 1.5 multiplied by department average chat duration. To has this attribute you have to be running statistic cronjobs

Send an e-mail when customer fills a survey

Idea is to send an e-mail to department e-mail once a survey is filled by a visitor. Same workflow can be used for any other events.

  • We listen for survey.filled

  • We execute trigger with Send mail trigger.

How to setup a continuous mail hook event?

  • All conditions are based on message model attributes. MailMessage object definition
  • Conversation object can be reached with {}
  • Event is always triggered for newest mail messages.
  • As same mail message can be matched multiple times we are tracking which mail messages were matched already so no duplicate events is processed.
  • It's important to limit number of result matched. This can be done via {} attribute.

How to trigger if mail is in active/pending state for 6 hours

  • Let's assume our trigger is run every 20 seconds.
  • We are limiting result set by collecting only mails if they are older than 6 hours but not more than 7 hours.

{} < {time} - 21600 - older than 6 hours {} > {time} - 25200 - younger than 6 hours {} != 2 - mail message is not responded.

If you are storing custom variables in a conversation object, you can reach those this way.


How do I find message id for debug?

  • Open any conversation and click three dots on desired mail message and copy Download (eml) it should look like 3000000929266 will be your message id
  • Navigate to Audit Log and click Debug chat attributes. Instead of Chat ID enter Message ID

How to setup bot and trigger?

Our close trigger configuration can look like this.

How to configure Rest API call.

Rest API can be configured same way as it's working with normal bot workflow. Please read an article.

How to send to Rest API only bot chats?

You can use Rest API conditions tab.