Released docs. You are viewing the documentation published with v0.48.0. Development docs are available at Latest.
You will send one SMS and one email through a Messaging runtime on your own machine, as the starter package’s caller, and read back what each provider reported.
Install Registry Stack
Section titled “Install Registry Stack”Download one exact rstack-vX.Y.Z-install.sh and the verification material from the same Registry
Stack release. Follow the
release verification procedure
before running the installer. From the verified release directory, install the messaging
component:
tag="vX.Y.Z"bash "rstack-${tag}-install.sh" messagingrstack messaging --versionThe managed installation exposes rstack on your PATH. The messaging component supplies the
Registry Messaging runtime and its command-line tools from the same release.
Create a package
Section titled “Create a package”mkdir -p tutorial-workrstack messaging init tutorial-work/noticescreated: tutorial-work/notices messaging.yaml providers/sms-gateway/provider.yaml ... templates/appointment-reminder/1/template.yamlnext: Run messagingctl check --project DIRECTORY, then rstack dev start DIRECTORY to run it locally against PostgreSQL and Mailpit containers.The package holds dev.yaml, the development plan, beside messaging.yaml. The starter declares two sender profiles: transactional sends email through an SMTP provider, and
reminders-sms sends SMS through an HTTP gateway. One access profile lets the caller
case-system send an appointment reminder through either.
Start the run
Section titled “Start the run”dev.yaml lists Messaging as the one product and names two synthetic people: case-system, who
may send, and operator, who may read and operate. Its scenario file sends one SMS before the run
reports ready. The plan holds no keys and no addresses:
issuer: https://identity.starter.example.testproducts: - {product: messaging, project: ., audience: "urn:example:messaging"}people: case-system: subject: case-system client: case-system grants: messaging: profile: case-notices scopes: ["messaging:send"] claims: {registry_actor_kind: service} operator: subject: operator client: operations-console grants: messaging: profile: operations scopes: ["messaging:operate"]scenarioFile: tests/scenarios.yamlA run writes private local credentials and a log under its own directory, outside your project. Send only to example addresses and numbers.
Check the plan, then start the run. It starts PostgreSQL and Mailpit in containers, a mock SMS gateway, and the Messaging runtime on free loopback ports. The first start pulls the images. Run a project with rstack dev explains the options and how to recover a failed run:
rstack dev check tutorial-work/noticesrstack --format json dev start tutorial-work/notices --ttl 2h > run.jsonrun_id="$(jq -r .run_id run.json)"messaging_url="$(jq -r .products.messaging run.json)"mailpit_url="$(jq -r '.sinks["mail-relay"].url' run.json)"jq -r '.scenarios[] | "\(.id): \(.result)"' run.jsonDevelopment plan is valid0 errors, 0 warnings in 1 fileunknown-message-is-not-visible: passedsend-a-reminder-sms: passedThe run sent the scenario’s SMS through the mock gateway and read back its delivery report.
messaging_url is the runtime’s address and mailpit_url is the mailbox every email provider
sends to. Your ports differ. Each call below needs a short-lived token for case-system. This
function asks for one and prints the header file to pass to the commands:
headers_for() { rstack dev token "$run_id" --as "$1" | awk '$1 == "messaging" && $2 == "headers" {print $3}'}Send an SMS
Section titled “Send an SMS”Submit the reminder to an example number. The idempotency key is yours to choose: the same body
sent again under it returns the same message instead of sending a second one. --input selects
POST, and --header passes the token header file for case-system:
cat > sms-request.json <<'JSON'{ "senderProfile": "reminders-sms", "to": {"phone": "+15555550100"}, "template": {"id": "appointment-reminder-sms", "version": "1"}, "locale": "en", "data": {"name": "Ada", "day": "2026-10-01", "office": "North"}}JSONrstack messaging api /v1/messages \ --url "$messaging_url" \ --header @"$(headers_for case-system)" \ --idempotency-key tutorial-sms-1 \ --input sms-request.json \ --output sms.jsonMessaging accepts and queues the message. The mock gateway takes it, then posts a signed delivery report back. Read the message until the report has arrived, for up to ten seconds:
sms_id="$(jq -r .id sms.json)"for _ in 1 2 3 4 5 6 7 8 9 10; do rstack messaging api "/v1/messages/$sms_id" \ --url "$messaging_url" \ --header @"$(headers_for case-system)" \ --output sms-status.json if [ "$(jq -r .report sms-status.json)" = "delivered" ]; then break; fi sleep 1donejq '{status, dispatch, report, to}' sms-status.json{ "status": "delivered", "dispatch": "submitted", "report": "delivered", "to": { "phone": "redacted" }}dispatch is what Messaging did: it submitted the message to the provider. report is what the
provider said afterwards: delivered. status combines the two. The answer never repeats the number.
Send an email
Section titled “Send an email”Send the same reminder as an email, in French, with a correlation identifier your own system would use to find it again. Then wait for the email provider to accept it:
cat > email-request.json <<'JSON'{ "senderProfile": "transactional", "to": {"email": "ada@example.org"}, "template": {"id": "appointment-reminder", "version": "1"}, "locale": "fr", "data": {"name": "Ada", "day": "2026-10-01", "office": "North"}, "correlationId": "case-42"}JSONrstack messaging api /v1/messages \ --url "$messaging_url" \ --header @"$(headers_for case-system)" \ --idempotency-key tutorial-email-1 \ --input email-request.json \ --output email.jsonemail_id="$(jq -r .id email.json)"for _ in 1 2 3 4 5 6 7 8 9 10; do rstack messaging api "/v1/messages/$email_id" \ --url "$messaging_url" \ --header @"$(headers_for case-system)" \ --output email-status.json if [ "$(jq -r .dispatch email-status.json)" = "submitted" ]; then break; fi sleep 1donejq '{status, dispatch, report, correlationId}' email-status.json{ "status": "submitted", "dispatch": "submitted", "report": "unavailable", "correlationId": "case-42"}The status stays submitted. The mail server accepted the message, and SMTP sends no delivery
report back, so Messaging cannot say more.
Read what Mailpit received:
curl --silent --show-error "$mailpit_url/api/v1/messages" | jq -r '.messages[0] | "To: \(.To[0].Address)\nSubject: \(.Subject)\n\(.Snippet)"'To: ada@example.orgSubject: Votre rendez-vous du 01/10/2026Bonjour Ada, Votre rendez-vous à North est fixé au 01/10/2026. Merci d'apporter cet avis.Messaging rendered the French subject and body from the template and the request’s data. Open
the Mailpit address in a browser to see the HTML part.
Stop the run
Section titled “Stop the run”rstack dev stop "$run_id"Run RUN_ID stoppedThe database, the mailbox and the gateway are gone, and so are the run’s keys and files. The run would have stopped by itself after two hours. Your project was never written to.
- The Registry Messaging overview explains what you defined, what ran, and who owns each answer.
- Author a Messaging package continues in this project: add a French SMS and package it.
- Registry Messaging API for every route, status, and problem code.
Cookies on Registry Stack
We use optional cookies to understand how you use the main Registry Stack website and this documentation. If you contact us, we may link this activity to your enquiry. You can change your choice at any time. Read the privacy policy.
Your browser asks sites not to track you, so optional tracking stays off.
We could not use or save that choice. Optional tracking remains off.