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 or null

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

agentNamestring or null

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

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

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

cclist of objects or null

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

createdAtlong or null
Timestamp in milliseconds.
fileobject or null
forwardedToSourceStatusobject or null
Status of the message forwarding to the source.
fromobject or null

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

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

true for automated messages generated by an AI bot.

isMissedboolean or null

true for missed and offline messages.

isMissedByVisitorboolean or null

true for unread agent’s messages in finished chats.

isPushedboolean or null

true for pushed messages

isTriggerboolean or null

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

rawUnsafeHtmlstring or null

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

receivedFromstring or null

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 or null

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

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

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

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

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

typeenum or null

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

Allowed values:
visitorIdstring or null

visitor’s ID

Errors