How to Manage Adapters
Adapters connect GSV processes to external messaging systems such as WhatsApp, Discord, and Telegram. The deployed channel Workers host protocol-specific code; the Kernel sees them through adapter.* syscalls and linked external actors.
Deploy Adapter Workers
Deploy adapter components with infrastructure commands:
gsv infra deploy -c channel-whatsapp
gsv infra deploy -c channel-discord --discord-bot-token "$DISCORD_BOT_TOKEN"
gsv infra deploy -c channel-telegram --telegram-bot-token "$TELEGRAM_BOT_TOKEN"If your GSV was deployed with a named instance, pass the same instance name or set GSV_INSTANCE:
gsv infra deploy --instance gsv-work -c channel-whatsappWhen adding Telegram to an existing installation, deploy or upgrade the gateway at the same time so it has the CHANNEL_TELEGRAM service binding:
gsv infra deploy -c gateway -c channel-telegram --telegram-bot-token "$TELEGRAM_BOT_TOKEN"If you deploy all components, all adapter Workers are included:
gsv infra deploy --allConnect WhatsApp
Start or reconnect a WhatsApp account:
gsv adapter connect --adapter whatsapp --account-id personal --config-json '{"force":true}'When WhatsApp needs pairing, the CLI prints a QR challenge. Scan it from WhatsApp: Settings, Linked Devices, Link a Device.
Check and disconnect:
gsv adapter status --adapter whatsapp --account-id personal
gsv adapter disconnect --adapter whatsapp --account-id personalConnect Discord
Discord needs a bot token. You can provide it during deploy as a Worker secret, or pass it when connecting:
gsv adapter connect --adapter discord --account-id default \
--config-json '{"botToken":"<discord-bot-token>"}'If the token is already configured as DISCORD_BOT_TOKEN, omit --config-json:
gsv adapter connect --adapter discord --account-id default
gsv adapter status --adapter discordInvite the bot with the permissions required by your deployment and enable the Discord Message Content Intent when the bot needs to read message text.
Connect Telegram
Telegram needs a bot token from BotFather. You can provide it during deploy as a Worker secret, or pass it when connecting:
gsv adapter connect --adapter telegram --account-id default \
--config-json '{"botToken":"<telegram-bot-token>"}'If the token is already configured as TELEGRAM_BOT_TOKEN, omit --config-json:
gsv adapter connect --adapter telegram --account-id default
gsv adapter status --adapter telegramThe deploy command configures TELEGRAM_WEBHOOK_BASE_URL from the worker's workers.dev URL. If you use a custom domain, pass webhookBaseUrl in --config-json when connecting.
Link External Actors
Inbound messages are not delivered to processes until the external actor is linked to a GSV user.
For direct messages, an unlinked actor receives a challenge:
Link your account by running: gsv auth link CODERun that command as the target user:
gsv auth link CODERoot can link manually when the adapter, account, and actor id are known:
gsv auth link --adapter discord --account-id default --actor-id discord:user:123456 --uid 1000
gsv auth link --adapter telegram --account-id default --actor-id telegram:user:123456 --uid 1000
gsv auth link --adapter whatsapp --account-id personal --actor-id wa:jid:31600000000@s.whatsapp.net --uid 1000Inspect and remove links:
gsv auth link-list
gsv auth unlink --adapter discord --account-id default --actor-id discord:user:123456How Messages Route
- The adapter Worker receives a platform message.
- The Worker calls the Kernel with
adapter.inboundusing a service identity. - The Kernel resolves the adapter/account/actor link to a local uid.
- The message is delivered to the surface-routed process or
init:{uid}. - The Process DO runs the agent loop and emits
proc.run.*signals. - The Kernel sends replies back through
adapter.send.
Pending human-in-the-loop approvals can be approved or denied from a linked DM surface. Non-DM messages from unlinked actors are dropped.
Troubleshooting
- If
adapter.connectfails, verify the channel Worker was deployed and the Gateway has the correct service binding. - If WhatsApp does not show a QR code, reconnect with
{"force":true}. - If Discord does not respond, check the bot token, gateway status, invite permissions, and Message Content Intent.
- If Telegram does not respond, check the bot token, webhook base URL secret, and that Telegram can reach the worker's public
/webhook/:accountIdURL. - If a message is ignored, check
gsv auth link-listand confirm the actor id is linked to the intended user.