GuidesChannels

Hermes Agent Telegram setup: BotFather, allowlist, groups, 409

Connect Hermes Agent to Telegram: the BotFather token, the user-ID allowlist, privacy mode in groups, running the gateway as a service, and the 409 Conflict fix.

November 30, 2026The Everpod team
The short answer

Send /newbot to @BotFather in Telegram and copy the token it gives you. Get your numeric user ID from @userinfobot. On the machine running Hermes, run hermes gateway setup, choose Telegram, and paste the token at its hidden prompt and your ID as the allowed user; both land in ~/.hermes/.env as TELEGRAM_BOT_TOKEN and TELEGRAM_ALLOWED_USERS. Then install the gateway as a service with hermes gateway install so the bot keeps answering after you log out. Hermes refuses anyone not on the list (or paired), and it polls Telegram, so the server needs no open port. In groups, Telegram’s privacy mode hides ordinary messages from the bot until you turn it off in BotFather and re-add the bot. As of Hermes v0.23.5 (November 28, 2026).

Make the bot in BotFather

  1. In Telegram, open a chat with @BotFather and send /newbot.
  2. Give it a display name (anything) and a username, which must end in bot.
  3. BotFather replies with the token, a string shaped like 123456789:ABC…. Hermes’s Telegram page puts it bluntly: “Anyone with this token can control your bot.” Keep it out of chats, screenshots and shared notes.

While you are in BotFather, decide about groups. If the bot will only ever talk to you in a direct message, leave everything as it is. If it will sit in a group, the privacy setting below matters, and it is easier to change before the bot joins.

Find your Telegram user ID

Hermes checks numeric IDs, never names: “Your user ID is not your username.” Message @userinfobot (or @get_id_bot) and it replies with the number. Add several people by separating their IDs with commas.

Give Hermes the token without leaving it in your history

The wizard is the safest route, because it never puts the token on a command line:

hermes gateway setup     # choose Telegram
Copied

In v0.23.5 the Telegram plugin declares its token prompt, “Telegram bot token”, as a password field, so what you paste is not echoed. The wizard then asks for allowed user IDs and writes both to ~/.hermes/.env. To do it by hand, open that file in an editor rather than running echo or export with the token in it:

# ~/.hermes/.env
TELEGRAM_BOT_TOKEN=<token from BotFather>
TELEGRAM_ALLOWED_USERS=123456789,987654321
Copied

Then make the file readable by your user only, since it holds every key Hermes uses, not just this one:

chmod 600 ~/.hermes/.env
Copied

Two other keys in the same file are worth knowing. TELEGRAM_HOME_CHANNEL is the chat where scheduled jobs deliver their results; sending /sethome in a chat sets it for you. And if you ever generate a new token in BotFather (/token, or /revoke if the old one leaked), put the new one here and restart the gateway.

Who gets to talk to it

Nous’s messaging page states the default: “By default, the gateway denies all users who are not in an allowlist or paired via DM.” That is the right default, because whoever is allowed is driving an agent with a terminal on your machine. The settings:

SettingWho it lets in
TELEGRAM_ALLOWED_USERS
The listed user IDs, in DMs, groups and forums alike
TELEGRAM_GROUP_ALLOWED_USERS
The listed senders, in groups and forums only; they still cannot DM the bot
TELEGRAM_GROUP_ALLOWED_CHATS
Every member of the listed groups, whoever sends (group IDs are negative; a supergroup’s starts with -100)
GATEWAY_ALLOWED_USERS
The listed IDs on every platform the gateway serves
TELEGRAM_ALLOW_ALL_USERS, GATEWAY_ALLOW_ALL_USERS
Anyone who finds the bot. The plugin labels the first “dev only”; Nous advises against the second where the agent has terminal access

Allowing a group by its chat ID hands the agent to everyone in that group, not just you, so use it only for a group of people you would give your terminal to. The same goes for a *, which in any of these lists means any sender or any chat.

A stranger who messages the bot is not answered, but can be paired: they get a one-time code, and you let them in from the server. Codes “expire after 1 hour, are rate-limited, and use cryptographic randomness.”

hermes pairing list
hermes pairing approve telegram XKGH5N7P
hermes pairing revoke telegram 123456789
Copied

Groups: privacy mode first

