SMS through Bird

Not proven end to end. Against the real Bird API (13 November 2026) only authentication, the look-up shape and the error shape were seen; no SMS has been delivered through this plug, and the delivery reports, replies and costs below are as Bird documents them, not as seen. See SMS acceptance.

Karta is built to send SMS through Bird, MessageBird's current platform (bird.com/docs), with the plug bird_sms. It runs inside Karta: no agent, and no call leaves Karta except to Bird's API. The plan is to target Bird v1; the older MessageBird REST API (rest.messagebird.com, the one the messagebird-rest gem uses) is a separate, older platform that this plug does not speak. It is a small addition behind the same plug behaviour (Karta.Messaging.Plug) if an account turns out to have no Bird workspace key.

What Karta relies on

These are the names Karta uses, taken from Bird's documentation (bird.com/docs/guides/sms/sending-sms and .../sms/events). If Bird changes one, this page and Karta.Messaging.Plugs.Bird are where to look.

Sending

  • POST https://{eu1|us1}.platform.bird.com/v1/sms/messages. The region is the part of the key after bk_: bk_eu1_... goes to eu1, bk_us1_... to us1. A key sent to the other region is answered 421.
  • Header Authorization: Bearer bk_{region}_... (confirmed against the real API on 2026-11-13: with it GET /v1/sms/messages answers 200, POST reaches validation; the key of the other region is 401).
  • Body fields: to (one recipient, E.164), from, text, category (transactional, service or authentication - Karta never sends marketing), reference (Karta's message id, 1 to 255 characters), metadata ({"karta_message_id": ...}, at most 2 KB, echoed on webhook events), options.callback_url (this Karta's /messaging/v1/hooks/:connector_id) and options.smart_encoding: true.
  • Header Idempotency-Key: Karta's attempt id. A repeated request with the same key is answered with the original result; nothing is sent twice. This is why a 5xx or a timeout is tried again with the same key.
  • Answer 202 Accepted with status: "accepted" and id (the provider id Karta keeps), segments (count, encoding, characters) and cost, which is null until a later event prices the message.
  • Error bodies are {"error": {"code": "E12056", "name": "SMSSenderNotConfigured", "message", "type", "param", "request_id", "doc_url"}} (seen 2026-11-13). Karta keeps code; the descriptive names below are the name. Errors: 402 empty wallet; 421 key for the other region; 422 with SMSDestinationNotEnabled (the destination country is not enabled in the workspace), SMSDestinationDailySpendExceeded, SMSAlphaNotSupported (no alphanumeric sender to that destination) and SMSUnsupportedFeature; 429 with Retry-After; 409 E01004 (the same send is in flight) and E01005 (the key was used with another body); 5xx. A message can also be rejected after the 202 (sms.rejected, insufficient_balance).

Senders. from is either alphanumeric (3 to 11 letters, digits, spaces, dashes, underscores or dots, at least one letter, no separator at either end - customers cannot answer it, and some countries need it registered or do not allow it) or a number the workspace owns (E.164 or bare digits). Karta checks the shape before it calls Bird (Karta.Messaging.SenderId); whether Bird allows it for the destination is Bird's answer. A request's from wins over the connector's default_from. Inbound SMS needs a number you own: nobody can reply to an alphanumeric sender.

Reports and replies arrive as signed webhooks, Standard Webhooks (webhook-id, webhook-timestamp, webhook-signature, HMAC-SHA256 over id.timestamp.body) with the workspace's callback signing secret (whsec_...; Bird shows it only after one rotation). Karta rejects a request older than five minutes or with a signature that does not match (401, nothing stored) and treats webhook-id as the event's identity. The body is {"type", "timestamp", "data"}:

Bird eventKarta
sms.accepted, sms.sentthe message is sent
sms.delivereddelivered (data.carrier, data.mcc_mnc are not kept)
sms.undelivereda temporary non-delivery: written in the message's history, the message stays sent (the carrier may still deliver)
sms.failed, sms.expiredfailed, permanent (data.error.code, description)
sms.rejectedfailed; insufficient_balance also pauses the connector
sms.receivedan inbound message from data.from (the text from data.text; the field name is not in Bird's documentation, body and content.text are read too)

data.sms_id names the message. Events are unordered and at least once: Karta keeps the outcome with the latest timestamp, applies a webhook-id once, and merges data.cost per component (transaction_amount, passthrough_amount, currency_code) by the latest event time, so the cost on a message is the charge so far. A delivery report may follow a failure: the message and its request then move to delivered. A failure Bird reports after it accepted the message is never sent again on the same channel.

Errors as Karta classes

AnswerClassNotes
202sent
401, 403permanent unauthorizedthe connector pauses
402permanent insufficient_balancethe connector pauses
421permanent wrong_regionthe connector pauses
422 about the recipientunknown_recipient
other 422, 400permanentBird's code is kept
429rate_limitedtried again after Retry-After
409 E01004retry

| 5xx, timeout | Karta asks Bird (GET /v1/sms/messages?reference=<attempt id>) whether the first call got there: found, it is sent; not found, it is sent again (with the same Idempotency-Key); cannot tell, the message is unknown and never sent again by Karta. It does not depend on Bird honouring the idempotency key |

Money is kept as decimal text ("0.0455"), never as a float. The cost of a message in the API is {"amount": "0.0455", "currency": "EUR"}. Bird's replies are never followed to another address (no redirects). A delivery report that arrives before Karta has stored the id Bird gave the send is matched by the attempt id Bird echoes from the send's metadata (karta_message_id) and applied at once. Only a report that does not carry that metadata, while a send of the connector is in flight (10 minutes), is answered 503 so that Bird sends it again; one for a message Karta never sent is accepted and dropped.

A paused connector (status error) is not used until someone presses Use again in the console (POST /messaging/v1/connectors/:id/resume).

Numbers

Numbers are E.164. A local number is read with the server's country (Messaging settings, server.default_country): Bonaire (BQ), Curaçao (CW), Aruba (AW), Sint Maarten (SX), the Netherlands (NL) and a few more (Karta.Messaging.Phone). +599 777 1234, 00599 777 1234 and, for a server in BQ, 777 1234 are the same number.

Making the connector

Console: Connectors, kind bird_sms, a name, the Bird API key, the callback signing secret and a sender. Or:

curl -sS https://karta.example/messaging/v1/connectors \
  -H "Authorization: Bearer $KARTA_KEY" -H 'Content-Type: application/json' \
  -d '{"plug": "bird_sms", "name": "Bird SMS",
       "config": {"default_from": "Bloemen"},
       "secrets": {"api_key": "bk_eu1_...", "webhook_secret": "whsec_..."}}'

The key and the secret are stored encrypted and are never shown again, not by the console and not by the API. In Bird, point the SMS events (or the workspace's callback) at https://karta.example/messaging/v1/hooks/<connector id>; Karta also asks Bird for each message's reports at that address (options.callback_url).

SMS is a paid channel: it is used only when a request names it in channels. Cost is kept per message when Bird reports it, and shown in the console, in GET /messages/:id and in messaging.message.status.

See SMS acceptance for the steps that prove it against a real key.