Livechat
Last updated
Last updated
Ministry.Chat had minimal Livechat as a feature for a long time.
Recently the demand for production-grade Livechat has increased, so we started a complete rewrite of the package.
This document contains instructions on setting up the new Livechat work-in-progress version.
Livechat package adds the ability to embed a pop-up support chat to your website.
First, you have to enable the Livechat feature on your Ministry.Chat instance. Go to Administration > Settings > Livechat
and enable it.
Now the admin will have access to Livechat manager through a new menu called Livechat
at the top left corner drop down menu.
At Livechat manager you'll have the following configuration options:
You can add new Livechat manager users and agents.
To start receiving incoming live chats you need to add Livechat agents.
You can have the following behavior depending on how many departments you have created:
No departments: all Livechat agents will receive incoming chats using a round robin rule;
One department: all incoming chats will be offered to agents only on that department using a round robin rule;
More than one department: the visitor will have to choose what department he wants to talk to at registration.
You can configure how your Livechat widget will be triggered and what it will do on your website.
You can set a condition (e.g. user access a URL) and an action (e.g. send a message with the text "hello").
You can configure custom fields to be sent by the client. You can see an example on the Livechat API page.
Go to the Livechat Manager -> Installation
Then copy the code displayed into the source code of your website. You may modify it to meet your specific requirements.
To customize the appearance of your Livechat widget goto Livechat -> Appearance
You can use webhooks to easily integrate Livechat with your CRM.
The Ministry.Chat will send a POST to the WebHook URL when the Livechat ends or you receive a new offline message.
Here is an example of the JSON data sent at the end of a Livechat session:
Here is an example of the JSON data sent on a Livechat offline message:
The field Secret Token is sent to a header X-RocketChat-Livechat-Token
so you can validate if the request became from the Livechat.
If your endpoint returns a response status other than 200, Ministry.Chat will retry 10 times waiting 10 seconds between retries.
Magento 2
Magento 2 depends on RequireJS to load JavaScript resources, so we need to change the widget code a little to look like:
Replace the https://rc.example.com/
with your Ministry.Chat (sub-)domain, and paste the code into your theme file /app/design/frontend/Theme_provider/theme_name/Magento_Theme/templates/root.phtml
right before the closing </html>
tag. Flush your PHP OpCode cache, and you are ready to go.