Skip to main content

Channel Setup

Loong keeps channel setup explicit so operators can tell what is actually shipped, what is gateway-supervised, what stays on a standalone native serve loop, what is bridge-owned, what is outbound-only, and what still depends on future runtime work. Use this page when you want the practical setup contract. If you want step-by-step smoke tests and worked examples instead, start with Channel Guides for the exact per-surface contract, then keep Channel Recipes for representative rollout patterns. If you want the shared public config shape before the per-surface setup rules, start with Configuration Patterns. If you specifically need the longer-lived owner model, foreground versus headless supervision, or --channel-account selectors, continue to Gateway And Supervision.

Canonical Channel Command Story

Public docs now use grouped channel shells first:
  • generic sends: loong channels send <surface> ...
  • generic serve loops: loong channels serve <surface> ...
  • richer family namespaces stay first-class when they expose more than thin wrappers, but the canonical channel contract still uses loong channels send <surface> and loong channels serve <surface>

Start With The Right Question

If you need…Start with…
a local assistant onlyonboard, ask, chat, and doctor
inbound or reply-loop automation that should join gateway run laterone shipped gateway-supervised service channel
one built-in serve loop that should stay on its own command for nowone standalone native-serve surface
a real channel contract whose login/runtime stays in an external bridgeone plugin-backed bridge surface
proactive delivery without a reply loopone outbound-only surface
the shared account and selector config shape firstConfiguration Patterns
multiple reply-loop surfaces on one hostGateway And Supervision
the full source-level field contract behind this pagethe repository-native Channel Setup spec

Readiness Rules

Before any channel is really ready:
  • the base CLI path should already work locally
  • provider credentials should already be healthy
  • channel-specific credentials should already resolve
  • the surface should be described truthfully as gateway-supervised, standalone native-serve, plugin-backed, or outbound-only
  • setup should point to a concrete operator path instead of a vague support claim

Common Rollout Shapes

SituationBest first moveWhy
one Feishu or Lark app should own inbound automationconfigure feishu and run loong channels serve feishuthe Feishu family is the shipped runtime lane for both Feishu and Lark
one Telegram bot should own a reply loopconfigure telegram and run loong channels serve telegramthis is the simplest runtime-backed bot lane
one Matrix bot should own a room sync loopconfigure matrix and run loong channels serve matrixthe homeserver, room ids, and sync boundary stay explicit
one WhatsApp Cloud API business account should own a reply loopconfigure whatsapp and run loong channels serve whatsappsend and serve are both shipped on the verified webhook path
one WeCom bot should own the official long connectionconfigure wecom and run loong channels serve wecomthis matches the shipped AIBot contract
one LINE or generic webhook lane should use a real built-in serve loop without gateway supervision yetconfigure the standalone native-serve block and run loong channels serve <surface> --bind ...the runtime is real, but the owner is still the direct grouped serve command
one WeChat / QQ / OneBot / personal WhatsApp bridge should stay external but visibleconfigure the plugin-backed channel block and run loong doctor plus loong channelsbridge-owned surfaces are real but should not pretend the gateway already owns the upstream login stack
you need several accounts in one channel familyadd default_account plus accounts.<id> before adding gateway selectorsstable account ids make later supervision and routing legible
you only need governed direct sendsconfigure one outbound-only surface and use loong channels send <surface>this avoids pretending a reply loop already ships

Gateway-Supervised Service Channels

These are the shipped reply-loop surfaces that can join gateway run or gateway run today.
SurfaceWhat you configure firstRun loop
Feishu / Larkapp credentials, trusted chats, and the selected inbound transportloong channels serve feishu
Telegrambot token and trusted chat idsloong channels serve telegram
Matrixhomeserver base URL, access token, and trusted room idsloong channels serve matrix
QQ Botapp id, client secret, and trusted peer idsloong channels serve qqbot
WhatsApp Cloud APICloud API credentials plus verified webhook materialloong channels serve whatsapp
WeCombot id, secret, and trusted conversation idsloong channels serve wecom

Standalone Native-Serve Surfaces

These surfaces ship real built-in serve loops, but the runtime still stays on the direct channels serve <surface> command instead of gateway supervision.
SurfaceWhat you configure firstRun loop
LINEchannel access token, channel secret, and a chosen local bind addressloong channels serve line --bind <HOST:PORT>
Webhooksigning secret plus a chosen local bind addressloong channels serve webhook --bind <HOST:PORT>

