Back to the installation guide
How to connect Hermes Agent to Telegram
Updated: December 2026
To connect Hermes Agent to Telegram, you create a bot with BotFather, give Hermes the bot's token and list the numeric user IDs of the people who may use it. Then you set a home channel and test with every account before anyone relies on it.
I set up Hermes Agent for small businesses with my own installer, and I run a public demo bot on Telegram myself. This guide follows the steps my installer takes, with the things I check first when something does not work.
Why I prefer Telegram over WhatsApp
In my opinion Telegram is the better chat app for a business assistant. A Telegram bot is an official feature. You create it with BotFather, Telegram's own tool for bots, and Hermes talks to Telegram's Bot API through the python-telegram-bot library. The bot needs no phone number and no second SIM.
WhatsApp works differently. For WhatsApp, Hermes uses Baileys, an unofficial WhatsApp Web client. The assistant needs a phone number of its own, and WhatsApp can ban a number that it sees as automated WhatsApp Web use. In the Hermes version I use, v2026.9.24, that bridge also installs 166 npm packages that nobody reviews for you. The official WhatsApp Business API is an option too, but it needs a Meta Business account and a public webhook URL.
Telegram has its limits as well. Everyone who uses the assistant needs a Telegram account, so ask your team before you start. A bot also cannot start a conversation. It can only message someone who opened a chat with it first, and it cannot reach someone who blocked it.
Before you start
Have these ready before you touch the server.
- A server where Hermes Agent already runs. The business checklist covers that part.
- A Telegram account to create the bot with.
- A password manager for the bot's token.
- The numeric Telegram user ID of everyone who may use the assistant. A later section explains how to find them.
Create the bot with BotFather
I create one new bot for every business. I never share a bot between businesses, and I keep my own notification bot separate from the bots my clients use.
- In Telegram, open the verified @BotFather account.
- Send
/newbot. - Choose a display name, such as the name of the business.
- Choose a username. It has to be unique and end in
bot, such asexamplestore_assistant_bot. - BotFather replies with the bot's API token. Store it in your password manager right away.
Keep the token secret
Anyone with the token controls the bot. They can answer your team in its name. So I treat the token like a password.
- Never paste the token into a chat, an issue, a browser address bar or your shell history. Telegram's Bot API addresses contain the token, so a pasted address leaks it as well.
- If the token leaks, send
/revoketo BotFather for a new one. Put the new token in the.envfile and restart the Hermes gateway, because a running gateway keeps the old one. - One token belongs to one running gateway. If a second Hermes install uses the same token, such as a test on your laptop, Telegram reports a conflict.
Where do the token and the settings go?
Hermes reads the token and the Telegram settings from a .env file. Without managed scope, everything goes in the Hermes user's ~/.hermes/.env. With Hermes's managed scope, I split it in two.
The token goes in ~/.hermes/.env, owned by the Hermes user and readable only by that user (mode 0600). The allowlist and the home channel go in /etc/hermes/.env, which an admin owns. Settings there take precedence over the user's file, so nobody in a chat can change who gets answers.
This has a limit. Hermes runs as that same user, so the agent can read its own token. The file mode protects the token from other users on the computer, not from the agent.
The setup wizard, hermes gateway setup, cannot change a setting that /etc/hermes/.env already holds. On a managed install, such as the one my installer makes, Hermes refuses every write to its settings files. So you write these lines yourself, then start or restart the gateway with hermes gateway.
By default Hermes uses long polling. The gateway asks Telegram for new messages, so the server needs no public address and no open port for Telegram.
# ~/.hermes/.env, owned by the Hermes user, mode 0600
TELEGRAM_BOT_TOKEN=<the token from BotFather>
# /etc/hermes/.env, or ~/.hermes/.env without managed scope
TELEGRAM_ALLOWED_USERS=123456789,987654321
TELEGRAM_ALLOW_ALL_USERS=false
TELEGRAM_HOME_CHANNEL=123456789How do I find each person's user ID?
Hermes checks people by their numeric Telegram user ID, such as 123456789. A username such as @example does not work. Ask each person to send a message to @userinfobot. It replies with their user ID.
Check every ID before you add it. A wrong digit locks that person out, and Hermes does not tell them why.
In a private chat with the bot, the chat ID is the same as the user ID. You need that for the home channel later. Group IDs are negative numbers, often starting with -100.
Choose who gets answers
Hermes answers only the user IDs in TELEGRAM_ALLOWED_USERS, separated by commas. Without a list the gateway denies everyone.
Never set TELEGRAM_ALLOW_ALL_USERS=true or put * in the list for a business bot. Anyone who finds the bot's username could then use your assistant and everything it can reach.
- Strangers who write to the bot get no reply. In v2026.9.24 Hermes ignores them when an allowlist is set, instead of sending a pairing code. My installer also sets
unauthorized_dm_behaviortoignore, so this does not depend on the default. - The allowlist also applies in groups, unless you admit a whole group as described further down.
- The allowlist decides who can talk to the assistant, not what it may do. The sections on commands and approvals cover that.
Limit the slash commands
By default every allowed user can run every slash command. That includes /sethome, which moves the home channel, and /model, which changes the AI model. I would rather keep those with the owner.
So I give only the owner admin rights with allow_admin_from. Everyone else may run /help, /whoami and /new. Ordinary messages are not affected, so employees can still ask the assistant anything. Admin rights in private chats do not carry over to groups, so set both. The business checklist explains why everyone needs /new.
Each person can check their own rights with /whoami. It shows whether they are an admin and which commands they may run.
# /etc/hermes/config.yaml, or ~/.hermes/config.yaml without managed scope
gateway:
platforms:
telegram:
extra:
allow_admin_from:
- "123456789"
user_allowed_commands: [help, whoami, new]
group_allow_admin_from:
- "123456789"
group_user_allowed_commands: [help, whoami, new]What is the home channel?
The home channel is the chat where Hermes delivers the results of scheduled jobs and messages from other platforms. Until you set one, Hermes adds a notice to every new chat. It starts with “No home channel is set for Telegram” and asks the user to type /sethome. I first saw it on my public demo bot, where every new visitor got it.
For a business I make the owner's private chat with the bot the home channel. Scheduled reports then reach one person, not a group.
- Write
TELEGRAM_HOME_CHANNELyourself, with the owner's user ID as the chat ID, and restart the gateway. - Do not rely on
/sethomeon a managed install. From reading the v2026.9.24 code, I expect Hermes cannot save the change there, so it would last only until the next restart. I have not tested that on a live bot, so write the setting yourself. - The owner has to open the bot and press Start once. Until then, the bot cannot deliver anything to them.
Should you use the approval buttons?
When Hermes wants to run a command that it sees as dangerous, it asks for approval in the chat. In v2026.9.24 Telegram shows that request with buttons, such as Allow Once and Deny.
I do not rely on these buttons for a business. Hermes accepts a tap from anyone on the allowlist, not only from the admins. Some buttons also approve more than one action, for the rest of the session or for good.
In my installer a plugin asks the owner instead, in the owner's private chat, and each approval covers one exact action for five minutes. The business checklist explains how that works with a pre_tool_call hook. If you use the buttons anyway, allow only people you would trust with that decision.
Can Hermes Agent work in a Telegram group?
Yes, but I keep a business assistant in private chats unless there is a clear reason for a group. Everyone in a group sees every answer.
Telegram decides what a bot sees in a group. Privacy mode is on by default. The bot then sees only commands, replies to its own messages and a few service messages.
- To let Hermes see every message, turn privacy mode off in BotFather (
/mybots, your bot, Bot Settings, Group Privacy) or make the bot a group admin. Then remove the bot from the group and add it again, because Telegram keeps the old setting for groups the bot is already in. - Set
telegram.require_mention: trueinconfig.yamlif the bot should answer only when someone mentions it, replies to it or sends a command. - To admit a whole group, put its negative chat ID in
TELEGRAM_GROUP_ALLOWED_CHATS. Every member of that group can then use the assistant, so check who is in it first. - Keep approvals out of groups. The owner approves in their own private chat.
What goes wrong
These are the problems to expect, with the first thing to check. The Hermes Telegram docs have more.
- The bot does not answer at all. Check the token first, then the gateway log.
- One person gets no answer. Their user ID is missing from the list or has a typo. Ask them to check it with @userinfobot.
- The bot answers in a private chat but not in a group. Check privacy mode, remove and add the bot again, then check the group allowlist and
require_mention. - Every new chat starts with the home channel notice. Set
TELEGRAM_HOME_CHANNELand restart the gateway. - The home channel is gone after a restart. If it was set with
/sethomeon a managed install, that is the likely cause. Write it in/etc/hermes/.envinstead. - Telegram reports a conflict. Another install polls with the same token. Give each install its own bot.
- The owner gets no scheduled reports. Check that they started a chat with the bot and did not block it.
Test before people rely on it
Test with made-up data, and with each Telegram account that will use the assistant.
- The owner sends a private message and gets an answer.
- An employee on the list gets an answer, and
/whoamishows them as a user, not an admin. - An employee cannot run
/sethomeor/model. - An account that is not on the list gets no reply.
- A group gets no answer unless its exact ID is allowed.
- A scheduled job delivers to the owner's private chat.
- After a reboot of the server and a restart of Hermes, the bot still answers and the home channel is still set.
More guides
A setup checklist for running Hermes Agent in a business
Its own computer and user, encryption, SSH, pinned updates, backups, approvals and spend limits.
What Hermes Agent costs a small business
The license, the server, AI model use and your own time, with sources for each price.
Rather not do it yourself?
I set up Hermes Agent for your business and keep it running. See what I install, or tell me which task takes up the most time.
Prefer WhatsApp? +31 6 18 22 66 91