---
title: "Send message"
method: POST
path: "/api/chats/{chat_id}/messages"
tags: ["Direct Messages"]
---

# Send message

`POST /api/chats/{chat_id}/messages`

## Request

- Base URL: `https://api.postproxy.dev`
- URL: `https://api.postproxy.dev/api/chats/{chat_id}/messages`
- Auth: HTTP bearer

Creates an outbound message and queues it for delivery. The message is created immediately with status pending and published asynchronously; each send accepts either text or a single attachment, never both.

## Query parameters

- `profile_group_id` string

## Headers

- `Idempotency-Key` string

## Request body

- DmMessageSendRequest: Payload for sending an outbound message. Each send accepts either text (body) or a single attachment (media), never both. On WhatsApp exactly one payload per send: one of body, media, template, interactive, location or contacts. Carousels are sent with elements instead of body/buttons/card.
  - `body` string: Message text. Required when media and elements are empty; not allowed with elements. Capped at 220 characters when buttons are present.
  - `media` unknown[]: A single media attachment. Accepts the same shapes as the Posts API — a multipart upload, a public URL, a base64 data URI, or a base64 hash. Currently one attachment per send (Meta Send API limit); passing more returns 422. Not supported on Bluesky (422).
    - unknown
  - `tag` 'HUMAN_AGENT': Message tag for sending outside the 24-hour window. Facebook and Instagram only — ignored on Telegram. Extends the reply window to 7 days from the participant's last inbound message; for a human resolving the participant's own inquiry only, never promotional content. Rejected on WhatsApp, which has no HUMAN_AGENT tag — use a template or category "utility" instead.
  - `reply_to_external_id` string: Telegram, WhatsApp and Instagram. Platform message ID (the message's external_id) to reply to — Telegram message_id, WhatsApp wamid, Instagram mid. On WhatsApp and Instagram the send quotes that message. On Instagram the target can be inbound or outbound; if Instagram rejects it (deleted, too old, or not in this chat) the send fails with message.failed instead of going out without the quote. Rejected with 422 on Facebook and Bluesky.
  - `reply_markup` object: Telegram only. Inline keyboard (inline_keyboard), custom reply keyboard (keyboard, with one_time_keyboard / resize_keyboard), force_reply, or remove-keyboard payload — passed through to Telegram unchanged.
  - `quick_replies` DmQuickReply[]: Facebook and Instagram only. Up to 13 tappable chips shown above the participant's composer. On Instagram, delivered only on a plain-text message (not combinable with media or buttons).
    - `title` string, required: Required, 20 characters or fewer
    - `payload` string, required: Required, 1000 characters or fewer
    - `content_type` 'text': Optional; only "text" is accepted — Messenger's user_phone_number / user_email chips are not supported
  - `buttons` DmButton[]: Facebook and Instagram only. Up to 3 buttons attached to the message. Requires body (capped at 220 characters); cannot be combined with media.
    - `type` 'web_url' | 'postback', required
    - `title` string, required: Required, 20 characters or fewer
    - `payload` string: Required for postback buttons, 1000 characters or fewer
    - `url` string: Required for web_url buttons, must be an https:// URL
  - `card` DmCard: Extra fields for the card carrying buttons — renders a richer, product-style card. Requires buttons.
    - `subtitle` string: Capped at 220 characters
    - `image_url` string: Must be an https:// URL
    - `default_action` object: Action when the card itself is tapped
      - `type` 'web_url'
      - `url` string: Must be an https:// URL
  - `elements` DmCarouselElement[]: Facebook and Instagram only. 1-10 cards delivered as a swipeable carousel (Meta's generic template with several elements). Stands in for body, buttons and card: it cannot be combined with any of them or with media. On Instagram it cannot be combined with quick_replies.
    - `title` string, required
    - `subtitle` string
    - `image_url` string: Must be an https:// URL
    - `default_action` object: Action when the card itself is tapped
      - `type` 'web_url'
      - `url` string: Must be an https:// URL
    - `buttons` DmButton[]: Up to 3 buttons, same shape as DmButton
      - `type` 'web_url' | 'postback', required
      - `title` string, required: Required, 20 characters or fewer
      - `payload` string: Required for postback buttons, 1000 characters or fewer
      - `url` string: Required for web_url buttons, must be an https:// URL
  - `template` WhatsAppTemplateSend: WhatsApp only. Sends an approved message template instead of body. Works inside or outside the 24-hour window and re-opens it.
    - `id` string: Template hashid or Meta id. Either id or name is required.
    - `name` string: Template name. Add language when the name exists in several languages, otherwise 409.
    - `language` string: Meta language code, e.g. en_US.
    - `variables` string[]: Values as strings, in order: header text variables, then body variables, then one value per dynamic URL button. For POSITIONAL templates the count must equal the template’s variable_count.
    - `button_params` object[]: Overrides for buttons needing runtime parameters — each { index, sub_type, parameters } in Meta’s shape. sub_type is url, copy_code, flow, quick_reply or voice_call.
    - `header_media` object: { "link": "https://…" } or { "id": "<meta media id>" } for templates with an IMAGE, VIDEO or DOCUMENT header.
    - `header_location` WhatsAppLocation: A WhatsApp location message.
      - `latitude` number, required
      - `longitude` number, required
      - `name` string
      - `address` string
  - `interactive` object: WhatsApp only. Meta’s interactive object unchanged — reply buttons (type "button"), lists ("list"), call-to-action URLs ("cta_url"), catalog products ("product" / "product_list") or Flows ("flow"). Session message: needs an open messaging window and cannot be sent to a group.
  - `location` WhatsAppLocation: A WhatsApp location message.
    - `latitude` number, required
    - `longitude` number, required
    - `name` string
    - `address` string
  - `contacts` object[]: WhatsApp only. Array of Meta contact objects (name, phones, emails, …).
  - `category` 'utility': WhatsApp only. "utility" sends a plain text outside the 24-hour window via Meta’s Direct Send, where the account is eligible. Valid only alongside body; with any other payload returns 422.
  - `link_preview` boolean: WhatsApp only. Render a preview for a link in body.
  - `voice_note` boolean: WhatsApp only. Send an audio attachment as a voice note.
  - `filename` string: WhatsApp only. Filename shown for a document attachment.

## Response `202`

Accepted. The message is created with status pending; once published the status updates to published and external_id is populated. On failure it becomes failed_waiting_for_retry (retried with backoff) or failed.

- DmMessage: A direct message (inbound or outbound) in a chat.
  - `id` string: Message hashid
  - `chat_id` string: Chat hashid
  - `external_id` string, nullable: Platform-native message ID (null while pending)
  - `direction` 'inbound' | 'outbound'
  - `body` string, nullable: Message text
  - `status` 'pending' | 'published' | 'failed_waiting_for_retry' | 'failed' | 'received': pending/published/failed_waiting_for_retry/failed for outbound, received for inbound
  - `external_comment_id` string, nullable: Set when the message was sent as a private reply to a comment
  - `error_message` string, nullable: Last error from the platform (when failed)
  - `error_details` PlatformErrorDetails, nullable: Structured platform error (omitted when no platform error info is available).
    - `platform_error_code` string, nullable: Error code returned by the platform API
    - `platform_error_subcode` string, nullable: Error subcode returned by the platform API
    - `platform_error_message` string, nullable: Error message returned by the platform API
    - `postproxy_note` string, nullable: Additional context from Postproxy about the error
  - `platform_data` object, nullable: Raw platform webhook payload, passed through unchanged. Shape is platform- and event-specific and may change without notice — prefer the typed fields where available.
  - `story_reply` object, nullable: Instagram only. Set on inbound messages that reply to one of your stories. The url is a short-lived Meta link tied to the story's lifetime (typically 24h or less) — not mirrored to Postproxy storage.
    - `id` string: Story asset id
    - `url` string: Meta lookaside CDN URL
  - `external_posted_at` string, nullable: ISO 8601 timestamp from the platform
  - `external_delivered_at` string, nullable: When the platform confirmed delivery (outbound; FB & IG only)
  - `external_read_at` string, nullable: When the recipient read the message (outbound; FB & IG only)
  - `external_edited_at` string, nullable: ISO 8601 timestamp of the most recent edit; body reflects the latest edit
  - `reply_to_external_id` string, nullable: Platform message ID this message replies to (inbound replies, outbound reply_to_external_id, or a Telegram callback query's source)
  - `reply_markup` object, nullable: Telegram only — the reply_markup attached to the message
  - `quick_replies` DmQuickReply[], nullable: Facebook and Instagram only — the chips sent with the message
    - `title` string, required: Required, 20 characters or fewer
    - `payload` string, required: Required, 1000 characters or fewer
    - `content_type` 'text': Optional; only "text" is accepted — Messenger's user_phone_number / user_email chips are not supported
  - `buttons` DmButton[], nullable: Facebook and Instagram only — the buttons attached to the message
    - `type` 'web_url' | 'postback', required
    - `title` string, required: Required, 20 characters or fewer
    - `payload` string: Required for postback buttons, 1000 characters or fewer
    - `url` string: Required for web_url buttons, must be an https:// URL
  - `card` object, nullable: Facebook and Instagram only — the card fields (subtitle, image_url, default_action) sent alongside buttons
  - `elements` DmCarouselElement[], nullable: Facebook and Instagram only - the normalized carousel cards sent with elements
    - `title` string, required
    - `subtitle` string
    - `image_url` string: Must be an https:// URL
    - `default_action` object: Action when the card itself is tapped
      - `type` 'web_url'
      - `url` string: Must be an https:// URL
    - `buttons` DmButton[]: Up to 3 buttons, same shape as DmButton
      - `type` 'web_url' | 'postback', required
      - `title` string, required: Required, 20 characters or fewer
      - `payload` string: Required for postback buttons, 1000 characters or fewer
      - `url` string: Required for web_url buttons, must be an https:// URL
  - `tapped_action` DmTappedAction, nullable: Set on inbound messages created by a tap of a quick reply, button postback, ice breaker, or Telegram inline-keyboard button. A tap also opens the 24-hour messaging window.
    - `kind` 'quick_reply' | 'postback' | 'callback_query': quick_reply, postback (Meta buttons and ice breakers), or callback_query (Telegram inline keyboards)
    - `payload` string
    - `title` string
  - `external_deleted_at` string, nullable: When the message was deleted/unsent on the platform (treat as redacted)
  - `reactions` DmReaction[]: Reactions on the message. Reflects the live state.
    - `sender_external_id` string
    - `emoji` string
    - `reaction` string
    - `at` string
  - `attachments` DmMessageAttachment[]: Media attached to the message
    - `id` string: Attachment hashid
    - `type` 'image' | 'video' | 'audio' | 'sticker' | 'file' | 'story_mention'
    - `url` string, nullable: Stable storage URL. While status is pending this may temporarily fall back to the source URL.
    - `status` 'pending' | 'processed' | 'failed'
    - `external_id` string, nullable: Platform-side identifier (e.g. a Messenger sticker ID), when provided
  - `is_unsupported` boolean: true when the platform marked the message as unsupported (e.g. an unprocessable voice clip)
  - `created_at` string: ISO 8601 timestamp of record creation
  - `template` object, nullable: WhatsApp only. The template a message was sent with — id, external_id, name, language, variables.
  - `interactive` object, nullable: WhatsApp only. Outbound: the interactive object sent. Inbound: the customer’s reply to one — type "button_reply" / "list_reply" / "nfm_reply" with the id and title you assigned.
  - `location` object, nullable: WhatsApp only. latitude, longitude, name, address — sent or received.
  - `source` string, nullable: "synced" on an outbound WhatsApp message the team sent from the phone on a coexistence number.

## Other responses

- `400`: Missing required parameters.
- `401`: Invalid, missing, or insufficient API key permissions.
- `404`: Resource does not exist or is not accessible.
- `422`: Validation failed.

---

[API](https://skmtc.dev/postproxy/apis/postproxy-social-media-api.md) - [All operations](https://skmtc.dev/postproxy/apis/postproxy-social-media-api/llms.txt) - [OpenAPI document](https://skmtc.dev/postproxy/apis/postproxy-social-media-api/revisions/d54482ac4ce7?raw)
