MessageOS
Guides

Kitchen Sink showcase

Real phone screenshots of the MessageOS Kitchen Sink example app, everything it can do, and where to get the code.

MessageOS Kitchen Sink

Every message type, in one conversation.

The Kitchen Sink is a small working app for a business whose own system answers its customers. Text it and it sends a menu. Tap a card and that kind of message arrives on your phone, with a line that names the field of the API that made it.

It hears each message as reply.received at a signed webhook and answers with POST /v1/messages. Every hard part of a receiver is in the code, ready to copy.

The repository is public. Clone it, or copy what you need.

demos
10
actions
6
file kinds
4
dependencies
0

What it looks like on a phone

These are real screenshots, taken on an Android phone in a conversation with the Kitchen Sink agent. Each caption names the field or the call behind what you see. Open any of them to see it full size.

A conversation with the MessageOS Kitchen Sink agent. The person tapped Menu and got a carousel of cards. The first card is Text with a Show text button, and the second is Replies with a Show replies button. Above it is the end of the rich card demo.
Menucarousel

Type menu or tap Menu, and the app answers with POST /v1/messages and a carousel, one card for each demo.

The Text demo sent two text messages. The second says it adds suggestions, the buttons under it. The person tapped Next: Replies, and the Replies demo asks which size they would pick, with the buttons Small, Medium, Large, Next: Actions, and Menu under it.
Text and repliessuggestions

A plain text message, then a second that adds suggestions, the tour buttons. A tap on Next: Replies brought a question with suggested replies, each with its own postbackData.

The person tapped Small and the app answered: You tapped Small. Your system received postbackData small. The Actions demo follows, with the buttons Open in webview, Open in browser, and Call a number.
A tap, then actionspostbackData

The tap on Small came back as reply.received with postbackData ks:picked:small. The app shows the part after ks:picked:. Under it, suggestions of type openUrl and dial open a page, the browser, and the dialer.

A vertical rich card with a large picture, a title, a description, and the buttons Tap this button and Open the example page. Under it is a horizontal rich card with a small picture on the left. The buttons Next: Carousel and Menu are at the bottom.
Rich cardscard

A vertical card with a picture, a title, a description, and two buttons, then a horizontal one. card.orientation and card.thumbnailAlignment choose the layout.

A carousel with the cards Violet and Blue. Each card has a picture, a line of text, and its own button: Pick Violet and Pick Blue. The buttons Next: Files and Menu are at the bottom.
Carouselcarousel

Cards to swipe, sent as carousel.cards. Each button names its own item, Pick Violet and Pick Blue, so no two read the same.

An image sent as a file, then a video sent as a file with a preview picture, a play button, and a length of four seconds. The buttons Image, Video, Audio, PDF, and Next: Location are at the bottom.
Image and videofile.url

An image, then a video whose preview picture is file.thumbnailUrl. Both are sent by their public address.

An audio file with a player, a PDF named sample.pdf, and the Location demo, which asks the person to tap Share location. The buttons Share location, Next: Typing, and Menu are at the bottom.
Audio, PDF, locationshareLocation

An audio file with a player, a PDF by its name, then a Share location button. The place comes back in reply.received as location.

The Device check demo. The app says GET /capabilities reports that this phone can receive RCS from this agent, and lists rich cards, carousels, and the buttons that open a link, start a call, show a place, ask for a location, and add a calendar event.
Device checkGET /v1/capabilities

The app asks what this phone supports and lists the answer. Above it is the end of the Expiry demo, sent with ttlSeconds and trafficType.

Watch it move

Short clips of the same conversation, recorded on the same phone. Nothing plays until you press play, and no clip has sound.

The menucarousel
A tap on Menu brings the carousel of demos, and one swipe moves along it.
Texttext
A plain text message, then a second that adds suggestions, the tour buttons.
Suggested repliespostbackData
A question with suggestions, then the answer to a tap on Small, which carries that button's postbackData.
Six actionssuggestions
One message with a button for each suggested action. The row is swiped to its end, and nothing is tapped.
Rich cardscard
A vertical card arrives, then a horizontal one, each a message of its own.
Carouselcarousel
Three cards sent as carousel.cards, swiped from the first to the last.
Image and videofile.url
An image, then a video that shows its file.thumbnailUrl picture until someone plays it.
Audio and PDFfile.url
An audio file with a player, then a PDF shown by its name. Both are sent by their public address.
Typing indicatorPOST /v1/typing
The typing dots show while the app waits two seconds, then the answer arrives.
Expiry and device checkttlSeconds
A message sent with ttlSeconds and trafficType, then the answer of GET /v1/capabilities as a list.

