Karta.Messaging.Plugs.Bird (Karta v1.0.0)

SMS through Bird (MessageBird's current platform, bird.com/docs), an in-process plug.

What Karta relies on (from Bird's documentation)

  • POST https://{eu1|us1}.platform.bird.com/v1/sms/messages with the body {"to", "from", "text", "category", "reference", "metadata", "options": {"callback_url", "smart_encoding"}} and the header Authorization: Bearer bk_{region}_...; the answer is 202 Accepted with {"id", "status": "accepted", "cost", "segments", ...} (cost is null until a later event prices the message);
  • the header Idempotency-Key: a repeated request with the same key is answered with the original result and sends nothing twice. Karta uses the attempt's id;
  • one recipient per request, E.164; category is required (transactional, service, authentication; Karta never sends marketing);
  • from: 3 to 11 alphanumeric characters (customers cannot answer it) or a number the workspace owns (Karta.Messaging.SenderId);
  • delivery reports and inbound texts arrive as signed webhooks (Karta.Messaging.Plugs.Bird.Events), posted to options.callback_url (the connector's /messaging/v1/hooks/:connector_id) and verified with the workspace's callback signing secret.

The connector

secrets: api_key (bk_eu1_... or bk_us1_..., the region is read from it), webhook_secret (the callback signing secret, whsec_...; without it no inbound event is accepted). config: default_from, default_category, region (only to state what the key says), messaging_profile_id. Answers to a send are mapped to Karta's error classes by Karta.Messaging.Plugs.Bird.Errors.

Requests go to the fixed hosts above (config :karta, Karta.Messaging.Plugs.Bird, req_options: lets tests stub them).

Summary

Functions

Bird's idempotency key makes a repeated send safe: the job may run again.

Functions

idempotent?()

Bird's idempotency key makes a repeated send safe: the job may run again.