Hermes Agent 9 min read

Hermes Agent Telegram Setup: Bot Token, Groups and Fixes

Connect Hermes Agent to Telegram in 5 steps: create the bot, add the token, reply in groups and topics, send cron results and fix the 409 conflict.

Shabnam Katoch

Shabnam Katoch

Growth Head

Hermes Agent Telegram Setup: Bot Token, Groups and Fixes
Lifetime deal

Your agent. Working. Not broken.

One AI agent that just works.

Pay once, use it for life. Bring your own API key, zero markup.

Get lifetime access

One-time payment · No subscriptions · No Docker

To connect Hermes Agent to Telegram, create a bot with @BotFather, add its token and your numeric user ID to ~/.hermes/.env, and start the gateway. Groups need one more Telegram setting. Here are the five steps, then the details and fixes.

Commands checked against the Hermes docs for v0.23.1 (released 9 November 2026).

If the bot answers in your DM but not in a group, the cause is almost always one of three gates a group message must pass before Hermes replies. Only one of them lives in Hermes. We cover the setup first, then each gate.

Create the bot and get the token

Create a bot in BotFather: send /newbot, pick a display name, then a username ending in bot — BotFather replies with the token

In Telegram, open @BotFather, send /newbot, pick a display name, then a username that ends in bot. BotFather replies with a token that looks like 123456789:ABCdefGHIjklMNOpqrSTUvwxYZ.

Treat that token like a password. Anyone who has it controls your bot, and /revoke in BotFather kills it instantly.

You also need your numeric Telegram user ID, not your @username. Message @userinfobot and it replies with a number like 123456789.

Connect Hermes to the bot

Connect Hermes to the Telegram bot: add the token and your numeric user ID to ~/.hermes/.env, then run hermes gateway run to test

You have two options. The wizard asks for the token and user IDs and writes them for you:

hermes gateway setup

Or add them to ~/.hermes/.env yourself:

TELEGRAM_BOT_TOKEN=123456789:ABCdefGHIjklMNOpqrSTUvwxYZ
TELEGRAM_ALLOWED_USERS=123456789

Separate several user IDs with commas. Then start the gateway in the foreground to test:

hermes gateway run

Send your bot a message. It should answer within seconds.

Once it works, run it as a service so it survives a closed terminal or a reboot:

hermes gateway install
hermes gateway start
hermes gateway status

Note that hermes gateway start only starts a service you've already installed. On a fresh machine, start alone does nothing useful; install comes first.

If you use the Hermes desktop app or dashboard, Messaging → Telegram has a Create with QR button that creates the bot, finds your user ID and writes both lines for you.

What a bad token looks like

We started the gateway with a made-up token to see what happens. It didn't retry quietly. The log said:

Failed to connect to Telegram: The token `123456789:***` was rejected by the server.
Gateway exiting cleanly: telegram: Telegram bot token rejected ... The token
is invalid or was revoked ... generate a new one with @BotFather and update
TELEGRAM_BOT_TOKEN.

The whole gateway shut down, not just Telegram. That matters, because the gateway also runs your cron jobs. One revoked token stops every scheduled task on that profile until you fix it.

Use Hermes in a group: the three gates

Three gates before Hermes replies in a group: Telegram must deliver the message, Hermes must allow the sender, and the mention filter must pass

Add the bot to your group like any member. If it answers in your DM but stays silent in the group, one of these three gates is closed. Check them in this order.

Gate 1: Telegram has to deliver the message

Telegram bots start with privacy mode on. In a group, a privacy-mode bot only sees commands, replies to its own messages and service messages. Hermes can't answer a message Telegram never sends it.

Two ways to open this gate:

  • Turn privacy off: @BotFather → /mybots → your bot → Bot Settings → Group Privacy → Turn off.
  • Or make the bot a group admin. Telegram's own FAQ says admin bots "will receive all messages except messages sent by other bots."

Then remove the bot from the group and add it again. Telegram remembers the privacy setting from when the bot joined, and the change won't apply until it rejoins. Skipping this step is the most common reason the fix "didn't work".

Gate 2: Hermes has to allow the sender or the chat

TELEGRAM_ALLOWED_USERS applies everywhere, including groups. If a teammate isn't on it, Hermes ignores them. For a team bot, allowing the whole group is easier:

TELEGRAM_GROUP_ALLOWED_CHATS=-1001234567890