What it can do

The app has 10 demos, and it also answers whatever a person sends on their own. These are all of its capabilities, each with the field or the call behind it.

Every kind of message it sends

Everything it hears

The engineering it shows

Signature over the raw body

HMAC-SHA256 of the timestamp, a period, and the exact bytes sent, compared in constant time. Nothing parses the body first.

x-messageos-signature

A 300 second window

A timestamp more than 300 seconds off is refused, so a captured request cannot be played back later.

x-messageos-timestamp

Nothing is sent twice

Every send carries a key built from the person's message: ks-reply-, then inboundMessageId, a dash, and a number. A redelivered event, or a second endpoint's copy of it, sends nothing new.

Idempotency-Key

The same body every time

Nothing in a message comes from the clock, a random value, or the id of the event, so one message always builds the same request.

Answers when the work is done

It sends first and answers 200 after. A send worth another try answers 500, and MessageOS delivers the event again. A send refused for good is logged and the event is accepted.

Silent for keywords

MessageOS answers STOP, START, HELP, and the other keywords itself. The app knows the list and stays silent, typed or tapped.

src/keywords.js

At most three replies

Every answer names the person's message, and up to three sends can answer one message as replies. No demo sends more.

inReplyTo

Always something to tap

Buttons show only under the newest message, so the last message of every answer ends with at least a Menu button. The menu is the one exception: each of its cards has its own button.

Zero dependencies

Plain JavaScript for Node.js 20 or newer. There is nothing to install to run it, and nothing between you and the code.

node:httpnode:cryptofetch

Adapts to your agent

It reads what your agent has turned on and skips the rest. Where richMessages, rcsExtras, or replyWindowSeconds is off, it says so in one plain line and does not fail.

GET /v1/whoami

Tests that need no network

They post signed events to the real handler and check every request it makes against a stand-in for the API.

npm test

A server or a function

One handler for Node's own HTTP server, exported again for a host that runs functions. It reads the exact bytes on both.

src/app.js

How it works

One message in, one answer out. The whole loop is four steps, and the app is the last two.

  1. Step 1

    A person texts your agent

    A typed word, a tap on a button, a photo, or a shared place.

  2. Step 2

    MessageOS posts it to your webhook

    A signed event with the words, the tapped value, any file or location, and inboundMessageId.

    reply.received
  3. Step 3

    The app checks it and decides

    The raw body, the signature, and the timestamp come first. Then one function reads what arrived and picks the answer.

    src/conversation.js
  4. Step 4

    It answers through the API

    With inReplyTo, so the send is a reply, and an Idempotency-Key, so a repeat sends nothing twice.

    POST /v1/messages

MessageOS does the rest without being asked: it answers the keywords, marks each message read when it arrives, refuses a send to a person who opted out, and reports every message you send as delivered, read, or failed. When your own system answers explains each of these.

What is in the repository

Plain JavaScript with JSDoc types, in a few small files, so each one can be read in a sitting.

src/app.js
The handler: the webhook receiver, /health, and /media/*.
src/signature.js
The signature and timestamp check.
src/conversation.js
Which answer each message gets, and how it is sent.
src/content.js
The body of every message, as plain data.
src/keywords.js
The words MessageOS answers itself.
src/messageos.js
A small client for the API calls the app makes.
src/config.js
The five settings, with .env.example to copy.
src/types.js
The shapes of an event and of a message body.
src/server.js
Runs the handler as a server.
api/index.js
The same handler as a function.
tour.json
The demos in tour order.
public/media/
The sample pictures, video, audio file, and PDF.
scripts/
The three commands below that call the API.
test/
The tests, with a stand-in API in test-support/.
screenshots/
The phone screenshots on this page.
clips/
The short clips on this page.
AGENTS.md
The rules of the example, for a coding assistant.

Four commands take you from a key to a conversation on your phone, and a fifth runs the tests.

kitchen-sink
npm run check
Calls GET /v1/whoami and prints what your key and your agent offer.
npm start
Runs the app. npm run dev restarts it on every change.
npm run setup:webhook
Registers the webhook for your public address and prints its signing secret once.
npm run send:menu -- +15555550123
Sends the menu to one phone, with the consent record a first message needs.
npm test
Runs every test, with no network and no key.

The example app has the full setup: the key and its permissions, the five settings, and each step in order.

Keep going

Text it, tap through it, then read the code.

The code is at https://github.com/messageos/Kitchen-Sink-API-Example. The repository is public. Clone it, or copy what you need.