Skip to content

sendblue

diapason.channels.sendblue

SendBlue channel — iMessage/SMS API adapter.

Sends and receives iMessages (blue bubbles!) and SMS via the SendBlue API. The agent gets a dedicated phone number; users text that number to interact.

API reference: https://docs.sendblue.com/api-v2/

SendBlueChannel

Bases: BaseChannel

SendBlue iMessage/SMS channel adapter.

Parameters

api_key_id: SendBlue API key ID. Falls back to SENDBLUE_API_KEY_ID env var. api_secret_key: SendBlue API secret key. Falls back to SENDBLUE_API_SECRET_KEY env var. from_number: The SendBlue phone number to send from (E.164 format). Falls back to SENDBLUE_FROM_NUMBER env var. webhook_secret: Optional secret for verifying incoming webhook requests. bus: Optional event bus for publishing channel events.

from_number property

The SendBlue phone number this channel sends from.

connect()

Validate credentials and mark as connected.

disconnect()

Mark as disconnected.

handle_webhook(payload)

Process an incoming webhook payload from SendBlue.

Expected fields: from_number, content, to_number, message_handle, is_outbound, status, service.

list_channels()

Return available channel identifiers.

on_message(handler)

Register a callback for incoming messages.

send(channel, content, *, conversation_id='', metadata=None)

Send an iMessage/SMS via SendBlue.

Parameters

channel: Recipient phone number in E.164 format (e.g. "+15551234567"). content: Message text to send.

status()

Return the current connection status.