Skip to content
Registry StackDocsDevelopment (unreleased)

Send your first message

For the operator

View as Markdown

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.

Outcome
One SMS reported delivered by the mock provider and one email received by Mailpit, both sent through a local Messaging runtime.
Time
About 20 minutes, plus the image download
Level
Local evaluation only
Prerequisites
Linux amd64 or arm64, or macOS on Apple SiliconRunning Dockercurl 7.76 or laterjqThe tools required by the release verification procedure

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:

Terminal window
tag="vX.Y.Z"
bash "rstack-${tag}-install.sh" messaging
rstack messaging --version

The managed installation exposes rstack on your PATH. The messaging component supplies the Registry Messaging runtime and its command-line tools from the same release.

Terminal window
mkdir -p tutorial-work
rstack messaging init tutorial-work/notices
created: tutorial-work/notices
messaging.yaml
providers/sms-gateway/provider.yaml
...
templates/appointment-reminder/1/template.yaml
next: 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.

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:

dev.yaml
issuer: https://identity.starter.example.test
products:
- {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.yaml

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:

Terminal window
rstack dev check tutorial-work/notices
rstack --format json dev start tutorial-work/notices --ttl 2h > run.json
run_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.json
Development plan is valid
0 errors, 0 warnings in 1 file
unknown-message-is-not-visible: passed
send-a-reminder-sms: passed

The 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:

Terminal window
headers_for() {
rstack dev token "$run_id" --as "$1" | awk '$1 == "messaging" && $2 == "headers" {print $3}'
}

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:

Terminal window
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"}
}
JSON
rstack messaging api /v1/messages \
--url "$messaging_url" \
--header @"$(headers_for case-system)" \
--idempotency-key tutorial-sms-1 \
--input sms-request.json \
--output sms.json

Messaging 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:

Terminal window
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 1
done
jq '{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 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:

Terminal window
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"
}
JSON
rstack messaging api /v1/messages \
--url "$messaging_url" \
--header @"$(headers_for case-system)" \
--idempotency-key tutorial-email-1 \
--input email-request.json \
--output email.json
email_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 1
done
jq '{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:

Terminal window
curl --silent --show-error "$mailpit_url/api/v1/messages" |
jq -r '.messages[0] | "To: \(.To[0].Address)\nSubject: \(.Subject)\n\(.Snippet)"'
To: ada@example.org
Subject: Votre rendez-vous du 01/10/2026
Bonjour 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.

Terminal window
rstack dev stop "$run_id"
Run RUN_ID stopped

The 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.