Plugin-Backed Bridge Surfaces

These surfaces are shipped as real channel contracts, but the listener, login, and upstream session lifecycle stay in an external bridge or managed plugin.
SurfaceWhat you configure firstCurrent operator path
Weixinweixin.enabled, bridge_url, bridge_access_token, allowed_contact_idsloong weixin onboard, loong doctor, loong channels, loong channels send weixin, loong channels serve weixin, managed bridge discovery
OneBotonebot.enabled, websocket_url, access_token, allowed_group_idsloong doctor, loong channels, loong channels send onebot, loong channels serve onebot, managed bridge discovery
WhatsApp Personalwhatsapp_personal.enabled, bridge_url, auth_dir, allowed_chat_idsloong whatsapp-personal bridge run, loong doctor, loong channels, loong channels send whatsapp-personal, loong channels serve whatsapp-personal, managed bridge discovery
Operational rule:
  • these surfaces are actionable and operator-visible today
  • they do not join gateway run or gateway run because their runtime owner is still the external bridge
  • the important setup milestone is a passing contract + discovery result, not a native runtime loop that does not exist yet
  • managed bridge command execution also requires [runtime_plugins].enabled = true plus one or more runtime_plugins.roots
  • grouped channels serve <surface> flows retry transient managed bridge runtime failures locally with bounded backoff before surfacing a hard failure
  • retry/failure metadata is surfaced through loong doctor and loong channels, so operators can see when a bridge is actively retrying instead of guessing from stderr

Multi-Account Rule

  • use default_account when one account should be the normal default lane
  • use accounts.<id> when one config should hold prod, backup, or environment-specific credentials
  • keep shared defaults at the top level and override only account-specific secrets or allowlists
  • feishu is the canonical config block for the Feishu family, while lark remains an accepted operator-facing alias in selectors and references
  • gateway selectors should target those configured accounts.<id> values rather than ad-hoc names invented at command time

Feishu / Lark

Feishu supports two inbound transport shapes:
  • webhook mode
  • websocket mode
Publicly that means:
  • both modes need the base app credentials and trusted-chat boundary
  • webhook mode also needs the webhook verification material
  • websocket mode should not be documented as if webhook-only secrets are mandatory
  • loong channels send feishu and loong channels serve feishu are the canonical first-class shipped channel commands

Telegram

Telegram remains the simplest shipped bot lane:
  • enable the channel
  • provide one bot token
  • allowlist trusted chat ids
  • use loong channels serve telegram for reply-loop automation
  • use loong channels send telegram for direct proactive sends

Matrix

Matrix is a sync-loop surface:
  • configure the homeserver URL and access token
  • allowlist trusted room ids
  • use loong channels send matrix for direct room delivery
  • use loong channels serve matrix for the reply loop

WhatsApp Cloud API

The current WhatsApp business lane is a Cloud API plus verified webhook runtime surface:
  • configure access_token and phone_number_id for direct sends
  • configure verify_token and app_secret for the webhook-backed serve path
  • use loong channels send whatsapp for proactive sends
  • use loong channels serve whatsapp for the reply loop
  • keep webhook_bind and webhook_path explicit so the callback owner is legible
  • keep this Cloud API credential flow separate from the QR-linked WhatsApp Personal path so operators can tell whether they need Meta business credentials or a scan-to-link setup

WeCom

WeCom is documented as the official AIBot long-connection lane:
  • configure bot_id and secret
  • allowlist trusted conversation ids
  • use loong channels serve wecom for the long-lived reply loop
  • use loong channels send wecom for proactive sends
Loong should not describe a WeCom webhook callback mode as if it were the same shipped contract.

Weixin

Weixin is a bridge-first surface:
  • start with loong weixin onboard when you want Loong to request the iLink QR code and save the resulting bridge_url plus bridge_access_token for you
  • configure bridge_url plus bridge_access_token
  • keep allowed_contact_ids explicit because the bridge contract should stay narrow
  • optional managed_bridge_plugin_id is the tie-breaker when several compatible managed bridges are installed
  • use loong doctor to verify the configured contract and the selected managed bridge
  • use loong channels or loong channels --json to inspect stable targets and discovery state
  • use loong channels send weixin --target contact:<id> or loong channels send weixin --target weixin:<account>:room:<id> for proactive sends
  • use loong channels serve weixin to run the selected managed bridge reply loop under Loong supervision
  • use loong channels serve weixin --stop to request cooperative shutdown for the selected managed bridge runtime owner
  • Loong automatically asks older duplicate owners to stop when it can identify one clear preferred runtime owner
  • use loong channels serve weixin --stop-duplicates as the operator fallback when duplicate live owners persist and you want Loong to keep the preferred runtime owner while requesting cooperative shutdown for the older duplicates

