Breadcrumbs

Conversation Message Object

This is the JSON structure of the Conversation object returned in the GetMessages API. The object attributes are described below.


Attribute

Description

messageId

Unique ID of a message generated by the system for each new message.

conversationId

Unique ID for individual chat sessions. 

to

This is the list of the chat participants this message should be delivered. If empty, the message is expected to be delivered to all chat participants. 


JavaScript
 {
            "id": "K1OywrAxN3EYG9Nc9N-f5",
            "name": "Rizwan",
            "type": "Customer"
 }




type

Possible values: 

  • Customer

  • Bot

  • Agent

  • Supervisor

It is an array, it can have multiple participants.

from

This attribute contains the sender information.

JavaScript
{
            "id": "K1OywrAxN3EYG9Nc9N-f5",
            "name": "Rizwan",
            "firstName": "Rizwan",
            "lastName": "",
            "alias": "undefined",
            "type": "Customer"
        }




id

The length of the Id goes up to 21 characters.

alias

Alias is always undefined for the customer and bot. For agent and supervisor, the value is set based on the AGENT_ALIAS configuration.

type

Possible values: 

  • Customer

  • Bot

  • Agent

  • Supervisor


messageType

Possible values are:

  • ChatMessage - A regular conversation/message between the customer and agent.

  • ActivityMessage - An activity message is a triggered customer message, such as a pop-up box, emails or push notifications. 

  • BotMessage - When the DIRECT_HANDOFF is false, the message is sent and received by the bot.

  • ContactMessage - A ContactMessage as explained in Rich Media Messages.

  • LocationMessage - As explained in Rich Media Messages.

timestamp

Timestamp of the message at which message is received in the chat server. The format for the timestamp is UTC.

tag

It is an optional attribute.

Possible values are:

  • Default - By default, the chat is routed to the agent directly.

  • Whisper - When the supervisor can barge in and write whisper messages to instruct the agent.

  • Bot_Only - When the message is sent and received by the bot only, and not to the agent.

refId

It is the mandatory parameter, reference id of the customer,
In the case of web-chat, it is normally a phone number, for other channels, it can be different such as Facebook Id, viberId, phone number for SMS

processByBot

Once the bot joins the conversations, all the customer messages with processByBot=false are sent to the bot so the bot can return suggestions for the customer messages. This is important if the bot joins the conversation late or the chat-server is restarted For the transcript it has 0 value. This is a boolean value, for customer message it is set as false, once the bot processes the message and returns the response its value is set to true. For all other messages, its value is always true.

language

It is an optional attribute, contains the language code of the customer browser.

channel

It is a mandatory attribute, contains channel label, possible values are web | SMS | WhatsApp | Viber | facebook

createdAt

Timestamp at which message was stored in the database.

updatedAt

Timestamp at which message was updated in the database.

text

Text of the message,  only used for message type ChatMessage

input

This attribute contains text that consists of bot suggestions for the customer message.

attachments

It is an optional attribute.
It contains an array of attachments, although a single attachment is supported at the moment.

activityType

It is related to messageType ActivityMessage.
Possible values are participantJoined | participantAdded | participantLeft | handoff | noAgentAvailable

intents

List of intents identified by the bot for a customer message, by default it is an empty array

output

List of possible responses identified by the bot for a customer message, by default it is an empty array

entities

It is always an empty array, can be used in the future.

botResponseType

It is an optional attribute.

Possible values are simple | structured.

Simple

 In the simple bot response type, a bot is able to respond with a simple chat message.                                                                      

Structured

In the structured message, the bot is able to respond with enhanced functionalities. Further structured messages are explained here in 

Rich Media Messages

.


structuredData

It is an optional attribute.
When botResponseType is structured, then structured message contains structuredData sent by bots, such as buttons and carousal object. Further structured data is explained here in Rich Media Messages.

location

This attribute is only available in location messages, it contains the location.

contact

It is only available for ContactMessage, it contains a phone number and name attribute.


If optional attributes (limit, offset) are not passed along with the request, the response will be in ascending order, otherwise, if optional params are passed, the response will be in descending order i.e latest message first and the previous message order by timestamp attribute.

Values in from and text attributes are utf-8 encoded