Skip to main content

Adding Channel Adapters

Add a channel adapter when a messaging platform can deliver user messages into the resident gateway and receive replies back through the same platform.

Adapter Interface

Adapters implement channels.Adapter. Optional interfaces add polling, lifecycle, webhook routes, typing, status, acknowledgements, and outbound media.

Factories implement channels.Factory and are registered with the channel registry during runtime assembly.

Inbound Events

Inbound platform events become protocol.ChannelInbound. Include channel name, account, identity, external peer/thread IDs, text, attachments, timestamps, and metadata needed for delivery.

Do not call the model from an adapter. Submit inbound work to the gateway.

Delivery

Outbound delivery receives protocol.ChannelOutbound from gateway/runtime. Keep platform retry/backoff and message-size chunking inside the adapter.

Delivery status should be reflected through channel status, audit, and errors without leaking tokens.

Media Attachments

Inbound media should be staged as artifacts with bounded size and safe download rules. Outbound media requires MediaOutboundAdapter and explicit supported kinds.

Do not fetch private/internal URLs unless the platform API and media guard make that safe.

Access Policy

Use channel config for dm_policy, group_policy, allow_from, and allow_groups where the platform supports them.

Access policy is channel-level authorization. It does not change profile, provider, tool, or filesystem permissions.

Doctor Checks

Add setup templates, secret ref checks, channel doctor coverage, redacted config views, and live-smoke tests where a safe live target exists.

Doctor should validate local readiness. Live tests must stay behind explicit environment gates.