Pick what to send

One command sends every kind of message. Pick the kind that fits

Every message goes out through one command, POST /v1/commands/message.send. The body has two parts: target says who gets it, and payload says what it is. Set payload.kind to the kind of message.

Request
{
  "target": { "conversationId": "a0000000-0000-4000-8000-000000000001" },
  "payload": { "kind": "text", "text": "Yes, by the window." }
}

Kinds

You wantkindGuide
WordstextText
A photo or filemediaImages and files
Text and photos as one messagemultipartImages and files
A link with a preview cardlinkLinks
A stickerstickerStickers
Ask for a locationlocation_requestLocation
A pollpollPolls
A card from your iMessage appapp_cardApp cards
A place on a maplocationLocation
Contact cardscontactContact cards
Buttons or a list to pick fromchoicesButtons and lists
An approved templatetemplateTemplates

Channel support shows which kinds each channel takes.

Who gets it

Name a conversation, or a person.

  • A conversation: target.conversationId, from a message.received event or List conversations. Mapier sends from the same line, on the same channel.
  • A person: target.recipientExternalId, their address in the channel's own form. A first message to someone new opens a conversation.
ChannelAddressWho writes first
iMessageA phone number with a plus sign and country code, such as +14155550123Your agent, with a plain text. Other kinds go only into a conversation the person has written in, or a group chat, so send a text first and use the conversationId that comes back
WhatsAppA phone number, as on iMessageYour agent, with a template. Within 24 hours of the person's last message, any kind can go

What a line cannot carry

If a payload key the line does not take carries a value, the send is refused with 422 validation_failed naming that key, and nothing is sent. A key set to null or to an empty list is ignored. To let Mapier drop or split what the channel cannot carry instead, such as an effect, send options.degrade: "adapt". The 202 then lists what it changed in adaptations.

After you send

202 Accepted means Mapier accepted the request, not that the message arrived. The command's result says whether it went out: event: command on the stream, command.settled at a webhook. Delivered and read arrive later. Results and delivery explains each one. A retry with the same Idempotency-Key never sends twice; Retries explains.

Next