Skip to main content

Sending and receiving messages

The message exchange follows a specific flow with various events that can be triggered by both the client and server. Here's a breakdown of all possible events in a conversation, their direction, and their payloads:

Client to server events

Client sends message (message:send)

This is the primary event for sending messages from the client to the server. Messages can include text, media attachments, or both.

FieldTypeRequiredDescription
input.textstringNoThe text content of the message
input.attachmentsarrayNoArray of media attachments
session_idstringYesUnique identifier for the conversation session
timestampintegerYesUnix timestamp in milliseconds
warning

The input object is optional, but sending an empty message to the AI Agent

will not trigger any response. This results in an empty output.responses array.

Attachment fields

FieldTypeRequiredDescription
typestringYesType of attachment: "audio", "image", "video", "file"
mime_typestringYesMIME type of the attachment
idstringNoUnique identifier for the attachment
urlstringNoURL where the attachment can be accessed
titlestringNoDisplay title for the attachment
filenamestringNoOriginal filename of the attachment
important

The attachment url must be the upload_url received from the upload process

. Other URLs are not supported.

{
"input": {
"text": "Hello, I need help with my order",
"attachments": [
{
"type": "image",
"mime_type": "image/jpeg",
"url": "<presigned-url>",
"title": "Order Screenshot"
}
]
},
"session_id": "70e33a98-b55f-4500-bb62-f29cc7049356",
"timestamp": 1744036886028
}

Client sends typing indicator (message:compose)

Indicates that the user has started or stopped typing.

FieldTypeRequiredDescription
session_idstringYesUnique identifier for the conversation session
timestampintegerYesUnix timestamp in milliseconds
actionstringYesTyping action: "start" or "stop"
{
"session_id": "70e33a98-b55f-4500-bb62-f29cc7049356",
"timestamp": 1744036886028,
"action": "start" // or "stop"
}

Client marks message as read (message:read)

Indicates that the user has viewed a message.

FieldTypeRequiredDescription
session_idstringYesUnique identifier for the conversation session
timestampintegerYesUnix timestamp in milliseconds
{
"session_id": "70e33a98-b55f-4500-bb62-f29cc7049356",
"timestamp": 1744036886030
}

Client confirms message delivery (message:delivered)

Indicates that a message has been delivered to the user.

FieldTypeRequiredDescription
session_idstringYesUnique identifier for the conversation session
timestampintegerYesUnix timestamp in milliseconds
{
"session_id": "70e33a98-b55f-4500-bb62-f29cc7049356",
"timestamp": 1744036886029
}

Server to client events

Server sends message (message:received or message:brain_received)

Messages can be received from either an AI Agent or a Human Agent, each with a different event type and payload structure.

  • For AI Agent responses (message:brain_received):

    FieldTypeRequiredDescription
    session_idstringYesUnique identifier for the conversation session
    output.responsesarrayYesArray of response objects
    timestampintegerYesUnix timestamp in milliseconds
    brain_languagestringYesLanguage code of the AI response
    request_idstringYesUnique identifier for the request
  • For Human Agent responses (message:received):

    FieldTypeRequiredDescription
    session_idstringYesUnique identifier for the conversation session
    from.agent_idstringYesID of the human agent
    from.team_idstringNoID of the agent's team
    from.agent_namestringNoDisplay name of the agent
    from.agent_avatarstringNoURL to the agent's avatar image
    to.user_idstringYesID of the user receiving the message
    body.textstringNoText content of the message
    body.attachmentsarrayNoArray of media attachments
    timestampintegerNoUnix timestamp in milliseconds

Server sends typing indicator (message:compose)

Indicates when an agent (human or AI) starts or stops typing.

// Human Agent sending typing indicator
{
"session_id": "70e33a98-b55f-4500-bb62-f29cc7049356",
"author_id": "b4c22e23-4b82-45e0-9a12-1c2572ba52c9",
"desk_id": "0f05b1b1-5b82-45e2-a477-6443dd2b9d79",
"author_name": "John Doe",
"timestamp": 1744036886028,
"author_type": "agent",
"action": "start" // or "stop"
}

// AI Agent sending typing indicator
{
"session_id": "77ce27e2-676a-4536-a7d1-0deec8499ade",
"author_id": "d6197ecf-5a8d-405d-94e5-65e9ab747850",
"timestamp": 1744037057045,
"author_type": "brain",
"action": "start" // or "stop"
}

Server confirms message delivery (message:delivered)

Indicates that a message has reached its destination.

