MessageOS
Guides

Quickstart

Send your first message in one call, then hear the reply and answer it.

Your system sends messages with POST /v1/messages and hears what people send back through a webhook. This page goes from a key to a two-way conversation.

Messages come from your agent: the sender MessageOS sets up for your business, with the name and logo people see on the conversation. They go by RCS, to the phone's regular messaging app.

1. Get a key

A client key starts with mosc_. An owner or admin of your brand makes one in the MessageOS dashboard, under Developers. Use the dashboard address MessageOS gave you. The key is shown once, when it is made, so copy it then.

A key does only what its permissions allow. The dashboard shows each one with the code name used here:

PermissionA full integration uses it to
messages:writeSend messages and read a sent message
contacts:writeStore consent with a first message, and create or update contacts
contacts:readList and read contacts
conversations:readRead conversations and their messages
webhooks:manageAdd, change, and test webhooks from code. Leave it off if you manage webhooks in the dashboard

This page uses messages:write, contacts:write, and webhooks:manage. A key cannot be changed later: to change its permissions, make a new key and revoke the old one. Authentication lists every permission, and says which ones an owner or admin can give a key and which ones MessageOS sets.

The Developers page can also add the webhook of step 4 and send it a test event, so an owner or admin can do both there instead of calling the API.

Check the key. Every sample on this page uses only what comes with the language, and prints the status and the answer:

curl 'https://api.messageos.ai/v1/whoami' \
  -H 'Authorization: Bearer mosc_...'

The answer names your agent and its scopes. Three fields say what you can use: richMessages is true when buttons, cards, carousels, and files are accepted, replyWindowSeconds is a number when replies are turned on, and rcsExtras is true when the typing indicator, the capability check, taking a message back, message expiry, and traffic type are turned on.

2. Send a message

One call sends a first message to a new person. consent is the record you hold of where and when they agreed to get messages. The contact is created with it.

Until your agent is launched, it reaches only its testers: phones MessageOS has added for you. So put a tester phone's number in place of +15555550123. Testing says how to get a phone added.

curl -X POST 'https://api.messageos.ai/v1/messages' \
  -H 'Authorization: Bearer mosc_...' \
  -H 'Idempotency-Key: welcome-15555550123' \
  -H 'Content-Type: application/json' \
  -d '{
  "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 sent message returns 201:

{ "id": "msg_123", "status": "sent", "type": "text", "channel": "rcs", "contactId": 42, "reference": null, "auditId": 123 }

sent means the messaging network took the message. It does not mean the message arrived. To learn what became of it, call GET /v1/messages/msg_123, which answers with its latest status: sent, delivered, read, or failed. The webhook of step 4 reports the same changes as they happen, as message.delivered, message.read, and message.failed.

Keep contactId. From now on the smallest send is a recipient and text:

{ "to": { "contactId": 42 }, "text": "Your table is ready." }

Idempotency-Key is 8 to 128 characters of your choosing. Use a new one for each message.

  • If a request times out or the connection drops before you read the answer, send it again with the same key and the same body. Once an answer is stored for the key you get that answer, and the message is not sent a second time.
  • A key that already has an answer, sent with a different body, returns 422 idempotency_key_reuse and sends nothing. So when you change a request, change its key too.
  • A blocked send is stored too, so to try again after you fix what blocked it, or after it passes, use a new key.
  • Four reasons are different, because the messaging network did not take the message: agent_not_available, message_rejected, provider_busy, and provider_error. Those answers are not stored, so the same key sends again. Only provider_error may still have gone out, and sending it again can reach the person twice.

3. Ask a question with buttons

Suggested replies show under the message as buttons. postbackData is your own value for each one. reference is your own id for the message, and it comes back in the delivery events. Buttons need richMessages true in GET /v1/whoami. While it is false, a body with suggestions returns 422.

{
  "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"
}

Message types has a body for each kind of message: buttons that open a link, call a number, or show a place, rich cards, carousels, and files.

4. Hear the answer

Register the address of your receiver, with the events it takes. It must be a public https address.

curl -X POST https://api.messageos.ai/v1/webhooks \
  -H 'Authorization: Bearer mosc_...' \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com/messageos/webhooks","eventTypes":["reply.received","message.delivered","message.read","message.failed","contact.opted_out","contact.opted_in"]}'

The answer is 201, with the signing secret:

