How to Connect Claude Code (or Codex) to Slack, Discord, and Telegram Locally — With Zero Cloud Servers

2026-11-24来源 dev.toEnglish
How to Connect Claude Code (or Codex) to Slack, Discord, and Telegram Locally — With Zero Cloud Servers

If you already live inside Claude Code, Codex, OpenCode, or Kimi Code at your desk, it does not take long before you want to ping your agent from your phone or bring it into a team chat.

Most agent-to-IM guides start the same way: rent a VPS, buy a domain for HTTPS webhooks (or keep an ngrok tunnel alive), paste bot tokens and LLM API keys into a .env file, and route every message through a hosted relay. That leaves you maintaining a public endpoint, paying for a second model bill instead of using your existing coding-agent subscription, and sending private chats through someone else's server.

You do not need a server at all. Slack, Discord, and Telegram all provide official outbound bot transports that work from behind home Wi-Fi, NAT, or a corporate firewall.

In this walkthrough, we will connect a local coding agent to all three chat apps at once using Mingle (v0.4.11, MIT open source)—an open-source desktop app and CLI that runs strictly on your machine (127.0.0.1) with zero cloud relay, zero telemetry, and one shared local memory across every chat app.

Why outbound transports eliminate the middleman server

Instead of waiting for chat platforms to POST webhooks to a public URL you host, Mingle opens outbound connections from your computer directly to each platform's official API:

Chat App Official Transport Public URL / ngrok? Key Features
Slack Socket Mode (outbound WebSocket) No Pre-filled App Manifest, threads, reactions, two-way files
Discord Discord Gateway (outbound WebSocket) No Native public threads, reactions, files, owner approval for strangers
Telegram Bot API long polling (outbound HTTPS) No Works behind NAT/firewall, CLI or UI setup, owner approval for strangers

A few security details worth calling out up front (full breakdown on the Mingle security & architecture page):

  • No Mingle backend: Messages travel straight between your computer and Slack, Discord, or Telegram.
  • OS keychain storage: Bot tokens and app secrets live in macOS Keychain, Windows DPAPI, or Linux Secret Service—never in plaintext config files, SQLite, or logs.
  • Local-only control plane: The web console and admin HTTP API bind to 127.0.0.1 only.
  • Reuse your existing harness: Mingle never calls an LLM API itself. It drives whichever local harness you already signed in to—Claude Code, Codex, OpenCode, Kimi Code, plus 10 more via OAR—with zero model markup.

Step 1: Install Mingle and create a local agent

Install the desktop app and CLI (v0.4.11):

macOS / Linux:

curl -fsSL https://github.com/earayu/Mingle/releases/latest/download/install.sh | sh 

Windows (PowerShell):

irm https://github.com/earayu/Mingle/releases/latest/download/install.ps1 | iex 

(macOS builds are Apple-signed and notarized; Windows builds are currently unsigned; Linux also ships .deb and .rpm packages. You can also build from source with Node.js 24 and pnpm from the GitHub repo.)

Launch Mingle and create an agent (for example, Alex), then select your local coding harness—such as Claude Code or Codex. Mingle detects the CLI you already have authenticated on your machine and lets you manage sign-in, updates, and quota right from the console.

Behind a proxy? As of v0.4.11, Mingle supports global HTTP/HTTPS/SOCKS5 proxies under Settings → Network (or via mingle proxy), with automatic OS proxy detection, Keychain-stored credentials, built-in connection testing, and optional proxy env forwarding to harnesses.

Connecting chat apps in Mingle's local console

Step 2: Connect Slack over Socket Mode (zero webhooks)

Slack's Socket Mode lets your machine initiate an outbound WebSocket to Slack—no public callback URL and no ngrok.

  1. In Mingle's local console, open your agent, pick Slack, and click the pre-filled Slack App Manifest link. Permissions, Socket Mode, bot events, and the commands scope are already filled in.
  2. Create the app in your workspace, install it, and copy two values:
    • Bot Token (xoxb-...)
    • App-Level Token (xapp-... with connections:write)
  3. Paste both tokens into Mingle. Mingle validates them locally, saves them in your OS keychain, and connects over Socket Mode.
  4. DM your bot or invite it to a channel, then send the 6-digit claim code shown in Mingle's console to bind ownership.

