Use this endpoint when you already have a conversation ID. To contact a customer through a channel identity instead, use Send to a customer.
Before you send
- Get a Bearer access token.
- Find the conversation ID, for example from a webhook event or Get conversation details.
- Use a test conversation while developing. Each successful request sends a real message.
Request body
The body is an event. The message goes in data.message.
| Field | Type | Description |
|---|---|---|
cid (path) |
string | Conversation to send to. |
type |
string | Optional. Defaults to message_sent. |
data.message.format |
string | plaintext or block. See Message formats. |
data.message.text |
string | Message text for plaintext. |
data.message.block |
object | Block tree for block messages. |
data.message.attachments |
array | Optional files, buttons, or cards. See Attachments. |
A plain-text message:
{
"type": "message_sent",
"data": {
"message": {
"format": "plaintext",
"text": "Hello! How can we help?"
}
}
}
Fields Subiz sets
You do not need to send these fields. Subiz sets them for every request:
created: the current time, in Unix milliseconds.account_id: the account of your access token.data.message.conversation_idanddata.conversation.id: thecidfrom the URL. Values in the body are replaced.
Response
A successful request returns HTTP 200 with the sent event as JSON, without an extra wrapper. Selected fields:
{
"id": "event_example",
"account_id": "account_example",
"type": "message_sent",
"created": 1763107200000,
"data": {
"message": {
"conversation_id": "conversation_example",
"format": "plaintext",
"text": "Hello! How can we help?"
}
}
}
Empty fields are omitted. Store the event id if you need to match the message later in message history or webhook events.
A 200 response means Subiz accepted the message. It does not confirm delivery to an external channel such as Facebook or Zalo.
Limits
- Message sends made with an agent’s token count toward that agent’s allowance: 5 per second, 60 per minute, and 5,000 per UTC day. See Message sending limits.
- Text, attachment, and field sizes are limited. See Message limits.
Errors and retries
Check the HTTP status before reading the body. Requests can fail because of invalid JSON, authentication, a blocked sender, rate limits (429), or validation in the conversation service. See Errors.
Do not retry blindly after a timeout. The message may already have been sent, and this endpoint has no idempotency key. Check message history first.
HTTP request
Replace YOUR_CID with the conversation ID and YOUR_ACCESS_TOKEN with your token.
POST https://api.subiz.com.vn/4.1/conversations/YOUR_CID/messages
Authorization: Bearer YOUR_ACCESS_TOKEN
Content-Type: application/json
{
"type": "message_sent",
"data": {
"message": {
"text": "Hello! How can we help?",
"format": "plaintext"
}
}
}