Skip to content

Day 3 · Move In: WeChat / Telegram / Discord / Slack

Get Hermes running inside the messaging app you actually use — WeChat if that’s your daily driver, Telegram otherwise. Finish one main track today and you’ll be able to @ Hermes from your phone and get a reply.


  • Day 2 complete — hermes can hold a conversation in the terminal
  • Choose one platform to start. Not sure which?
    • Daily WeChat user → Track 1 (WeChat)
    • Want the lowest barrier → Track 2 (Telegram)
    • Discord / Slack → scroll down to the Branch sections

Hermes talks in messaging apps through the messaging gateway — a long-running process independent of the hermes CLI. Its job is to translate messages from each platform into conversations Hermes can handle.

┌──────────────┐ ┌────────────────────┐ ┌────────────┐
│ WeChat / │ ←→ │ hermes gateway │ ←→ │ Hermes │
│ Telegram / │ │ (long-running) │ │ core (LLM) │
│ Discord / │ └────────────────────┘ └────────────┘
│ Slack ... │
└──────────────┘

Two things this means:

  1. Closing hermes in the terminal has no effect on the gateway — they’re independent processes.
  2. The gateway must keep running for the bot to stay online. You can run it in the foreground (hermes gateway) or install it as a system service (hermes gateway install).

Track 1: WeChat (primary for China · 30–45 min)

Section titled “Track 1: WeChat (primary for China · 30–45 min)”

The WeChat adapter needs two extra Python packages:

Terminal window
pip install aiohttp cryptography
# For QR code rendering directly in the terminal (recommended):
pip install "hermes-agent[messaging]"

Step 2: Run the setup wizard and scan to log in

Section titled “Step 2: Run the setup wizard and scan to log in”
Terminal window
hermes gateway setup

Select Weixin when the wizard asks for a platform. Then:

  1. The terminal shows a QR code (if you installed hermes-agent[messaging]), or gives you an image path
  2. Scan the QR code with your phone’s WeChat
  3. Tap “Confirm login” on your phone
  4. The wizard writes account_id, token, and base_url to ~/.hermes/.env; credentials land in ~/.hermes/weixin/accounts/ (plaintext — don’t commit to git)

After the wizard finishes, .env will look like:

Terminal window
WEIXIN_ACCOUNT_ID=xxxxxxxx
WEIXIN_TOKEN=xxxxxxxxxxxxxxxxxxxxxx
WEIXIN_DM_POLICY=pairing
WEIXIN_HOME_CHANNEL= # fill in if you want to send proactive notifications

The default at first login is dm_policy=pairing (anyone can DM and go through the pairing flow). For daily use, switch to allowlist so only you and specific people can chat:

~/.hermes/.env
WEIXIN_DM_POLICY=allowlist
WEIXIN_ALLOWED_USERS=wxid_xxxxxxxxxxxx # your own WeChat wxid

Don’t know your wxid? Start the gateway and send the bot a message. The logs print the sender’s wxid — copy it and paste it back.

Terminal window
hermes gateway

A log line like this means it’s working:

gateway online · weixin connected · account=xxxx · long-poll=35s

Open your bot’s WeChat account on your phone (or open a DM with it) and send:

Hello, what time is it?

The bot should reply with the current time. If there’s no response, check the Troubleshooting section below.

Section titled “Step 6: Install as a background service (recommended)”

Running in the foreground is fine for testing. For 24/7 uptime:

Terminal window
hermes gateway install
hermes gateway start
hermes gateway status

CapabilityNotes
Images / video / files / voiceAll supported. Tencent CDN’s AES-128-ECB encryption is decrypted automatically by the gateway
Single message lengthUp to 4000 characters; longer messages are split at natural boundaries
Markdown linksThe gateway renders [text](url) as a tappable reference card in WeChat
Proactive pushSet WEIXIN_HOME_CHANNEL to push messages from cron jobs or scheduled tasks to that conversation

If you’re connecting WeCom (enterprise WeChat) rather than personal WeChat, the path is different:

DimensionPersonal WeChat (Weixin)Enterprise WeChat (WeCom)
Adapterweixin (iLink Bot)wecom
TransportHTTP long-pollingWebSocket long connection
CredentialsQR code login, stateful tokenCreate an AI Bot in the admin portal, get BOT_ID / SECRET
Group chat defaultdisabledopen (enterprise context expects it)
EncryptionAES-128-ECBAES-256-CBC

Setup is the same: hermes gateway setup, then select WeCom. The .env changes to:

