Skip to content
Chatwise
Skip to Content
Developer docs

Reply in a conversation

POST /v1/conversations/{conversationId}/messages. Sends a reply in a WhatsApp, Instagram or Messenger conversation, from the account the conversation is on: a text or a file.

View as Markdown

POSThttps://api.chatwise.so/v1/conversations/{conversationId}/messages

Sends a reply in a WhatsApp, Instagram or Messenger conversation, from the account the conversation is on: a text or a file. A request sends one message. If the conversation's WhatsApp number was disconnected, or it has none, and the workspace has exactly one connected, the reply leaves from that one. The answer means the channel accepted the message, not that it was delivered.

For a file, give the https address it can be downloaded from, on the usual port and without a redirect or a sign-in. Chatwise downloads it, up to 100 MB, and prepares it for the channel:

  • Images are JPEG, PNG, WebP, GIF, TIFF or AVIF, and are sent as JPEG or PNG. They can have 50 megapixels as JPEG (24 if progressive), 40 as PNG, 5 as AVIF and 16 otherwise, and are made smaller to fit 5 MB on WhatsApp and 8 MB on Instagram and Messenger. HEIC isn't taken, and an animation is sent as a still.
  • Videos can have pictures of up to 4096 × 2304, and are made smaller to fit 16 MB on WhatsApp and 25 MB on Instagram and Messenger. Converting one has 4 minutes, which is enough for about a minute of 1080p, or a quarter of one of 4K. An MP4 with H.264 (Main or Baseline profile, without B-frames) and AAC that fits is only copied, so it can be longer.
  • Audio is made smaller to fit 16 MB on WhatsApp and 25 MB on Instagram and Messenger, which is enough for about an hour.
  • Documents are sent as they are: on WhatsApp and Messenger PDF, Word, Excel, PowerPoint and plain text files, up to 100 MB and 25 MB, and on Instagram PDFs up to 25 MB. A CSV file is taken only if its server calls it plain text.

The request waits up to 25 seconds for its file. After that it answers MEDIA_PROCESSING, the file is prepared meanwhile, and nothing is sent until you repeat the request. A prepared file that isn't sent is kept for 7 days. A file that couldn't be downloaded or prepared is tried again when you repeat the request after a minute; what the channel doesn't take isn't. A key can send 200 files an hour, and a workspace can have a few in preparation at a time.

The channels allow replies for 24 hours after the customer's latest message. After that, send a WhatsApp template; on Instagram and Messenger, wait until the customer writes again.

Use a new Idempotency-Key for each message, and the same one, with the same body, when you repeat a request. For 30 days after the first request a repeat doesn't send the message again: it answers 200 with the first message, SEND_IN_PROGRESS while that is being sent and for up to 5 minutes if it was interrupted, or SEND_OUTCOME_UNKNOWN if it isn't clear whether it was sent. A repeat that gets 401, 403, 404 or 429 says nothing about the first request, and neither does any error while that one is still preparing its file. When Messenger refuses a video, the repeats of the next minute are told so and send nothing, also when the request had answered SEND_IN_PROGRESS by then. A later one tries it again. Only what the channel or Chatwise definitely refused is tried again. After a timeout, a dropped connection or a 5xx, repeat the request with the same key rather than a new one.

An Idempotency-Key belongs to the API key it was used with: with another API key, the same request sends another message.

The reply is sent for the person who created the API key, who must be an admin or owner of the workspace when it is sent. It doesn't mark the conversation read, or assign, resolve or reopen it.

Besides the limit on requests, by default a key can send 60 replies a minute, a workspace 180, and a conversation can get 10 a minute and 60 an hour. The last three count what AI clients send through MCP too, and not what people send in the dashboard. A reply the channel refuses counts. A repeat that isn't sent doesn't, unless it comes at the same moment as the first request.

The API key needs the messages:reply scope. See authentication and scopes.

Example

curl -X POST 'https://api.chatwise.so/v1/conversations/1234/messages' \
  -H "Authorization: Bearer $CHATWISE_API_KEY" \
  -H 'Idempotency-Key: reply-5678-1' \
  -H 'Content-Type: application/json' \
  -d '{
  "text": "Yes, it is available in blue."
}'

Path parameters

NameTypeDescription
conversationIdstringRequired. The conversation's id.

Headers

NameTypeDescription
Idempotency-KeystringRequired. A key you choose for this message: 8 to 128 letters, digits, dots, underscores, hyphens or colons.

Body

JSON. Unknown fields are refused with a 400.

FieldTypeDescription
textstringThe message. At most 4,096 characters on WhatsApp, 2,000 on Messenger, and 1,000 bytes of UTF-8 on Instagram. Send either this or media. Can't be blank, or contain NUL characters or unpaired surrogates.
mediaobjectA file to send instead of a text.
media.urlstringRequired. The https address of the file, which must answer without a redirect or a sign-in. At most 2048 characters.
media.fileNamestringThe name a document is shown with on WhatsApp, up to 120 characters. On Messenger the customer sees the letters A to Z and the digits of it, with some of Chatwise's own after them. Its ending is the document's own. Without it, the one the file's server gives. Word, Excel and PowerPoint files from before 2007 look the same inside, so their name, or the type their server gives, has to say which they are. Can't contain NUL characters or unpaired surrogates. At most 255 characters.
media.captionstringA text shown with the file: on WhatsApp, for an image, a video or a document. At most 1,024 characters. It is refused elsewhere; send the text as a message of its own there. Can't be blank, or contain NUL characters or unpaired surrogates.