Any member of that group can now use the bot, without getting DM access. Group IDs are negative and usually start with -100. If you only want certain people, use TELEGRAM_GROUP_ALLOWED_USERS with their user IDs instead.

One trap: older guides put the group's chat ID in TELEGRAM_GROUP_ALLOWED_USERS. Hermes still honours that, but logs a deprecation warning. Move it to TELEGRAM_GROUP_ALLOWED_CHATS.

Gate 3: the mention filter

By default, require_mention is off, so Hermes replies to every group message it can see, without an @mention. If that's what you want, you're done once gates 1 and 2 are open.

For a busy group, you'll probably want the opposite. Add this to ~/.hermes/config.yaml:

telegram:
  require_mention: true
  mention_patterns:
    - "^\\s*hermes\\b"

Now Hermes only answers an @mention, a reply to one of its messages, a /command@yourbot, or a message that starts with "hermes". The wake word is a regular expression and isn't case-sensitive.

If your agent should be online for a team around the clock, a laptop running hermes gateway run won't cut it. That's where a hosted agent is simpler: BetterClaw connects an agent to Telegram with the same BotFather token and runs it on our servers. Start your first agent.

Use Hermes in topics

Topics come in two flavours, and they're set up differently.

Topics in a group (forum groups)

Every topic in a Hermes forum group gets its own session: separate history, separate context, no extra config needed

Turn on Topics in the group's settings. Hermes then gives each topic its own session automatically: separate history, separate context. There's nothing to configure.

Three optional settings make topics more useful:

  • Reply without @mentions in one topic only, while the rest of the group needs them: free_response_topics takes chat_id:thread_id pairs (the General topic is 1).
  • Keep Hermes silent in some topics: ignored_threads.
  • Load a skill automatically in a topic, under platforms.telegram.extra.group_topics with the topic's thread_id and a skill.
telegram:
  require_mention: true
  free_response_topics:
    - "-1001234567890:5"
  ignored_threads:
    - 42

To find a topic's thread_id, open it in Telegram Web or Desktop. The last number in the link t.me/c/1234567890/5 is the thread ID.

Topics in your DM with the bot

Telegram now lets bots have topics inside a private chat, which turns one DM into several parallel workspaces. Hermes supports two versions: send /topic in the DM to create topics as you go, or declare a fixed list under dm_topics in config.yaml. Since v0.23.0 there is also an opt-in dm_topic_auto_transfer setting that opens a fresh topic for each message you send in the main DM.

Both need Threaded Mode switched on for the bot. This is where people get stuck: it isn't in the classic /mybots menu. Open the BotFather Mini App instead (search "botfather" and tap Open), then My bots → your bot → Bot Settings → Threads Settings.

Without it, Hermes logs The chat is not a forum and skips topic creation.

Deliver cron results to Telegram

Scheduled jobs can post straight into a chat. We created this one on v0.22.5:

hermes cron create "0 8 * * *" "Write a morning briefing: today's calendar,
unread priority email, and top 3 tasks. Keep it under 150 words." --name
"Morning briefing" --deliver telegram:-1001234567890

Delivery targets:

  • telegram sends to your home channel. Set it with /sethome in any chat, or TELEGRAM_HOME_CHANNEL in .env.
  • telegram:<chat_id> sends to a specific chat.
  • telegram:<chat_id>:<thread_id> sends into a specific topic.

Two things we hit while testing. First, the schedule "every 1d at 08:00", which appears in some guides, failed with "Invalid duration". Use a cron expression like "0 8 * * *" instead. Second, the job saved fine with no gateway running, but Hermes warned "Scheduler is not ready". A job only fires while the gateway runs.

If a scheduled job runs but nothing arrives, our Hermes cron troubleshooting guide covers every cause.

Fix common Telegram errors

Three common Hermes Telegram errors and their fixes: 409 Conflict, rejected token, and silent group bot

What you seeCauseFix
"409 Conflict" in the gateway logTwo processes are polling the same bot tokenStop the duplicate gateway (full 409 fix)
"The token … was rejected by the server" and the gateway exitsWrong or revoked tokenGet a new token from BotFather and update TELEGRAM_BOT_TOKEN
Works in DMs, silent in the groupPrivacy mode on, or the bot joined before you changed itTurn privacy off or make it admin, then remove and re-add the bot
Replies to some people, ignores othersSender not allowlistedAdd the group to TELEGRAM_GROUP_ALLOWED_CHATS
Ignores normal messages but answers @mentionsrequire_mention: trueExpected; add a wake word in mention_patterns, or list the topic in free_response_topics
Cron result never arrives in the groupWrong chat ID (positive instead of -100...)Copy the group ID again; groups are negative numbers
"The chat is not a forum"Threaded Mode is offTurn it on in the BotFather Mini App

