Channels and connectors¶
Cue decides and prepares; delivery is yours to plug in. A channel is a named
route — push, sms, email, ops-alerts… — and its connector (the provider
setting) is what actually hands the message over. Rules, broadcasts and recipient
addresses refer to channels by name, so you can change how a route is delivered without
touching any rule.
The most flexible connector is webhook: Cue POSTs the fully rendered, signed message to
your service, and your service sends it however you like.
[channels.push]
provider = "webhook"
url = "https://notifications.internal.example/push"
# secret from CUE_CHANNELS__PUSH__SECRET
[channels.sms]
provider = "twilio" # or a bundled connector
account_sid = "AC…"
from_number = "+15550100"
Equivalent environment variables: CUE_CHANNELS__PUSH__PROVIDER=webhook,
CUE_CHANNELS__PUSH__URL=…. Configuration is validated at start-up;
cuectl check prints the configured channels.
Addresses¶
A recipient has any number of addresses per channel — every phone, browser and tablet:
POST /v1/recipients/user-42/addresses
{"channel": "push", "value": "<FCM registration token>", "label": "Pixel 9"}
A message goes to all enabled addresses of the first channel that works. When a
provider reports an address as permanently invalid (unregistered token, blocked bot,
unreachable number), the address is disabled with a reason and skipped from then on.
Re-adding it with POST /v1/recipients/{external_id}/addresses re-enables it; sending the
same value again in a profile update or inline with an event or message keeps it disabled,
so a stale token your app keeps reporting does not come back to life.
Fallback and retries¶
For each planned channel, in order:
- Success on any address → message
sent. - Transient error (timeouts, HTTP 429/5xx) → the delivery job is retried with
exponential backoff (honouring
Retry-After). On the last attempt Cue falls back to the next channel instead. - Permanent error → the next channel is tried immediately.
- Unhealthy channel → after
delivery.breaker_failures(5) transient failures in a row, a channel is skipped fordelivery.breaker_cooldown_seconds(60) by messages that have another channel planned after it, so a provider outage does not hold every message back. When the cooldown ends, one message at a time tries the channel: a success closes the breaker, a failure skips the channel for another cooldown. A channel is always tried when it is a message's only route, and on a message's last attempt. Replies that concern one recipient, such as an SMTP4xxtoRCPTorDATA(greylisting, a full mailbox), are retried but do not count against the channel. Each worker process keeps its own count.
If no channel succeeds the message is failed with the reasons in status_reason.
Delivery feedback¶
What a provider learns after accepting a message (it bounced, it was marked as spam, it arrived) comes back to Cue, which acts on it so nobody has to clean lists by hand:
| Report | Effect |
|---|---|
delivered |
The message becomes delivered on the first such report; the address's soft-bounce count resets. |
bounce |
The address is disabled (disabled_reason: "bounced: …"). A sent message becomes failed once every address it went to has bounced. |
soft_bounce |
Counted once per message and address; delivery.soft_bounce_limit (3) in a row, with no delivery between, disable the address. |
complaint |
The address stops getting messages of every category people may leave, including categories created later (complained_at on the address). Recorded in the consent ledger with source complaint. Receipts and alerts still reach it. |
Report from your backend or a provider's webhook handler (recipients:write):
POST /v1/feedback
{"type": "bounce", "channel": "email", "provider_message_id": "0100018c…",
"address": "ann@example.com", "reason": "550 5.1.1 user unknown"}
Name the message by Cue's message_id or the provider_message_id the provider
returned for any of the addresses it went to (with its channel), the address, or
both. A provider id names the address too. With only a message_id, a bounce or soft
bounce acts on an address only when the message went to a single one on that channel; a
complaint applies to all of them. Give the provider's own id for the report as
report_id and a repeated report is ignored ("duplicate": true); the ids are deleted by
cuectl prune. The response lists the recipients' external ids only to keys that hold
recipients:read.
Disabled addresses come back, with their soft-bounce count cleared, only through
POST /v1/recipients/{id}/addresses. A complaint stays on the address until it is
deleted and added again.
The SDKs have report_feedback (Python) and reportFeedback (TypeScript).
Twilio reports directly: set the channel's status_callback to
<api.public_url>/v1/inbound/twilio/status. Delivered texts are marked delivered;
numbers that cannot receive texts (unknown handset, landline, blocked, opted out) are
disabled, and other failures count as soft bounces. The request signature is checked
against the exact URL Twilio called, query string included, and the auth token of the
Twilio channels for the request's AccountSid. The message is looked up by
MessageSid across those channels; a callback for a message Cue did not send is
ignored. A repeated callback (same MessageSid and status) counts once. Status
callbacks have their own rate limit, api.rate_limit.feedback (6000 a minute per
address).
Bundled connectors¶
fcm — Firebase Cloud Messaging¶
Requires pip install 'cue-notify[fcm]'. Address: FCM registration token.
| Option | Default | |
|---|---|---|
credentials_file / credentials_json |
— | Service-account key (exactly one). |
project_id |
from the key | |
android_priority |
high |
normal or high. |
sound |
default |
null for silent. |
ttl_seconds |
— | Android time-to-live. |
The push data payload contains your template's data, url, plus
cue_message_id and cue_tracking_token for engagement tracking.
twilio — SMS¶
Address: E.164 phone number.
| Option | |
|---|---|
account_sid, auth_token |
Credentials. |
from_number or messaging_service_sid |
Sender. |
status_callback |
Delivery status webhook; set it to <api.public_url>/v1/inbound/twilio/status for delivery feedback. |
include_title |
Prefix the body with the title (default false). |
smtp — e-mail¶
Address: e-mail address. Uses only the standard library.
| Option | Default |
|---|---|
host, port |
—, 587 |
security |
starttls (tls for implicit TLS on 465, none) |
username, password |
— |
from_address, from_name, reply_to |
— |
Sends a text part, plus an HTML part when the template has html. With
api.public_url set, messages in categories people may leave carry
List-Unsubscribe and List-Unsubscribe-Post headers for one-click unsubscribe.
resend — e-mail through Resend¶
Address: e-mail address.
| Option | |
|---|---|
api_key |
Resend API key. |
from_address, from_name, reply_to |
from_address must be on a domain verified in Resend. |
webhook_secret |
Signing secret (whsec_…) of the webhook below. |
Same message as smtp: text and HTML parts, the importance header and one-click
unsubscribe. The message id and a hash of the address make the request's
Idempotency-Key, so a retried job cannot send twice and each address of a message gets
its own e-mail. Resend's 409 concurrent_idempotent_requests and resource_locked are
retried. For delivery feedback, add a webhook in Resend for
email.delivered, email.bounced, email.complained and email.suppressed, pointing
at <api.public_url>/v1/inbound/resend/<channel name>. Signatures older or newer than
five minutes are refused, a repeated svix-id is applied once, and
email.delivery_delayed is ignored: a delay is not a bounce.
ses — e-mail through Amazon SES¶
Requires pip install 'cue-notify[ses]' for feedback. Address: e-mail address.
| Option | |
|---|---|
region |
e.g. eu-west-1. |
from_address, from_name, reply_to |
from_address must be a verified identity. |
access_key_id, secret_access_key, session_token |
Default to AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN. |
configuration_set |
The configuration set whose event destination publishes to SNS. |
sns_topic_arns |
SNS topics allowed to report feedback for this channel. |
Uses the SES v2 API, signed with Signature Version 4; no AWS SDK is needed. The key
needs ses:SendEmail. Credentials come from the options or the environment only; for
roles (IRSA, ECS task roles) export them into the environment or use the smtp
connector with SES's SMTP interface.
For delivery feedback, have the configuration set (or the
identity) publish bounces, complaints and deliveries to an SNS topic, list the topic in
sns_topic_arns, and subscribe <api.public_url>/v1/inbound/ses/<channel name> to it
over HTTPS. Leave raw message delivery off: it strips the signature, and Cue refuses
such messages. Cue confirms the subscription itself, checks each message's signature
against Amazon's certificate, refuses topics you did not list (anyone can create an SNS
topic) and messages more than an hour old, and applies a repeated MessageId once.
Delivery delays are ignored. When Amazon's certificate or confirmation URL cannot be
reached, Cue answers 503 so SNS retries.
Throttling (TooManyRequestsException, ThrottlingException), RequestTimeoutException
and 5xx answers are retried. SendingPausedException and AccountSuspendedException
fail the message and are logged as errors: the account cannot send until you fix it.
slack — Slack¶
Address: a member id (U…), delivered as a direct message from your app, or a channel id
(C…) your bot is in.
| Option | Default | |
|---|---|---|
bot_token |
— | Bot token (xoxb-…) with chat:write (and im:write for direct messages). |
unfurl_links |
false |
Let Slack preview links. |
The title becomes a header, the body a section, and the URL and actions become buttons.
Text from event data is escaped (<, >, &) and sent with verbatim: true, so it
cannot mention @channel or @here. Links longer than Slack's 3000 characters are left
out. A context line links to the person's notification settings.
The address is disabled on the chat.postMessage errors that mean it cannot be reached:
channel_not_found, is_archived, not_in_channel and messages_tab_disabled. Token
problems (account_inactive, invalid_auth, token_revoked, token_expired,
missing_scope) fail the message without touching addresses, and are logged as errors.
A bot token from the wrong workspace looks like dead addresses
Slack also answers channel_not_found when the bot cannot open a direct message with
the member, for example because the token belongs to another workspace. Every
address would then be disabled. Check the token with a test message before pointing
real traffic at a new channel.
apns — Apple Push Notification service¶
Requires pip install 'cue-notify[apns]'. Address: device token (hexadecimal).
| Option | Default | |
|---|---|---|
team_id, key_id |
— | From your Apple Developer account. |
key_file / key |
— | The AuthKey_….p8 token-signing key (exactly one). |
bundle_id |
— | Sent as apns-topic. |
environment |
production |
sandbox for development builds. |
sound |
default |
null for silent. |
category |
— | A notification category your app registered, for action buttons. |
ttl_seconds |
— | Expiry when the message has none. |
Talks to APNs directly over HTTP/2 with a token Cue signs (ES256) and renews. Importance
maps to the interruption level (passive, active, time-sensitive) and priority;
thread to thread-id; expires_at to apns-expiration. The payload carries your
template's data, url, cue_actions, cue_message_id and cue_tracking_token.
Unregistered, ExpiredToken (410) and BadDeviceToken disable the address. An
ExpiredProviderToken makes Cue sign a new token once; InvalidProviderToken,
DeviceTokenNotForTopic, BadTopic and other configuration errors fail the message
without disabling anything, and are logged as errors.
Match the environment and the bundle id to the app build
Tokens from development builds only work with environment: sandbox, tokens from
TestFlight and App Store builds only with production. Apple answers a token from the
other environment with BadDeviceToken, which disables the address, so a wrong
environment disables every address the channel sends to. bundle_id must be the
bundle id of the app that registered the tokens.
telegram — Telegram bots¶
Address: the chat id. Option: bot_token, disable_notification, link_preview,
api_url (for a self-hosted Bot API server).
webhook — HTTP¶
Posts JSON to url, or — when url is not set — to the address itself (useful for
per-user Slack, Discord or Teams incoming webhooks).
Per-recipient URLs are untrusted input, so by default they must use https, must
resolve only to public IP addresses (no localhost, private ranges or cloud metadata
endpoints), and the connection is pinned to the address that was checked. Response bodies
from such URLs are never stored. allow_http and allow_private_networks relax this for
internal deployments; a fixed url is operator configuration and is trusted.
The body:
{
"id": "0192…",
"channel": "email",
"address": "ann@example.com",
"locale": "en",
"content": {"title": "Your order shipped", "body": "…", "url": "…", "thread": "order-A1"},
"metadata": {"cue_message_id": "0192…", "cue_tracking_token": "…"},
"links": {"preferences": "https://notify.example.com/preferences/…",
"unsubscribe": "https://notify.example.com/preferences/…/unsubscribe?category=marketing"}
}
links is empty unless api.public_url is set; unsubscribe is only
present for categories people may leave. Put it in a List-Unsubscribe header if your
service sends e-mail.
With secret set, requests carry:
Cue-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">
Idempotency-Key: <message id>
Verify the signature and reject timestamps older than a few minutes.
A channel with a fixed url and no secret sends unsigned requests that anyone could
imitate. Cue logs a warning at startup and cuectl check fails for such a channel; set
allow_unsigned = true if the receiver authenticates Cue another way (for example a
token in headers).
console¶
Logs messages instead of sending them. For development and demos.
Your own connector¶
Any package can add a connector — see custom channels.