Response

201. The channel accepted the message.

{
  "data": {
    "id": "5680",
    "conversationId": "1234",
    "channel": "WHATSAPP",
    "type": "text",
    "sentAt": "2026-11-12T09:31:02.000Z"
  }
}
FieldTypeDescription
data.idstringThe message's id.
data.conversationIdstringThe conversation's id.
data.channelstringThe conversation's channel. One of WHATSAPP, INSTAGRAM, MESSENGER.
data.typestringWhat kind of message it is, such as text.
data.sentAtstringWhen the channel accepted it. ISO 8601, in UTC.

200. A repeat: this message was already sent.

{
  "data": {
    "id": "5680",
    "conversationId": "1234",
    "channel": "WHATSAPP",
    "type": "text",
    "sentAt": "2026-11-12T09:31:02.000Z"
  }
}

Errors

StatusMessageWhat it means
400Expected property name or '}' in JSON at position 1 (line 1 column 2)The request body isn't valid JSON. The message says where.
400Validation failedA parameter or body field is missing, unknown or malformed. errors lists each one.
400WhatsApp messages are limited to 4096 characters; this text has 4100.The text is longer than the channel allows. The message names the channel and its limit.
400Instagram messages have no caption. Send the text as a message of its own.The file can't have a caption, or it is too long. Nothing was sent.
401A valid Bearer API key is requiredThe Authorization header is missing or isn't Bearer <API key>.
401Invalid or revoked API keyThe key doesn't exist, was revoked, or has expired.
401Invalid API keyChatwise couldn't check the key. Try again.
402ADMIN_SERVICES_BLOCKED: Chatwise services have been paused for this workspace by an administrator. Contact support to restore service.Sending is paused for the workspace. Contact support.
402BILLING_INACTIVE: The workspace's Chatwise subscription needs attention, so messages can't be sent.An admin can renew the subscription in the dashboard.
403API key does not have the required scope: messages:replyThe key lacks the route's scope. Create a key that has it.
403SEND_NOT_PERMITTED: The person who created this API key is no longer an admin or owner of the workspace. An admin can create a new key to send replies.Have an admin create a new key. Don't repeat a reply with it that may have been sent: an Idempotency-Key belongs to its API key.
404Conversation not foundNo conversation with this id in the key's workspace.
409REPLY_WINDOW_CLOSED: The reply window is closed. It is open for 24 hours after the customer's latest message. On WhatsApp, send a template instead.The customer's latest message is more than 24 hours old, or they haven't written yet.
409UNSUPPORTED_ON_CHANNEL: Website Chat conversations can't be replied to through the API.The conversation is on Website Chat.
409CHANNEL_NOT_CONNECTED: The conversation's account isn't connected. Reconnect it in the dashboard.The account the conversation is on was disconnected, or the channel no longer accepts Chatwise's access to it. If the dashboard shows it as connected, Chatwise couldn't read that access just now: repeat the request.
409IDEMPOTENCY_KEY_REUSED: This Idempotency-Key was already used for a different messageUse a new key for a new message.
409SEND_IN_PROGRESS: This message is still being sent. Repeat the request in a moment with the same Idempotency-KeyThe message is still being sent, by this request or an earlier one with this key, or an earlier one was interrupted in the last 5 minutes. Wait as Retry-After says, then repeat it with the same key.
409MEDIA_PROCESSING: The file is still being prepared, and the message hasn't been sent. Repeat the request in a moment with the same Idempotency-KeyThe file takes longer than a request waits. It is sent only when you repeat the request, with the same key and body. Wait as Retry-After says.
413request entity too largeThe request body is larger than 100 KB.
422RECIPIENT_UNAVAILABLE: WhatsApp could not deliver to this customer. Meta said: "Message undeliverable"The channel doesn't deliver to this customer. The same message won't get through later either, unless what the answer names changes.
422SEND_FAILED: WhatsApp rejected the message. Meta said: "Unsupported message type"The channel refused the message. Nothing was sent.
422MEDIA_DOWNLOAD_FAILED: The media host returned HTTP 404; it must return 200 without redirects.The file couldn't be downloaded from its address. The message says why. Nothing was sent. A repeat with the same key tries again once a minute has passed.
422MEDIA_REJECTED: Instagram only accepts PDF files. Convert this DOCX file to PDF, or send it on WhatsApp.The file isn't one the channel takes, is too large, or can't be read. Nothing was sent.
429API key rate limit exceededWait the number of seconds in the Retry-After header.
429RATE_LIMITED: Too many messages. Wait, then repeat the request with the same Idempotency-KeyToo many replies from this key or workspace, or in this conversation, too many files from this key, or the channel limits them. Nothing was sent. Wait as Retry-After says.
500Internal server errorSomething failed in Chatwise, and the message may have been sent. Repeat the request with the same key and body.
502SEND_OUTCOME_UNKNOWN: The message may have been sent. Read the conversation's messages before you send it again with a new Idempotency-Key. On WhatsApp it can be missing there although it was sentThe channel didn't answer or had trouble of its own, Chatwise was interrupted, or it couldn't save a message the channel had accepted. A repeat with the same key sends nothing. On WhatsApp the message can be missing from the conversation although the customer has it.
503MEDIA_BUSY: The file can't be prepared right now. Wait, then repeat the request with the same Idempotency-KeyToo many files are being prepared, for the workspace or at all, or something failed in Chatwise. Nothing was sent. Wait as Retry-After says.

The body of an error is described in errors.

On this page