FieldTypeRequiredDescription
session_idstringYesUnique identifier for the conversation session
author_typestringYesType of author: "brain", "agent", or "visitor"
timestampintegerYesUnix timestamp in milliseconds
{
"session_id": "70e33a98-b55f-4500-bb62-f29cc7049356",
"author_type": "visitor",
"timestamp": 1744036886029
}

AI Agent response types

When the AI Agent responds with a synthetic response using its knowledge

, it can only be of the text type. Other response types are available when the AI Agent returns a dialog response.

Text response

Used to send text messages, possibly with quick reply options.

FieldTypeRequiredDescription
typestringYesMust be "text"
textsarrayYesArray of text messages to send
optionsarrayNoArray of quick reply options

Option fields:

FieldTypeRequiredDescription
textstringYesThe text sent back when the option is selected
labelstringYesDisplay label for the option
{
"type": "text",
"texts": ["Hello! How can I assist you today?"],
"options": [
{
"text": "I need help",
"label": "Help"
},
{
"text": "Just browsing",
"label": "Browse"
}
]
}

Media response

Used to send media files such as images, videos, audio, or files.

FieldTypeRequiredDescription
typestringYesOne of "image", "video", "audio", "file"
urlstringYesURL where the media can be accessed
namestringNoDisplay name for the media
sizenumberNoSize of the file in bytes
action_idstringYesUnique identifier for tracking interactions
{
"type": "image",
"url": "https://example.com/image.jpg",
"name": "Sample Image",
"size": 102400,
"action_id": "image_123"
}

Used to send a carousel of cards, each with media, title, subtitle, and buttons.

FieldTypeRequiredDescription
typestringYesMust be "carousel"
cardsarrayYesArray of card objects
action_idstringYesUnique identifier for tracking interactions

Card fields:

FieldTypeRequiredDescription
titlestringYesTitle of the card
subtitlestringNoSubtitle or description
mediaobjectNoMedia object with type and URL
buttonsarrayNoArray of button objects
default_actionobjectNoDefault action when card is clicked

Button types:

  • Postback button:

    {
    "type": "postback",
    "label": "string",
    "value": "string"
    }
  • URL button:

    {
    "type": "url",
    "label": "string",
    "url": "string"
    }
  • Webview button:

    {
    "type": "webview",
    "label": "string",
    "url": "string",
    "height": "string",
    "trigger_node_id": "string"
    }
{
"type": "carousel",
"cards": [
{
"media": {
"url": "https://example.com/product1.jpg",
"type": "image"
},
"title": "Product 1",
"subtitle": "Description of product 1",
"buttons": [
{
"type": "postback",
"label": "Buy Now",
"value": "buy_product_1"
},
{
"type": "url",
"label": "Learn More",
"url": "https://example.com/product1"
}
],
"default_action": {
"type": "url",
"url": "https://example.com/product1"
}
}
],
"action_id": "123e4567-e89b-12d3-a456-426614174000"
}

Webview response

Used to display a webview within the chat interface.

FieldTypeRequiredDescription
typestringYesMust be "webview"
namestringYesDisplay name for the webview
labelstringYesButton label to open the webview
urlstringYesURL to load in the webview
heightstringNoHeight of the webview ("tall", "compact", "full")
trigger_node_idstringNoID of the node to trigger when opened
action_idstringYesUnique identifier for tracking interactions
{
"type": "webview",
"name": "Survey",
"label": "Visit our website",
"url": "https://example.com/",
"height": "full",
"trigger_node_id": "123e4567-e89b-12d3-a456-426614174000",
"action_id": "webview_123"
}

Survey response

Used to send a survey to the user.

FieldTypeRequiredDescription
typestringYesMust be "survey"
urlstringYesURL of the survey form
namestringYesDisplay name for the survey
labelstringYesButton label to open the survey
heightstringNoHeight of the survey form ("tall", "compact", "full")
trigger_node_idstringNoID of the node to trigger when opened
action_idstringYesUnique identifier for tracking interactions
{
"type": "survey",
"url": "https://webhooks.moveo.ai/common/survey?channel=web&integration_id=c3725769-d20e-4391-9f15-63f47eefe211&lang=en&session_id=8f4e66a4-c95b-4287-b1c0-bbb9a7bcc5b7&user_id=UouxR137cqf_YaRQvRKgI",
"name": "Survey",
"label": "Fill survey",
"height": "tall",
"trigger_node_id": "123e4567-e89b-12d3-a456-426614174000",
"action_id": "1c46cb13-ebb7-4aed-ade7-9cb09a75cf1b"
}