// PART 07
Channel model
A channel is an adapter between an external messaging platform and the same bot pipeline the web chat uses. This page defines the model: where adapters live, what they must implement, and how outbound delivery works.
The model
external platform ──POST webhook──▶ botserver route
│ normalize (adapter crate)
▼
bot pipeline (same as /ws)
│
buffered turn output
▼
adapter send path ──API call──▶ external platform
Inbound: the platform posts to a webhook route; the adapter normalizes the
payload (process_incoming_message) and the content runs through the normal
pipeline. Outbound: the turn’s output is buffered and delivered as plain
messages through the adapter’s send path — the rich suite features
(suggestions, streaming, tool buttons) are web-chat-only unless an adapter
explicitly supports them.
Where channels live
| Concern | Code |
|---|---|
| Channel crates | botwhatsapp, bottelegram, botmsteams, botinstagram, botchannels, botchannels-core (OAuth + media upload), botchannelbindings (per-bot identities, call logs) |
| Host modules | botserver/src/whatsapp/, feature crates’ own route/lib files |
| Outbound fan-out | main_module/event_dispatcher.rs, channel_delivery.rs |
| Web chat (the reference channel) | botserver/src/core/bot/ws/ |
Capability matrix (what adapters actually do)
| Capability | Teams | Web chat | |
|---|---|---|---|
| Inbound text | ✅ | ✅ | ✅ |
| Inbound media | ✅ (stored to Drive inbox/) |
✅ | ✅ |
| Outbound text | ✅ (4096-byte parts) | ✅ (activities) | ✅ |
| Outbound rich cards / buttons | ❌ | ❌ | ✅ |
| Suggestions | ❌ (supports_suggestions() = false) |
❌ | ✅ |
| Streaming | ❌ (supports_streaming() = false) |
❌ | ✅ |
The lesson: a channel adapter is honest about what it supports. When you add one, decide explicitly per capability and encode it in the supports_* methods rather than silently degrading.
Credentials
Channel credentials resolve Vault-first with dashed config.csv keys as
the documented fallback for non-sensitive values. The Drive monitor drops
sensitive keys from config.csv, which is only the home of non-sensitive
settings. Per-channel key tables are in the channel pages (WhatsApp, Teams,
Instagram).
Infrastructure services (PostgreSQL, storage, cache) take their credentials from Vault at boot; the Directory service (Zitadel) is identity only and provisions no storage.
Adding a channel
- Adapter crate — normalize inbound payloads; implement the send path; declare supports_* capabilities honestly.
- Route — register the inbound webhook with the three mandatory registrations (anonymous auth path, CSRF exemption, anonymous RBAC permission) — see Webhooks and delivery.
- Credentials — dashed config keys + Vault fields; fail closed with a clear log line when a required credential is absent (the Teams adapter’s “not configured” refusal is the pattern).
- Delivery — wire the outbound path into
channel_delivery.rs. - Tests — adapter unit tests in the crate; the webhook trio is verified by the security tests, not by hand.
What is not a channel
The sandbox exec endpoint, MCP servers and the API command catalog are integrations, not channels: no platform identity, no webhook, no delivery path. If it does not deliver messages to humans on an external network, it does not belong in Part 7.