{
  "id": 3,
  "url": "https://example.com/messageos/webhooks",
  "eventTypes": ["reply.received", "message.delivered", "message.read", "message.failed", "contact.opted_out", "contact.opted_in"],
  "status": "active",
  "secret": "9f1c2b7a4d3e8f60b5a1c9d2e7f4a3b6c8d1e2f3a4b5c6d7"
}

The secret is returned only once, so put it in your receiver's settings now. A webhook added on the Developers page of the dashboard shows its secret the same way: once, right after it is added.

When the person taps On my way, your address receives:

{
  "id": "evt_2b7f4c1e-8a9d-4e3f-b6a1-5c0d9e8f7a6b",
  "type": "reply.received",
  "createdAt": "2026-10-28T23:00:10.000Z",
  "clientId": "example",
  "data": {
    "inboundMessageId": 981,
    "contactId": 42,
    "externalId": null,
    "phoneNumber": "+15555550123",
    "conversationId": 7,
    "text": "On my way",
    "kind": "chip",
    "postbackData": "eta_now",
    "attachments": [],
    "location": null,
    "receivedAt": "2026-10-28T23:00:05.000Z"
  }
}

A tap has kind chip, the label in text, and your value in postbackData. Words the person types arrive the same way, with kind text and postbackData null. Webhook events lists every event and field.

Check the signature before you trust the body. Each event comes with two headers, x-messageos-timestamp and x-messageos-signature. The signature is sha256= and the lowercase hex HMAC-SHA256 of the timestamp, a period, and the raw body, keyed with the secret. Then answer with a 2xx status within 10 seconds, or the event is sent again. Verifying the signature has the steps and a sample to check your code against, and A complete receiver has a whole one in Node.js, Python, PHP, Ruby, Go, Java, and C#.

5. Answer it

Name the person's message in inReplyTo, and the send is a reply. Its id is inboundMessageId in the event:

{ "to": { "contactId": 42 }, "text": "See you soon.", "inReplyTo": 981 }

A reply to a message from the last hour needs no consent record, and quiet hours do not hold it. Replying to a message has the rules. Replies are on when replyWindowSeconds in GET /v1/whoami is a number. While it is null, a body with inReplyTo returns 422.

If your system answers customers itself, make sure the MessageOS assistant is not answering them too, or the person gets two replies. When your own system answers covers that setup from start to finish.

Testing

There is one kind of key and no separate test mode: a message the API sends goes to a real phone. The API address is the one on this page unless MessageOS gave you another. The Developers page of the dashboard shows the address for your agent.

  • Until your agent is launched, it reaches only the phones MessageOS has added as its testers. Give MessageOS the phone numbers you will test with. Each phone gets an invitation, and the agent can reach it once the invitation is accepted.
  • A send to any other number is not delivered. It answers 409 blocked with the reason agent_not_available and nothing is sent, or the send is accepted and reported afterwards as message.failed. Handle both.
  • POST /v1/webhooks/{id}/test checks your receiver without sending a message to anyone. It sends a signed webhook.test event to that endpoint. The delivery starts at once, so the event usually arrives within seconds. After 30 tests in an hour, or while webhook delivery is not turned on for your agent, it stays queued and goes out on the next delivery run. GET /v1/webhooks/{id}/deliveries lists it with its status and the status code your server answered.
  • Your receiver needs a public https address. Private and local addresses are rejected, so a receiver on your own computer needs a public https tunnel in front of it.

What MessageOS does for you

  • STOP, START, and HELP are answered by MessageOS, whatever your system does. Your webhook still receives each one as reply.received, so your system must not answer them too. Keywords are answered for you lists every word.
  • A person who opted out is never sent anything: a send to them returns 409 with the reason opted_out, and you hear about the change as contact.opted_out and contact.opted_in.
  • Each message from a person who has not opted out is marked read on their phone when it arrives. There is no call for it.
  • A send that does not go out returns 409 with a reason and a message that says what to do. Errors lists every reason.
  • GET /v1/messages/{id} reads where one message stands: sent, delivered, read, or failed.

Quiet hours are yours to keep where GET /v1/whoami shows quietHoursEnforced false: a send is not held for the time of day. Where it is true, a send you start during quiet hours is blocked, and a send to a contact with no time zone answers missing_timezone when the timezone on GET /v1/whoami is null too. When a message is not sent covers both.

Where to go next

  • When your own system answers: the whole loop for a business whose own software talks to its customers, with a checklist of what must be on.
  • The example app: a small working app that receives messages and answers with every kind of message.
  • Message types: a request body for each kind of message.
  • API reference: every endpoint, with each request in cURL, JavaScript, Python, PHP, Ruby, Go, Java, and C#.

On this page