Add SMS through Bird to the messaging module #92

Merged
calvin merged 9 commits from messaging-sms into master 2026-11-13 06:21:26 +00:00
Owner

What

Milestone 4 of the messaging plan: the bird_sms plug. Stacked on the messaging module pull request (#91): until that is merged this diff also shows it; merge #91 first.

  • Send through Bird v1 (POST https://{eu1|us1}.platform.bird.com/v1/sms/messages, bearer key, Idempotency-Key = the attempt id, callback_url, smart_encoding), 202 is sent, cost kept when reported.
  • Delivery reports and inbound SMS by signed webhook (POST /messaging/v1/hooks/:connector_id, Standard Webhooks verified with Karta.Webhooks.Signature.verify/4, five-minute tolerance, webhook-id deduplicated, unordered events resolved by timestamp, cost merged per component).
  • Error mapping (permanent / retry / unknown recipient / rate limited with Retry-After / insufficient balance / wrong region), a connector that pauses itself on an empty wallet or a refused key and can be resumed, 5xx and timeouts retried with the same idempotency key and then unknown, never a second SMS.
  • Sender-id rules, numbers normalised to E.164 with the server's country (BQ, CW, AW, SX, NL ...).
  • Console form for the key and secret; they are stored encrypted and never shown again.
  • Guides: messaging-sms.md quotes the endpoint and field names relied on; sms-acceptance.md is the step list to prove it with a real key.

Tested against handwritten fixtures built from Bird's public documentation (test/fixtures/messaging/bird); no live call to Bird was made. Field names Bird's documentation does not give (the text of sms.received, the name of the auth header) are marked in the guide and are the first things the acceptance steps check.

🤖 Generated with Claude Code

## What Milestone 4 of the messaging plan: the `bird_sms` plug. **Stacked on the messaging module pull request (#91)**: until that is merged this diff also shows it; merge #91 first. - Send through Bird v1 (`POST https://{eu1|us1}.platform.bird.com/v1/sms/messages`, bearer key, `Idempotency-Key` = the attempt id, `callback_url`, `smart_encoding`), `202` is sent, cost kept when reported. - Delivery reports and inbound SMS by signed webhook (`POST /messaging/v1/hooks/:connector_id`, Standard Webhooks verified with `Karta.Webhooks.Signature.verify/4`, five-minute tolerance, `webhook-id` deduplicated, unordered events resolved by timestamp, cost merged per component). - Error mapping (permanent / retry / unknown recipient / rate limited with `Retry-After` / insufficient balance / wrong region), a connector that pauses itself on an empty wallet or a refused key and can be resumed, 5xx and timeouts retried with the same idempotency key and then `unknown`, never a second SMS. - Sender-id rules, numbers normalised to E.164 with the server's country (BQ, CW, AW, SX, NL ...). - Console form for the key and secret; they are stored encrypted and never shown again. - Guides: `messaging-sms.md` quotes the endpoint and field names relied on; `sms-acceptance.md` is the step list to prove it with a real key. Tested against handwritten fixtures built from Bird's public documentation (`test/fixtures/messaging/bird`); **no live call to Bird was made**. Field names Bird's documentation does not give (the text of `sms.received`, the name of the auth header) are marked in the guide and are the first things the acceptance steps check. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
An optional module (KARTA_MESSAGING) with connectors, conversations,
messages and media, the remote-connector WebSocket (postduif.v1), the
HTTP API and the webhook events, with a test double of the agent.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merge remote-tracking branch 'origin/master' into messaging
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
113ffb33ff
Format the messaging connect test
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
c339aab79a
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Mark the media downloads for sobelow, with the reason
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
bfbdf14e45
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Keep the sobelow notes within credo's line length
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
cbe1baa69f
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merge branch 'messaging' into messaging-sms
Some checks are pending
ci/woodpecker/pr/woodpecker Pipeline is pending
2edccd7219
Reference the plug callback as a callback in the docs
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline failed
6ff755e940
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Allow the Bird plug's two fixed hosts in the HTTP client guard
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
ec3a9f12b4
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Fix the review findings in the messaging module (S1, S7, S8, S9 and the notes)
Some checks failed
ci/woodpecker/pr/woodpecker Pipeline was canceled
68de389b7d
The messaging event names are not accepted or listed while the module is off;
the text stays out of the webhook events by default; the large body limit is
for the media route only; the protocol copy is the whole document; resume never
pushes more than 100 commands; a late answer to an expired command flags a
possible duplicate; retention goes on past a file it cannot delete; a file is
attached once, by its own connector; the agent's bye reason is kept.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Copy the whole protocol document, with the answer to change 2
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
a5389eac61
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Merge branch 'messaging' into messaging-sms
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
f326050a93
calvin merged commit 664a35b1fe into master 2026-11-13 06:21:26 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
external/karta!92
No description provided.