Skip to main content

Channels API

Channels endpoints exposed by the Devotel CPaaS API Base path: /api/v1/channels Endpoint count: 7

List Apple Messages for Business agents

GET /api/v1/channels/amb/agents
Return all Apple Messages for Business (AMB) agents registered on the tenant’s account, newest first (capped at 200 rows). Use this to render the channel-settings list, or to check approval status (pendingapprovedsuspended) and capability flags before enabling the AMB channel on the dashboard. Agent secret keys are encrypted at rest and never serialised — the response exposes only a has_secret boolean.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

List WhatsApp Flows

GET /api/v1/channels/whatsapp/flows
Return the tenant’s Meta WhatsApp Flows (up to 100, newest first) — the inbox composer uses this to prepend a local-flow picker while a response to Meta’s completion webhook lands. Each record carries the remote Meta flow_id (from publishing a draft), the lifecycle status (draft/published/deprecated), the flow’s JSON schema, and the first screen’s id. Only authenticated workspace members may call this.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Register an Apple Messages for Business agent

POST /api/v1/channels/amb/agents
Create a new Apple Messages for Business (AMB) agent for the tenant. Supply the business_id issued by Apple Business Register plus the base64 secret_key Apple assigned to the agent; the secret is encrypted with the platform AES-256-GCM envelope before persisting and is never returned by any read endpoint. Optionally set approval status, capability flags (text, interactive, rich link, form, time picker, Apple Pay), and a logo_url shown on the dashboard. Audit trail entry amb.agent_created is recorded.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
string
required
Apple Business Register identifier for the business.
string
required
Human-readable name for the agent (1–200 chars).
string
required
Base64 shared secret Apple assigned to the agent (16–2048 chars); encrypted before persistence.
string
Optional Messaging Service Provider id override.
string (enum: pending|approved|suspended)
Approval state; defaults to pending when omitted.
object
Capability flags approved by Apple (text, interactive, richLink, form, timePicker, applePay).
string
Optional HTTPS logo URL shown on the dashboard.

Inbound Apple Messages for Business webhook

POST /api/v1/channels/amb/webhook
Receives inbound AMB messages (text, list-picker, form reply, time-picker, Apple Pay events) from Apple. Uses the Authorization: Bearer <jwt> header for HMAC verification per RFC 7515; the router performs a bounded cross-tenant candidate sweep over amb_business_registry and picks the tenant whose secret validates the JWS signing-input. Verified messages are persisted into the tenant inbox before this endpoint acknowledges with { accepted: true }. Persistence failures are logged but acknowledged (Apple retries aggressively on 4xx/5xx).
string
Legacy raw JWT (no Bearer prefix).
string
Apple message id header used as the persistence idempotency key when the body carries none.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Inbound WhatsApp Flows completion webhook

POST /api/v1/channels/whatsapp/flows/endpoint
Receives a Meta Flow-completion event when a customer finishes a multi-step interactive Flow. Authenticates using the X-Devotel-Org-Id header (org id shape-validated, then the org’s WhatsApp connection credentials + flow private key are resolved). The request body is the Meta-endpoint envelope (encrypted_flow_data, data = ); the signature is HMAC-SHA256 over the raw body using the org’s app_secret. Payloads are persisted to <tenant>.whatsapp_flow_responses keyed to the matching flow. Returns the Meta-specified AES-128-GCM-encrypted JSON as text/plain (NOT the standard { data, meta } envelope); failure replies use the uniform 401 error envelope below.
string
Orbit organization id that owns the flow (required).
string
HMAC-SHA256 over the raw body using the org’s app_secret.
string
Stripe-style idempotency token. Pass a stable, client-generated value (1-255 chars) to dedupe retries on transient timeouts. The same key+credential+path replays the original response for 24h on 2xx (5min on 4xx, 30s on 5xx). Returns 409 if a concurrent request with the same key is already in flight; replayed responses include the Idempotency-Replay: true response header.
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.

Update an Apple Messages for Business agent

PATCH /api/v1/channels/amb/agents/{id}
Partially update an existing AMB agent — rename it, transition its status (approve / suspend), rotate the secret key (the replacement is encrypted before persisting), swap capability flags, or clear/set msp_id and logo_url. Only the fields sent are changed; omitted fields keep their previous value. The public registry mapping (business_id → tenant) is re-synced so inbound webhooks keep routing correctly. Audit trail entry amb.agent_updated is recorded.
string
required
The AMB agent id (UUID).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.
string
New name (1–200 chars).
string
Rotated base64 secret (16–2048 chars); encrypted at rest.
string | null
New MSP id, or null to clear.
string (enum: pending|approved|suspended)
Approval-state transition.
object
string | null
New HTTPS logo URL, or null to clear.

Delete an Apple Messages for Business agent

DELETE /api/v1/channels/amb/agents/{id}
Remove an AMB agent from the tenant and drop its business_id from the cross-tenant public registry (ownership is scoped to the organization) so inbound Apple Messages webhooks stop routing here. The response returns the deleted id plus deleted: true. Audit trail entry amb.agent_deleted is recorded.
string
required
The AMB agent id (UUID).
string (enum: true|false)
Sandbox opt-in for Clerk-session-authenticated requests. Set to true to route the call through the test-mode pipeline: no real provider delivery, no credits deducted, response meta.test_mode: true. Ignored for live API keys (dv_live_sk_*) — server-to-server clients must use a test-prefixed key (dv_test_sk_*) to exercise sandbox. Test-prefixed keys unconditionally enable sandbox regardless of this header.