Terminal window
WECOM_BOT_ID=your-bot-id
WECOM_SECRET=your-secret

Full steps: official WeCom docs.


  1. Register a bot with BotFather

    Search for @BotFather in Telegram or open t.me/BotFather, then send:

    /newbot
    Hermes Agent ← display name (anything)
    my_hermes_bot ← username (must end in "bot", globally unique)

    BotFather returns a token like 123456789:ABCdef.... This is your bot’s password — treat it like a secret key.

  2. Find your Telegram user ID

    The gateway allowlist uses your numeric user ID, not your username. Search for @userinfobot in Telegram, send any message, and it returns your ID (e.g. 987654321).

  3. Run the configuration wizard

    Back in the terminal:

    Terminal window
    hermes gateway setup

    The wizard asks: which platform (select Telegram) → paste the token → paste the allowed user ID. It writes to ~/.hermes/.env automatically:

    Terminal window
    TELEGRAM_BOT_TOKEN=123456789:ABCdef...
    TELEGRAM_ALLOWED_USERS=987654321
  4. Start the gateway (foreground)

    Terminal window
    hermes gateway

    A log line like gateway online · telegram connected means it’s working. Don’t close this terminal — closing it takes the bot offline.

  5. Chat in Telegram

    Open the bot you just created (the BotFather response includes a t.me/xxx link), tap Start, then send:

    Hello, what time is it?

    Expected response: the bot replies with the current time and mentions it used the terminal tool to check.

  6. Install as a background service (optional but recommended)

    Same commands as WeChat Track Step 6: hermes gateway install && hermes gateway start.

Telegram group chats: privacy mode and @mentions

Section titled “Telegram group chats: privacy mode and @mentions”

After adding your bot to a group, it will not see most messages by default — this is Telegram’s privacy mode: the bot can only see / commands, direct replies to its messages, and messages that @mention it.

Two options:

OptionHowEffect
Keep privacy mode (recommended)Leave the setting alone; trigger with @my_hermes_bot questionBot only responds when @mentioned — no spam
Disable privacy modeBotFather → /mybots → Bot Settings → Group Privacy → Turn off, then kick and re-add the botBot sees all messages. Combine with require_mention: true to avoid random replies

After disabling privacy mode, use this ~/.hermes/config.yaml snippet to limit responses:

telegram:
require_mention: true
mention_patterns:
- "^\\s*hermes\\b" # also trigger on "hermes" without @

  1. Create an Application + Bot: Discord Developer Portal → New Application → Bot (sidebar) → Reset Token (shown only once — copy it immediately).

  2. Enable two Privileged Intents (90% of “bot doesn’t reply” issues come from missing these):

    • Server Members Intent
    • Message Content Intent ← without this, the bot receives message events but the text is empty
  3. Invite the bot to your server using the recommended permissions integer 274878286912 (send messages, read history, attach files, add reactions, etc.):

    https://discord.com/oauth2/authorize?client_id=YOUR_APP_ID&scope=bot+applications.commands&permissions=274878286912
  4. Find your user ID: Discord Settings → Advanced → enable Developer Mode → right-click your name → Copy User ID.

  5. .env entries needed:

    Terminal window
    DISCORD_BOT_TOKEN=...
    DISCORD_ALLOWED_USERS=your_user_id
  6. Run hermes gateway setup and select Discord, or start directly with hermes gateway.


Create an app at api.slack.com/apps, then:

StepKey point
OAuth & PermissionsAdd at minimum: chat:write, app_mentions:read, channels:history, im:history, im:write, users:read, files:read, files:write
Socket ModeEnable the toggle, generate an App-Level Token (starts with xapp-)
Event SubscriptionsSubscribe to message.im, message.channels, app_mention90% of “bot doesn’t respond” issues are a missing subscription here
Install to WorkspaceGenerates the Bot Token (starts with xoxb-)

Write both tokens to ~/.hermes/.env:

Terminal window
SLACK_BOT_TOKEN=xoxb-...
SLACK_APP_TOKEN=xapp-...
SLACK_ALLOWED_USERS=U01XXXXX # Slack user ID, not username

Finally, run /invite @Hermes Agent in the target channel — without this, the bot won’t see that channel’s messages.


Regardless of platform, completion looks like:

$ hermes gateway status
● gateway: running
● weixin: connected # or telegram / discord / slack
● session: ready

Then in your chosen messaging app:

You: @Hermes Which is larger: 9.8 or 9.11?
Hermes: 9.8 is larger. Since 9.8 = 9.80 and 9.11 = 9.11, we have 9.80 > 9.11.