Skip to main content

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

EventDescription
TextMessageText message from the agent.
FileMessageAttached file from the agent.
ClosedMessage closed by the agent.
SelectDestinationSelect routing destination.

Request parameters

ParameterTypeMandatoryDescription
idstringYesUnique string identifier of the message.
userIdstringYesClient ID assigned on Tovie Platform.
typestringYesEvent type.
employee
employeeIdstringYesAgent ID.
firstNamestringYesAgent first name.
lastNamestringYesAgent last name.
avatarUrlstringYesLink to the avatar of the agent.
TextMessage
textstringYesText message sent by the agent.
FileMessage
urlstringYesFile download link.
namestringYesName of the file to be downloaded.
sizeintegerYesFile size in bytes.
commentstringYesComment to the file being sent.
SelectDestination
destinationIdstringYesAgent group ID.
namestringYesAgent group name.
hasOnlinebooleanYesAgent group availability for event routing.