Connect a messaging or voice channel
Channels let users talk to agents through the messaging platforms they already use. Alquimia Platform normalizes inbound messages from each channel into the same execution pipeline, so the agent itself does not need to know whether a message came from WhatsApp or Email. Agents can also accept and produce audio on WhatsApp, Kapso, and Twilio Media Stream channels, with output_format control and MP3 decoding for TTS output.
Choose the right channel
Section titled “Choose the right channel”| Channel | Best for |
|---|---|
| Mobile customers, field service, rich media | |
| Slack | Internal helpdesks, team collaboration, slash commands |
| Formal requests, long-form content, ticket-style workflows | |
| Kapso WhatsApp | WhatsApp access without direct Meta integration |
| Twilio Media Stream | Real-time phone calls and WebRTC voice streams |
| LiveKit Media Stream | In-process LiveKit WebRTC audio rooms |
| LiveKit Agent Worker | Runtime-bridged LiveKit rooms for auditability |
You can attach multiple channels to the same agent. For example, a support agent might accept WhatsApp from customers and Slack from employees.
What you will configure
Section titled “What you will configure”Each channel requires three things:
- Provider credentials — tokens, webhooks, or API keys stored as secrets, not in the agent spec.
- Channel configuration — the adapter that maps provider payloads to Alquimia Platform’s normalized request shape.
- Response template — how the agent’s answer is formatted before delivery.
Set up the channel
Section titled “Set up the channel”-
Register the provider secrets in the agentspace registry.
-
Create the channel configuration in the agent spec or registry, selecting the adapter for your provider.
-
Configure the provider webhook to point at the runtime’s channel endpoint. The runtime verifies each inbound request using the provider’s signature or token mechanism.
-
Send a test message and confirm that the agent receives it, produces a response, and the response is delivered back to the sender.
-
Check the worklog to verify normalization, identity mapping, and delivery.
Identity and session mapping
Section titled “Identity and session mapping”Channels map provider-specific sender identifiers to stable Alquimia Platform user_id and session_id values. This preserves conversation history when the same person messages again from the same channel. Make sure the mapping is consistent, especially if you have multiple agents sharing a channel.
Response templates
Section titled “Response templates”Templates let you format answers per channel. An email response might include HTML and a signature, while a WhatsApp response should be concise plain text. Templates can reference metadata such as sender name or original message ID, but keep them simple to avoid rendering issues.
Approval handoffs
Section titled “Approval handoffs”When a tool requires human approval, the approval request can be routed back through the same channel the user is already on. This keeps the workflow natural and reduces the risk of spoofed approvals.
Add voice to a channel
Section titled “Add voice to a channel”Voice notes and streaming calls reuse the same channel infrastructure as text messages, but the agent needs an audio adapter to transcribe incoming audio and synthesize outgoing replies.
-
Install the
[leviathan]extra if you use cloud STT/TTS connectors or the self-hosted Triton backends:Terminal window pip install "alquimia-core[leviathan]" -
Register STT and TTS secrets in the agentspace registry (for example,
STT_PROVIDER_API_KEYandTTS_PROVIDER_API_KEY). -
Add the
audiofield to the agent spec, declaring the connectors and modalities:{"audio": {"stt": { "provider_id": "deepgram", "api_key": { "$secretRef": "STT_PROVIDER_API_KEY" } },"tts": {"provider_id": "openai/tts","model": "gpt-4o-mini-tts","voice": "alloy","output_format": "mp3","api_key": { "$secretRef": "TTS_PROVIDER_API_KEY" }},"input_modalities": ["text", "audio"],"output_modalities": ["text", "audio"]}} -
For request/response voice notes, configure a WhatsApp or Kapso channel as usual. Inbound voice notes are transcribed automatically and outbound audio is synthesized when
output_modalitiesincludesaudio. -
For real-time phone calls, add a
streaming_channelsentry withprovider_id: twilio-media-streamand expose the runtime WebSocket endpoint that Twilio can connect to:wss://runtime.example.com/streaming/{assistant_id}/{channel_id}The runtime segments turns with energy-based VAD, evaluates each utterance, and streams assistant replies back as μ-law audio. Per-channel behavior such as the opening
greeting, deterministiccall_policylimits, andvadbarge-in settings are configured in the agent spec’sstreaming_channelsentry. See the streaming channel reference for field details and the Runtime configuration reference for the globalSTREAMING_CHANNEL_*environment variables.Authentication. Twilio does not hold a runtime bearer token, so the runtime verifies Twilio’s own request signature instead. Configure Twilio’s Voice webhook to point at the HTTPS TwiML callback:
https://runtime.example.com/streaming/{assistant_id}/{channel_id}/twimlThe callback validates the
X-Twilio-Signatureheader using the channel’sTWILIO_AUTH_TOKENsecret and checks that theAccountSidmatches the channel’sTWILIO_ACCOUNT_SIDsecret. It then mints a single-use stream ticket (valid forSTREAMING_CHANNEL_TICKET_TTL_SECONDS, default 60 s) bound to the agent, channel, agentspace,CallSid, and the caller number Twilio vouched for. Twilio carries that ticket to the WebSocket in a<Parameter>of thestartevent, so the conversation and any per-user secrets are keyed on the verified phone number. Identity fields inside thestartframe are never trusted.If a reverse proxy rewrites the scheme, host, or path prefix, set
STREAMING_CHANNEL_PUBLIC_BASE_URLto the public URL Twilio requested (for examplehttps://voice.example.com). The runtime usesX-Forwarded-Proto/X-Forwarded-Hostwhen the variable is empty. -
For browser-native live audio, add a
streaming_channelsentry withprovider_id: browser-media-streamand connect the browser directly to:wss://runtime.example.com/live/{assistant_id}/{channel_id}The wire format is a simple JSON envelope carrying base64-encoded PCM s16le 16 kHz mono audio. Send
{"event": "audio", "payload": "<base64 pcm>"}and receive assistant replies in the same envelope. Send{"event": "stop"}to end the session. This endpoint requires a bearer token and is governed by the sameSTREAMING_CHANNEL_*settings as the Twilio path. -
For LiveKit WebRTC audio rooms, add a
streaming_channelsentry withprovider_id: livekit-media-stream:{"provider_id": "livekit-media-stream","channel_id": "livekit-room","api_key": { "$secretRef": "LIVEKIT_API_KEY" },"api_secret": { "$secretRef": "LIVEKIT_API_SECRET" },"livekit_url": "wss://myproject.livekit.cloud","room_name": "support-room","input_sample_rate": 48000,"output_sample_rate": 24000}The adapter owns the LiveKit room connection and provides encode/decode helpers, so the runtime’s streaming session pipeline receives and produces PCM audio as it does for Twilio and browser streams. Provide an
api_key,api_secret,livekit_url, androom_name. Input and output sample rates default to 48000 and 24000 respectively. -
For runtime-bridged LiveKit rooms, deploy the separate LiveKit agent worker alongside the runtime and add a
streaming_channelsentry withprovider_id: livekit-media-streamso the runtime recognizes the channel:{"provider_id": "livekit-media-stream","channel_id": "livekit-worker-room","api_key": { "$secretRef": "LIVEKIT_API_KEY" },"api_secret": { "$secretRef": "LIVEKIT_API_SECRET" },"livekit_url": "wss://myproject.livekit.cloud"}The worker connects to LiveKit as a generic agent, forwards participant audio to the runtime over:
wss://runtime.example.com/live/livekit/{assistant_id}/{channel_id}and returns synthesized speech to the room. Set
LIVEKIT_WORKER_RUNTIME_BRIDGE_ENABLED=trueto persist each turn to the runtime worklog and publish it to the Redis event stream. Use theLIVEKIT_WORKER_*environment variables to configure rate limits, session lifetime, and room selection. See Runtime configuration reference for the full variable list. -
Send a test voice message or call and verify the worklog shows the transcript, the agent response, and the synthesized audio delivery.