Message types
One request body for each kind of message you can send.
Every body on this page is sent to POST /v1/messages with a client key and an Idempotency-Key header, as the quickstart shows. A message is exactly one of text, card, carousel, file, or template.
suggestions, card, carousel, and file are accepted where GET /v1/whoami shows richMessages true. Where it is false, a body with one of them returns 422, and text and templates still send.
Every message can also carry class (service by default), a reference of your own that comes back in the answer and in the delivery events, and onQuiet. Contacts, conversations, and messages explains each. A message can also carry an expiry and a traffic type.
Text
The smallest message is to and text. text is up to 2000 characters.
to takes contactId, phoneNumber, or externalId. A phone number must already be a contact, or the request must carry consent, as in a first message to a new number.
{
"to": {
"phoneNumber": "+15555550123"
},
"text": "Your table is ready."
}Suggested replies
Up to 11 suggestions show under a message as buttons. A reply is a button the person taps to answer. Its text is the label, up to 25 characters.
A tap arrives as the reply.received event with kind chip, the label in text, and your postbackData. Left out, postbackData is the label.
Suggestions show only under the newest message in the conversation, so put them on the last message you send.
A tap on a suggestion labeled STOP, START, HELP, or another consent keyword counts as that keyword, because a tap arrives as the label. Do not label a suggestion with one unless you mean it.
postbackData cannot start with wf:, and it cannot be a consent or help keyword unless the label is the same keyword. Either is refused with validation_error.
{
"to": {
"contactId": 42
},
"text": "Your table is ready. Are you on your way?",
"suggestions": [
{
"type": "reply",
"text": "On my way",
"postbackData": "eta_now"
},
{
"type": "reply",
"text": "Need 10 minutes",
"postbackData": "eta_10"
}
],
"reference": "order-8841"
}Suggested actions
An action is a button that does something on the phone. Actions and replies can be mixed in one message.
openUrlopens a link.openIniswebview(the default), which opens the page inside the conversation, orbrowser. The webview takes anhttpsaddress.webviewViewModeisFULL,HALF, orTALL(the default).dialstarts a call tophoneNumber, in E.164.viewLocationshows a place on the map, fromlatitudeandlongitudeor from aquerysuch as an address.labelnames the pin.shareLocationasks the person for their location. What they send arrives asreply.receivedwithlocation.createCalendarEventoffers to add an event, withtitle,startTime, andendTimein RFC 3339, and an optionaldescription. Every action exceptshareLocationtakes afallbackUrl, opened when the phone cannot do the action. Every suggestion takespostbackData.
{
"to": {
"contactId": 42
},
"text": "Your visit is Tuesday, December 1 at 3:00 PM.",
"suggestions": [
{
"type": "openUrl",
"text": "View details",
"url": "https://example.com/visits/8841",
"openIn": "webview",
"webviewViewMode": "TALL"
},
{
"type": "openUrl",
"text": "Open in browser",
"url": "https://example.com/visits/8841",
"openIn": "browser"
},
{
"type": "dial",
"text": "Call us",
"phoneNumber": "+15555550100"
},
{
"type": "viewLocation",
"text": "Directions",
"latitude": 40.7128,
"longitude": -74.006,
"label": "Example Dental"
},
{
"type": "shareLocation",
"text": "Share my location"
},
{
"type": "createCalendarEvent",
"text": "Add to calendar",
"title": "Dental visit",
"startTime": "2026-12-01T20:00:00Z",
"endTime": "2026-12-01T21:00:00Z"
}
]
}Rich card
A card has a title (up to 200 characters), a description (up to 500), media, and up to 4 suggestions of its own. It needs at least one of title, description, or media.
media.url is a public https address of an image, GIF, or video. media.height is SHORT, MEDIUM (the default), or TALL. Add media.thumbnailUrl for a video.
orientation is VERTICAL (the default), with the media above the words, or HORIZONTAL, with the media beside them on the side thumbnailAlignment names. thumbnailAlignment is taken only with HORIZONTAL.
The suggestions inside card are buttons on the card. The suggestions beside card show under the message.
{
"to": {
"contactId": 42
},
"card": {
"title": "Your order is on its way",
"description": "Two items, arriving Tuesday.",
"media": {
"url": "https://example.com/images/order-8841.jpg",
"height": "MEDIUM"
},
"suggestions": [
{
"type": "openUrl",
"text": "Track order",
"url": "https://example.com/orders/8841"
}
]
},
"suggestions": [
{
"type": "reply",
"text": "Thanks",
"postbackData": "thanks"
}
],
"class": "transactional",
"reference": "order-8841"
}Carousel
A carousel is 2 to 10 cards the person swipes through. Each card has the same fields as a rich card, without orientation. cardWidth is SMALL or MEDIUM (the default). A SMALL carousel takes SHORT or MEDIUM media, not TALL.
Give each card's buttons words that name that card, such as Book morning and Book afternoon, never the same words on every card. On iPhone a card's button shows under the card without its title, so repeated words do not say which card a tap is for. A single rich card can keep a general label such as Learn more. Repeated labels are still accepted.
{
"to": {
"contactId": 42
},
"carousel": {
"cardWidth": "MEDIUM",
"cards": [
{
"title": "Morning",
"description": "Tuesday at 9:00 AM",
"media": {
"url": "https://example.com/images/morning.jpg"
},
"suggestions": [
{
"type": "reply",
"text": "Book morning",
"postbackData": "slot_0900"
}
]
},
{
"title": "Afternoon",
"description": "Tuesday at 3:00 PM",
"media": {
"url": "https://example.com/images/afternoon.jpg"
},
"suggestions": [
{
"type": "reply",
"text": "Book afternoon",
"postbackData": "slot_1500"
}
]
}
]
}
}File
A file is an image, video, audio file, or PDF at a public https address. MessageOS does not download it. The phone network fetches it from your address, so the address must stay reachable.
A file the network cannot fetch arrives as the message.failed event with the cause in reason.
{
"to": {
"contactId": 42
},
"file": {
"url": "https://example.com/files/receipt-8841.pdf"
},
"class": "transactional"
}A first message to a new number
A message you start needs a consent record for the person, or an earlier message from them. For a phone number that is not yet a contact, send the consent you hold in the same request. The contact is created with it, and the message is sent.
Without consent, the send to a new number is blocked with no_consent_record. The key needs contacts:write to store consent.
{
"to": {
"phoneNumber": "+15555550123"
},
"text": "Thanks for signing up. Reply STOP to opt out.",
"consent": {
"source": "checkout_form",
"capturedAt": "2026-10-28T23:00:00.000Z"
}
}A reply to a message
inReplyTo names a message the person just sent: inboundMessageId from reply.received. A reply needs no consent record, and quiet hours do not hold it. Replying to a message has the rules.
{
"to": {
"contactId": 42
},
"text": "Thanks for your message. Your visit is confirmed for Tuesday at 3:00 PM.",
"inReplyTo": 981
}Template
A template is text stored for this agent, with a value for each slot. MessageOS sets templates up for an agent, so ask MessageOS for one and for its id. An agent with no templates answers 422 to every template send, and plain text needs no template.
A template is a convenience for text and carries no suggestions, card, or file. An id this agent does not have returns 422 with details[0].path template.id. A template that is missing a value returns 422 too.
{
"to": {
"externalId": "crm-881"
},
"template": {
"id": "reminder",
"params": {
"name": "Pat"
}
},
"class": "transactional",
"onQuiet": "defer"
}A message that expires
Any message can carry an expiry, set one of two ways. ttlSeconds is how many seconds the message lives before the messaging network takes it back automatically: a whole number, 1 or more. expiresAt is the time the messaging network considers the message expired: an RFC 3339 time that is still ahead, written with an uppercase T, a Z or an offset such as -05:00, and at most three digits after the seconds, such as 2030-01-01T15:00:00Z.
Send one of them, not both. A body with both returns 422, and so does an expiresAt that has passed.
No event is sent when a message expires, and the expiry does not change the message's status in GET /v1/messages/{id}, so this API does not say whether the message was taken back.
expiresAt, ttlSeconds, and trafficType are accepted where GET /v1/whoami shows rcsExtras true. Where it is false, a body with one of them returns 422 until MessageOS turns it on for you, and the same message without the field still sends.
{
"to": {
"contactId": 42
},
"text": "Your table is ready. We can hold it for 10 minutes.",
"ttlSeconds": 600
}Traffic type
trafficType declares to the messaging network what kind of traffic the message is. It is one of authentication, transaction, promotion, serviceRequest, or acknowledgement.
Left out, no type is declared. MessageOS never sets it for you and does not check it, and it is separate from class: class decides which MessageOS rules a send passes, and trafficType is passed on as you wrote it.
expiresAt, ttlSeconds, and trafficType are accepted where GET /v1/whoami shows rcsExtras true. Where it is false, a body with one of them returns 422 until MessageOS turns it on for you, and the same message without the field still sends.
{
"to": {
"contactId": 42
},
"text": "Your order 8841 has shipped.",
"class": "transactional",
"trafficType": "transaction"
}What comes back
A sent message returns 201. type is what was sent: text, card, carousel, or file. An agent that cannot send a card sends its words as text, and type says text.
{
"id": "msg_123",
"status": "sent",
"type": "card",
"channel": "rcs",
"contactId": 42,
"reference": "order-8841",
"auditId": 123
}Messages show in the order the phone receives them, which is not always the order you sent them: a text sent right after a card, a carousel, or a video can show above it. When the order matters, leave a pause between the two sends.
