Passing events to the platform
tip
A webhook is set for a
POST {apiUrl}/setWebhook
request where events from agents should be routed to.Webhook format:
http://{host_name}/chatadapter/chatapi/webhook/operatorapi/{apiKey}
Request
POST /chatapi/webhook/operatorapi/{apiKey}
Request body
The request body contains the data required to create or modify an object. The data must be in the JSON format.
You can see the events that can be sent, their structure and fields below.
POST /chatapi/webhook/operatorapi/{apiKey}
Request body: TextMessage | FileMessage | Closed | SelectDestination
TextMessage: {
"id": "id",
"userId": "54321",
"type": "TextMessage",
"text": "text",
"employee": {
"employeeId": "id",
"firstName": "first name",
"lastName": "last name",
"avatarUrl": "http://someUrl",
},
},
FileMessage {
"id": "id",
"userId": "54321",
"type": "FileMessage",
"url": "http://someUrl",
"employee": {
"employeeId": "id",
"firstName": "first name",
"lastName": "last name",
"avatarUrl": "http://someUrl",
},
"name": "example",
"size": "2",
"comment": "file",
},
Closed {
"id": "id",
"userId": "54321",
"type": "Closed",
"employee": {
"employeeId": "id",
"firstName": "first name",
"lastName": "last name",
"avatarUrl": "http://someUrl",
},
},
SelectDestination {
"id": "id",
"userId": "54321",
"type": "SelectDestination",
"destination": {
"destinationId": "id",
"name": "name",
"hasOnline": "true",
},
},
Event types
Event | Description |
---|---|
TextMessage | Text message from the agent. |
FileMessage | Attached file from the agent. |
Closed | Message closed by the agent. |
SelectDestination | Select routing destination. |
Request parameters
Parameter | Type | Mandatory | Description |
---|---|---|---|
id | string | Yes | Unique string identifier of the message. |
userId | string | Yes | Client ID assigned on Tovie Platform. |
type | string | Yes | Event type. |
employee | |||
employeeId | string | Yes | Agent ID. |
firstName | string | Yes | Agent first name. |
lastName | string | Yes | Agent last name. |
avatarUrl | string | Yes | Link to the avatar of the agent. |
TextMessage | |||
text | string | Yes | Text message sent by the agent. |
FileMessage | |||
url | string | Yes | File download link. |
name | string | Yes | Name of the file to be downloaded. |
size | integer | Yes | File size in bytes. |
comment | string | Yes | Comment to the file being sent. |
SelectDestination | |||
destinationId | string | Yes | Agent group ID. |
name | string | Yes | Agent group name. |
hasOnline | boolean | Yes | Agent group availability for event routing. |