Deskshift

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.

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.

  1. In Telegram, open the verified @BotFather account.
  2. Send /newbot.
  3. Choose a display name, such as the name of the business.
  4. Choose a username. It has to be unique and end in bot, such as examplestore_assistant_bot.
  5. 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.

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=123456789

How 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.

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.

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.

What goes wrong

These are the problems to expect, with the first thing to check. The Hermes Telegram docs have more.

Test before people rely on it

Test with made-up data, and with each Telegram account that will use the assistant.

More guides

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.

hoyelam@kin-yee.com

Prefer WhatsApp? +31 6 18 22 66 91