Running more than one Hermes bot in the same group? Give each profile its own token. Reusing a token across gateways is exactly what triggers the 409.

For errors outside Telegram (gateway crashes, provider errors, update problems), see Hermes Agent not working.

Telegram vs Discord for Hermes

Both connect through the same Hermes gateway, so your agent's memory and skills are identical on either. Telegram is quicker to set up: one BotFather token, no developer portal, and it works well on a phone. Discord takes longer (an application, privileged intents, an invite link) but gives you more structure for a team: roles, per-channel rules, threads and slash commands for your skills. For a personal assistant, start with Telegram. For a shared team or community bot, see our Hermes Discord bot setup guide.

Telegram agents without a server (BetterClaw)

Everything above assumes a machine that stays on. If the gateway stops, so does your bot and every scheduled job behind it.

BetterClaw is a separate no-code AI agent platform, not a Hermes host. You paste a BotFather token into Settings → Integrations, pick which agent answers, and choose who can message it. The agent runs on our servers, connects to 500+ apps, and uses any of 28+ model providers on your own key with zero markup. Telegram is available on Pro and above.

Setting Hermes up on other chat apps too? We have guides for Discord and Slack.

Your agent in Telegram, Slack, Discord and Gmail, 24/7. Start your first agent.

Frequently Asked Questions

How do I connect Hermes Agent to Telegram?

Create a bot with @BotFather and copy its token. Then run hermes gateway setup, or add TELEGRAM_BOT_TOKEN and your numeric TELEGRAM_ALLOWED_USERS to ~/.hermes/.env yourself. Start it with hermes gateway run and message the bot to test. Once it answers, run hermes gateway install and hermes gateway start so it keeps running after you close the terminal or reboot.

Where do I get a Telegram bot token?

From @BotFather inside Telegram. Send /newbot, choose a display name, then choose a username that ends in bot. BotFather replies with a token that looks like 123456789:ABCdef.... Treat it like a password, because anyone who has it controls your bot. If it leaks, send /revoke to BotFather and put the new token in TELEGRAM_BOT_TOKEN.

Why does Hermes not reply in a Telegram group?

Usually because Telegram never delivers the message. Bots start with privacy mode on, so in a group they only see commands and replies to their own messages. Turn privacy off in BotFather or make the bot an admin, then remove it from the group and add it again. Also allow the group with TELEGRAM_GROUP_ALLOWED_CHATS and check whether require_mention is on.

How do I use Hermes in Telegram topics?

Turn on Topics in the group settings. Hermes then gives every topic its own session automatically, with separate history and context, and nothing else to configure. Use free_response_topics to reply without an @mention in chosen topics, and ignored_threads to keep Hermes silent in others. Topics in a private chat need Threaded Mode, which you switch on in the BotFather Mini App.

What is the Telegram 409 conflict error?

A 409 Conflict means two processes are polling the same bot token at once. Telegram allows only one, so the two gateways keep knocking each other off. The usual cause is a second Hermes gateway, an old Docker container or another profile using the same token. Stop the duplicate, and give every bot or profile its own token from BotFather.

Should I use Telegram or Discord for Hermes?

Telegram is faster to set up and better for a personal assistant you reach from your phone: one BotFather token and you are done. Discord takes longer because of the developer portal and intents, but suits teams and communities with roles, per-channel rules, threads and slash commands. Both use the same Hermes gateway, so the agent itself behaves the same on either.

Want to skip the setup?

BetterClaw does this in 60 seconds. No Docker, no config files.

Start free
Tags:hermes agent telegram setuphermes telegramhermes telegram topicshermes agent telegram topicshermes telegram group topicshermes telegram allowlisthermes telegram 409 conflict
Shabnam Katoch

Written by

Shabnam Katoch

Growth Head

Shabnam leads growth at BetterClaw and has spent the past three years building organic distribution for AI-native products. She writes about no-code agent builders, content strategy, and what it actually takes to grow without an ads budget.

Share this article
Was this helpful?