Send a message as an agent

Authentication

api-keystring

The API key should be passed in the request headers as api-key for authentication.

Request

This endpoint expects an object.
textanyRequired
message text
visitorIdanyRequired

visitor’s ID received from a webhook or generated by you to bind existing user account to Conversations

agentEmailanyOptional

agent email. When sending messages from a standalone system, it’s hard to maintain a 1-to-1 relationship between the users of both systems. In this case, an agent can be specified by their email address.

agentIdanyOptional

agent ID. It can be found on agent’s page or received from a webhook. Alternatively, you can use agentEmail + agentName + receivedFrom instead (all 3 fields required).

agentNameanyOptional
agent name
receivedFromanyOptional
mark your messages to distinguish messages created by you from the others.

Response

Newly created message is returned as a response
agentIdstring

ID of the agent on whose behalf the message was sent (only in messages sent by an agent).

agentNamestring

Agent’s name as displayed to the visitor. Only in the messages sent by an agent.

agentUserpicstring
Only set if the agent has uploaded a profile picture.
attachmentslist of objects
An array of file attachments.
bcclist of objects

An array containing details of the blind carbon copy (BCC) recipients (applicable only to messages in email threads).

cclist of objects

An array containing details of the carbon copy (CC) recipients (applicable only to messages in email threads).

createdAtlong>=0
Timestamp in milliseconds.
fileobject
forwardedToSourceStatusobject
Status of the message forwarding to the source.
fromobject

An object containing details about the email sender (applicable only to messages in email threads).

htmlstring
The HTML content of the message.
idstring
Message ID. It can be used for further manipulations with the message.
integrationsobject
Integration details.
isBotboolean

true for automated messages generated by an AI bot.

isMissedboolean

true for missed and offline messages.

isMissedByVisitorboolean

true for unread agent’s messages in finished chats.

isPushedboolean

true for pushed messages

isTriggerboolean

true for automatic messages from “Targeted chats & triggers” and API (https://developers.brevo.com/docs/javascript-api-reference#sendautomessage)

rawUnsafeHtmlstring

Unescaped HTML content of the message (may include unsafe HTML).

receivedFromstring

In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop.

replyToobject

An object containing details of the reply-to email address (applicable only to messages in email threads).

sourceMessageIdstring
The ID of the message assigned by the integration source.
subjectstring

The subject line of the email message (only for messages sent to email threads).

textstring
Message text or name of the attached file
tolist of objects

An array containing details of the recipients (applicable only to messages in email threads).

typeenum

"agent" for agents’ messages, "visitor" for visitors’ messages.

Allowed values:
visitorIdstring

visitor’s ID

Errors

400
Bad Request Error