QQ Bot

QQ Bot is the explicit Tencent gateway runtime lane:
  • configure app_id plus client_secret
  • use allowed_peer_ids to keep the trusted conversation boundary explicit
  • keep openids and account ids stable so direct, group, and guild routes do not drift between bridge implementations
  • use loong channels send qqbot --target c2c:<openid>, group:<openid>, or channel:<id> for proactive sends
  • use loong channels serve qqbot to run the native QQ gateway reply loop under Loong supervision

OneBot

OneBot is the protocol-level bridge lane:
  • configure websocket_url plus access_token
  • keep allowed_group_ids explicit so the bridge contract stays narrow
  • use it when the upstream bridge already speaks OneBot v11 and you want Loong to own the stable surface id and target contract
  • verify bridge discovery through loong doctor before you treat the surface as ready
  • use loong channels send onebot --target private:<user_id> or loong channels send onebot --target group:<group_id> for proactive sends
  • use loong channels serve onebot to run the selected managed bridge reply loop under Loong supervision
  • use loong channels serve onebot --stop to request cooperative shutdown for the selected managed bridge runtime owner
  • Loong automatically asks older duplicate owners to stop when it can identify one clear preferred runtime owner
  • use loong channels serve onebot --stop-duplicates as the operator fallback to clean up duplicate live runtime owners without fully draining the preferred owner

Outbound-Only Surfaces

These surfaces ship direct-send behavior, config validation, and inventory metadata without claiming a full reply-loop runtime.
Surface familyCurrent examplesPrimary command shape
chat and workplace platformsDiscord, Slack, DingTalk, Microsoft Teams, Mattermost, Google Chatloong channels send <surface>
messaging and communication bridgesSignal, IRC, iMessage / BlueBubbles, Nostrloong channels send <surface>
generic or self-hosted deliveryEmail, Nextcloud Talk, Synology Chat, Tlonloong channels send <surface>
community-facing outbound integrationsTwitch and similar outbound-only integrationsloong channels send <surface>

Outbound HTTP Trust Rules

For HTTP-backed outbound delivery:
  • URLs should use http or https
  • credentials should not be embedded in the URL itself
  • private or special-use hosts are blocked by default
  • redirects are not followed automatically
If an operator intentionally targets a private bridge or self-hosted endpoint, the runtime can widen that boundary explicitly instead of silently assuming it.

Gateway And Multi-Channel Ownership

When you move beyond one local surface:
  • gateway run, gateway status, and gateway stop are the explicit owner contract
  • gateway run is the compatibility wrapper for the shipped gateway-supervised subset
  • standalone native-serve surfaces use their own channels serve <surface> loop instead of joining the same reply-loop runtime contract
  • plugin-backed surfaces are inspected through doctor and channels, not supervised through the same reply-loop runtime contract
  • outbound-only surfaces should not be described as if they are supervised by the same reply-loop runtime contract
  • the detailed command model, selector syntax, and recovery loop live in Gateway And Supervision
  1. Get the local assistant path healthy first.
  2. Add one gateway-supervised service channel if you need the shortest path into gateway run or gateway run.
  3. Add one standalone native-serve surface when you need a real built-in channels serve <surface> loop without gateway supervision yet.
  4. Add one plugin-backed bridge surface when the ecosystem is real but the runtime owner should stay external.
  5. Add outbound-only surfaces when you need governed direct sends.
  6. Reach for gateway and gateway run only after one gateway-supervised channel already works cleanly.

Deep References

  • Continue to Channel Guides for the full actionable channel matrix.
  • Continue to Channel Recipes for tutorial-style demos built on top of this setup contract.
  • Continue to Channels for the conceptual public-surface model.
  • Continue to Gateway And Supervision for the current runtime owner contract and multi-channel selection rules.
  • Continue to Use Loong for the broader operator-facing runtime contract.
  • The repository still keeps the full field-level source spec in Channel Setup.