Every Telegram bot starts in privacy mode. In a group it then sees only commands, replies to its own messages and service messages, so a plain “hey, can you…” never reaches Hermes and the bot looks dead. Either turn privacy off in BotFather (/mybots, your bot, Bot Settings, Group Privacy, Turn off) or make the bot a group admin, since in Telegram’s words “bot admins always receive all messages.” The step everyone misses: after changing the setting, remove the bot from the group and add it back, or the group keeps the old behaviour.

Once Hermes can see everything, decide when it should speak. Left unset, require_mention keeps the open behaviour, so it may answer ordinary chatter. In ~/.hermes/config.yaml, as Nous’s example lays it out:

telegram:
  require_mention: true
  exclusive_bot_mentions: true
  mention_patterns:
    - "^\\s*chompy\\b"
Copied

With that, Hermes answers replies to itself, @yourbot mentions and anything matching a mention_patterns regex (a bad regex is skipped with a warning in the log rather than crashing the bot). free_response_chats and free_response_topics exempt whole chats or topics from the mention rule, and exclusive_bot_mentions stops it picking up messages aimed at another bot in the same group. Separately, guest_mode: true lets a group that is not allowlisted use the bot, but only for messages that @mention it, every time.

Forum topics and DM topics

Hermes handles topics in groups and in DMs. In a forum supergroup it registers its command menu automatically on the first message, and a topic can be bound to a skill under platforms.telegram.extra.group_topics (each entry a chat_id, a thread_id and an optional skill). In a direct message, Hermes can use Telegram’s private chat topics (Bot API 9.4): send /topic to turn one DM into several parallel sessions, each in its own topic. If a reply to a topic fails with Telegram’s “message thread not found”, the topic it was sent to is not there for Telegram; the causes are in what that 400 error means.

Voice notes, photos and files

Keep it answering after you disconnect

hermes gateway in a terminal is fine for a first test (“The bot should come online within seconds”), but it dies with your SSH session. On a Linux server, install it as a service:

hermes gateway install
sudo loginctl enable-linger $USER
hermes gateway status
journalctl --user -u hermes-gateway -f
Copied

Lingering is what keeps a user service alive after your last login ends; the guide to user services and linger explains it, and installing Hermes on a server covers the system-service alternative and why you should have one or the other, not both. After editing .env, run hermes gateway restart.

By default Hermes uses long polling: the gateway makes outbound requests to Telegram and nothing has to reach the server, which suits a machine behind a firewall. Webhook mode (TELEGRAM_WEBHOOK_URL plus TELEGRAM_WEBHOOK_SECRET) is for hosts that sleep when idle and needs a public HTTPS address; on an always-on server there is no reason to switch.

When the bot stays silent

Work down from the most common cause:

409 Conflict: two programs on one token

Only one program at a time can poll a bot’s updates. When a second one polls with the same token, Telegram answers with a 409, and Hermes logs terminated by other getUpdates request. The first one can be harmless: Nous notes it “is usually the gateway’s own previous long poll, which Telegram expires on its own”, so Hermes retries for about 200 seconds, then again about 2, 5 and 10 minutes later. If the conflict outlasts that, hermes status shows Telegram as fatal with token_in_use_elsewhere and the gateway stops trying.

Nous names the candidates as another machine, a leftover process or another bot framework. In practice that can be a second Hermes on your laptop set up with the same token, both a user and a system Hermes service on the server, or another agent such as OpenClaw still running on the bot you moved over. Stop it, then hermes gateway restart. Two Hermes profiles on one machine sharing a token never get as far as a 409: the second is refused at start with duplicate_credential (or telegram-bot-token_lock when the other is a separate gateway). A token that still has a webhook set by another tool cannot be polled either, since Telegram’s getUpdates “will not work if an outgoing webhook is set up.” How to track down the other reader on each kind of setup is in Telegram’s 409 “terminated by other getUpdates request”.

If you run Hermes on Discord or WhatsApp too, the Discord setup and the WhatsApp setup share this gateway and this .env; one service carries them all.

Hermes installed on an always-on developer pod, which you run yourself.

A developer pod is a permanent cloud computer (VPS), set up and secured for you, with your pick of Claude Code, Codex, OpenCode, Pi, Hermes and OpenClaw installed. Run more agents at once than your laptop can hold, and keep them working when it’s closed. From $24 a month, built in about ten minutes.