Messaging channel bridge for OpenCode. Control your AI coding session from Discord, Slack, or Telegram.
- Send prompts to OpenCode from your messaging channel, get AI responses in real-time
- Real-time streaming — watch AI responses update live in the channel
- Slash commands — control sessions from the channel (
/status,/sessions,/abort, etc.) - Permission requests — approve/deny AI actions directly from the channel
- File attachments — send files to OpenCode from the channel
- Session management — auto-pairs with active session, or creates a new one
npx opencode-linkThe interactive setup wizard will guide you through selecting a provider and entering credentials. Then:
opencodeSend a message in your channel to start a session.
- Go to Discord Developer Portal
- Click New Application → name it → Create
- Go to Bot → click Reset Token → copy the token (
botToken) - Enable Message Content Intent (Bot → Privileged Gateway Intents)
- Go to OAuth2 → URL Generator:
- Scopes:
bot - Permissions:
Send Messages,Send Messages in Threads,Read Message History,Use Slash Commands
- Scopes:
- Open the generated URL → invite the bot to your server
Enable Developer Mode: Discord Settings → Advanced → Developer Mode. Right-click the target channel → Copy Channel ID (channelId).
npx opencode-linkSelect Discord, enter your Bot Token and Channel ID.
- Log in to your Slack workspace at slack.com
- Go to api.slack.com/apps → Create New App
- Choose From scratch (or From a manifest)
- Name the app and select your workspace
- Go to Basic Information → scroll to App-Level Tokens
- Click Generate Token and Scopes
- Name it (e.g. "socket") → add
connections:writescope → Generate - Copy the
xapp-...token (appToken)
- Go to OAuth & Permissions → Bot Token Scopes → add:
chat:writechat:write.publiccommandschannels:history(for public channels)groups:history(for private channels)
- Click Install to Workspace → authorize
- Copy the
xoxb-...Bot User OAuth Token (botToken)
- Go to Event Subscriptions → toggle Enable Events ON
- Under Subscribe to bot events → add:
message.channels(public channels)message.groups(private channels)
- Important: After adding scopes/events, go back to OAuth & Permissions → reinstall your app
- Go to Slash Commands → Create New Command
- Command:
/opencode→ Request URL: any placeholder (Socket Mode doesn't use it) - Save
In the target channel, run:
/invite @your-bot-name
npx opencode-linkSelect Slack, enter your Bot Token (xoxb-...), App-Level Token (xapp-...), and Channel ID.
How to get the Channel ID
Right-click the channel name in Slack → Copy Link. The ID is the last part of the URL, e.g. C0ABC123DEF. Alternatively, right-click the channel → Open channel details → scroll to the bottom.
- Open Telegram → search for @BotFather
- Send
/newbot→ follow the prompts to name your bot - Copy the provided bot token (
botToken)
- Add the bot to your group or open a direct message with it
- Send a message to the bot/group
- Visit:
https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates - Find
"chat":{"id": ...}in the response — that's yourchannelId
npx opencode-linkSelect Telegram, enter your Bot Token and Chat ID.
When OpenCode needs approval for an action, interactive buttons appear in the channel:
- Accept — allow once
- Accept Always — allow permanently
- Deny — reject (auto-denied after 5 minutes)
Config is stored in .opencode/opencode-link.json:
{
"provider": "discord",
"botToken": "your-bot-token",
"channelId": "your-channel-id"
}For Slack, an additional field is required:
{
"provider": "slack",
"botToken": "xoxb-...",
"appToken": "xapp-...",
"channelId": "C0..."
}This file is auto-added to .gitignore.
npm run build # Build once
npm run dev # Watch mode (auto-rebuild on changes)
npm run test # Run tests
npm run setup:dev # Set up local dev environmentMIT