// CONTENTS Part 07 · Channels

// PART 07

Webhooks and delivery

Chapter 32 / 56 2 min read English Part 07 of 14

Inbound Channel Webhooks

Chat platforms deliver messages by posting to the bot server from their own infrastructure, with no token of ours to present. Three registrations are required for every such route, and missing any one of them makes the channel silently unreachable:

  1. an anonymous auth path (the middleware otherwise answers 401),
  2. a CSRF exemption (external POSTs cannot carry a CSRF token),
  3. an anonymous RBAC route permission (an unmatched /api/... path is denied outright).

The routes, their handlers and the documented credential resolution are:

Channel Inbound route Handler auth
Telegram POST /webhook/telegram optional telegram-webhook-secret (X-Telegram-Bot-Api-Secret-Token)
Teams POST /api/msteams/messages Bot Framework JWT (Authorization: Bearer) or outgoing-webhook HMAC
Instagram GET/POST /api/instagram/webhook verification token (hub.verify_token) + payload signature
WhatsApp GET/POST /api/whatsapp/webhook Meta verify token (hub.verify_token) on GET, X-Hub-Signature-256 on POST

Channels addressed directly (outside /api) also need a proxy route in the UI server, which is what /webhook/*path provides.

WhatsApp’s signature gate fails closed: without the app secret (whatsapp-app-secret / whatsapp_app_secret) resolved from the Vault-first path, signed deliveries are rejected rather than accepted unverified (#2113).

Outbound delivery

Replies do not stream to channels. The turn’s output is buffered and handed to the adapter’s send path:

  • WhatsApp — one text message per 4096-byte part (message_processing.rs, utils.rs).
  • Teams — one activity posted back to the service URL.
  • Telegram / Instagram — plain text sends.

main_module/event_dispatcher.rs and channel_delivery.rs are the fan-out point for outbound events; adapters register their send capability there rather than calling platform APIs from pipeline code.

Auto-Managed Services

The following services take their credentials from Vault at boot; the Directory service (Zitadel) is identity only.

Service Managed by
PostgreSQL secret/gbo/tables in Vault
S3-Compatible Storage secret/gbo/drive in Vault (backends)
Cache secret/gbo/cache in Vault
Stalwart Email secret/gbo/email in Vault; user accounts in Zitadel

You do not need to configure these services manually; the installer writes the secrets and botserver reads them at boot.

Checklist for a new inbound webhook

Step Why
Register the route in the router setup otherwise it 404s
Add the anonymous auth path the middleware default is 401
Add the CSRF exemption external POSTs cannot carry our CSRF token
Add the anonymous RBAC permission unmatched /api/... paths are denied
Verify the credential gate fail closed — signature/verify-token checks must reject, not warn
Test from the platform’s side a local curl is not the same origin path the platform uses

Found a mistake? Open an issue · All books

// SEARCH ESC
Pagefind · 236 pages · 4 books Enter to open ↑ ↓ to move