Once claimed, mentioning your agent in a Slack channel triggers a reaction while it works, and longer tasks reply cleanly under the original Slack thread with full two-way file support (logs, screenshots, diffs). See the dedicated Slack integration guide for details.

Step 3: Connect Discord over the Gateway WebSocket

Discord bots use an outbound Gateway WebSocket by default, so you do not need a VPS to host one.

  1. Open the Discord Developer Portal, create an application, and add a Bot.
  2. Enable Message Content Intent under Bot settings so the agent can read channel messages and thread context.
  3. Generate an invite URL with channel, message, reaction, and public thread permissions, and invite the bot to your server.
  4. Paste the bot token into Mingle. It goes straight into your OS keychain and opens an outbound Gateway session.
  5. Send the 6-digit claim code to claim ownership.

Because Discord bot handles are discoverable, Mingle gates access automatically: any new person or new server waits for your explicit approval in the local console before the agent will run a turn for them. When you give the agent a longer coding or research job in a channel, it opens a native Discord public thread under your message so the main room stays responsive. More details are in the Discord integration guide.

Step 4: Connect Telegram via BotFather long polling

Telegram's Bot API supports outbound HTTPS long polling, which means zero domain setup and zero TLS certificates.

  1. Message @BotFather in Telegram, run /newbot, and copy your bot token.
    • (Tip: if you want the agent to follow group context without @-mentioning it on every message, disable Group Privacy in @BotFather.)
  2. Connect the token either in the Mingle console or straight from your shell:
echo "$TELEGRAM_BOT_TOKEN" | mingle connect alex telegram 
  1. Message your new bot with the 6-digit claim code to become the owner. Just like Discord, unfamiliar users and groups wait for your explicit approval before the agent responds or executes anything on your machine.

Full walkthrough and FAQ: Telegram integration guide.

What changes once all three apps share one local agent

Connecting Slack, Discord, and Telegram to the same Mingle agent is not three isolated bots—it is one local agent with one memory and one long-lived session:

  • Plain-text memory on your disk: Each agent lives in a folder with ROLE.md, MEMORY.md, and notes/. You can discuss a bug in Slack at work, then ask your agent in Telegram on the train home what you decided—it already remembers.
  • Parallel background tasks without blocking: Long jobs fork onto the side (up to 3 concurrent tasks) while quick questions still get answered in seconds, and finished results land back under the original message or thread.
  • Instant kill switch: Sending /stop interrupts an active turn immediately.

Mingle handling parallel background work and replying back in thread

If you want to see how this local-first architecture stacks up against cloud agent platforms, self-hosted VPS webhook bridges, and terminal-only workflows, there is a side-by-side breakdown (plus a 10-channel capability matrix covering iMessage, WeChat, Feishu/Lark, WeCom, DingTalk, QQ, and GitHub) on the Mingle comparison page.

Honest trade-offs (and what if your laptop sleeps?)

Running with zero cloud server comes with one obvious trade-off: when your laptop goes to sleep, the local runtime pauses until it wakes up.

If you want 24/7 uptime without handing your chats to a third-party SaaS relay, Mingle lets you deploy the agent runtime over SSH to your own Linux host directly from the app—still your machine, still zero Mingle server.

Links & next steps

If you try connecting your local Claude Code or Codex setup to Slack, Discord, or Telegram and hit any rough edges with Socket Mode, Discord intents, or proxy config, drop a comment or open an issue on GitHub—feedback on the zero-server architecture is always welcome.

原文:https://www.a8q9.cn/en/article/how-to-connect-claude-code-or-codex-to-slack-discord-and-telegram-locally-with-z-164d9b.html

相关文章