The Omnichannel Webhooks feature allows you to integrate Omnichannel with any third-party system, e.g., CRM, Zoho, etc.
Create Omnichannel webhook
To create a new Omnichannel webhook, go to Administration > Omnichannel > Webhooks.
Webhook URL: Enter the destination webhook URL where the data will be sent.
Secret Token: Enter a secret token that can be used to verify the webhook.
The field Secret Token is sent to a header
X-RocketChat-Livechat-Token
so that you can validate if the request is from Livechat. If your endpoint returns a response status other than200
, Rocket.Chat will retry ten times, waiting ten seconds between retries.
Send Request on: Select the actions or events that will trigger this integration and send data to the webhook, such as when a chat is taken or when a visitor sends a message. The available options are:
Chat Start
Chat Close
Chat Taken
Chat Queued
Forwarding
Offline Messages
Visitor Messages
Agent Messages
HTTP timeout (in milliseconds): Enter the request timeout value.
Click Save.
Click Send Test to verify the webhook setup. If successful, a message saying It works will be displayed. You will receive a sample JSON response at the configured URL.
You can also Reset the values for the Webhook setup.
The Webhook URL and Secret Token configured here are automatically populated in the Webhooks settings under Administration > Workspace > Settings > Omnichannel > CRM Integration.
Sample JSON data
Below is an example of the JSON data received by the webhook URL:
{
"_id": "Tc5SyBZHovD4k8BXv",
"label": "James",
"createdAt": "2023-02-02T10:16:07.230Z",
"lastMessageAt": "2023-02-02T10:22:14.087Z",
"tags": [
"self"
],
"visitor": {
"_id": "63db8d4990fe6eda42ad429a",
"token": "e36e352c742eee48860d576fcefb372afc44ebc95750fa1e3b646195f702341a",
"name": "James",
"username": "guest-3",
"email": [
{
"address": "[email protected]"
}
],
"phone": null
},
"agent": {
"_id": "aXjjcPwq4Pcp7xftH",
"username": "user1",
"name": "User One",
"email": "[email protected]"
},
"type": "LivechatSession",
"messages": [
{
"u": {
"_id": "63db8d4990fe6eda42ad429a",
"username": "guest-3",
"name": "James"
},
"_id": "2untSdndqBP7opGWw",
"username": "guest-3",
"msg": "Hi",
"ts": "2023-02-02T10:16:09.615Z"
},
{
"u": {
"_id": "aXjjcPwq4Pcp7xftH",
"username": "user1",
"name": "User One"
},
"_id": "7xjkw8ZFitMSNGmeJ",
"username": "user1",
"msg": "How can I help you today?",
"ts": "2023-02-02T10:21:05.391Z",
"agentId": "aXjjcPwq4Pcp7xftH"
},
{
"u": {
"_id": "63db8d4990fe6eda42ad429a",
"username": "guest-3",
"name": "James"
},
"_id": "y7p77YFfkHJeg5gD9",
"username": "guest-3",
"msg": "don't worry,thank you",
"ts": "2023-02-02T10:22:14.087Z"
},
{
"u": {
"_id": "aXjjcPwq4Pcp7xftH",
"username": "user1",
"name": "User One"
},
"_id": "ciAggDuN8ioqDrTby",
"username": "user1",
"msg": "Thank you for visiting",
"ts": "2023-02-02T10:23:11.437Z",
"agentId": "aXjjcPwq4Pcp7xftH",
"closingMessage": true
}
],
"servedBy": {
"_id": "aXjjcPwq4Pcp7xftH",
"username": "user1",
"ts": "2023-02-02T10:16:07.375Z"
},
"closedAt": "2023-02-02T10:23:11.344Z",
"closedBy": {
"_id": "aXjjcPwq4Pcp7xftH",
"username": "user1"
},
"closer": "user"
}
{
"_id": "Tc5SyBZHovD4k8BXv",
"label": "James",
"createdAt": "2023-02-02T10:16:07.230Z",
"lastMessageAt": "2023-02-02T10:16:09.615Z",
"visitor": {
"_id": "63db8d4990fe6eda42ad429a",
"token": "e36e352c742eee48860d576fcefb372afc44ebc95750fa1e3b646195f702341a",
"name": "James",
"username": "guest-3",
"email": [
{
"address": "[email protected]"
}
],
"phone": null
},
"agent": {
"_id": "aXjjcPwq4Pcp7xftH",
"username": "user1",
"name": "User One",
"email": "[email protected]"
},
"type": "Message",
"messages": [
{
"u": {
"_id": "aXjjcPwq4Pcp7xftH",
"username": "user1",
"name": "User One"
},
"_id": "7xjkw8ZFitMSNGmeJ",
"username": "user1",
"msg": "How can I help you today?",
"ts": "2023-02-02T10:21:05.391Z",
"agentId": "aXjjcPwq4Pcp7xftH"
}
]
}