Short answer. Create a bot with @BotFather in Telegram (/newbot) and copy its token. Give Hermes Agent the token and your numeric Telegram user ID: only the IDs on its allowlist, or people you approve with a pairing code, can talk to it; with no allowlist, a stranger gets nothing but a pairing code you would have to approve. On your own machine that is TELEGRAM_BOT_TOKEN and TELEGRAM_ALLOWED_USERS in ~/.hermes/.env, or hermes gateway setup. On PlayNHost you paste the token and your ID on the Agent page and restart.
Checked on 7 November 2026, accurate for Hermes Agent v0.23.0.
This guide uses Hermes Agent's Telegram and security documentation and the PlayNHost panel as it works today. Telegram support is built into Hermes Agent's messaging gateway: there is nothing extra to install.
Step 1: create the bot and copy its token
In Telegram, open a chat with @BotFather (or t.me/BotFather). Check that the handle is exactly @BotFather.
Send /newbot, choose a display name, then a username that ends in bot.
BotFather replies with the token, which looks like 123456789:ABCdefGHIjklMNOpqrSTUvwxYZ. Keep it private: anyone with it can control your bot. If it leaks, revoke it with /revoke in BotFather.
One program per bot. Hermes Agent's FAQ says each chat platform needs exclusive use of a bot token. If an older copy of Hermes Agent, or any other program, still uses the same token, stop it first or create a new bot.
Step 2: find your Telegram user ID
Hermes Agent's allowlist takes your numeric user ID, a number like 123456789, not your @username. Ways to get it:
On PlayNHost, from the console. Message your bot before you have set any ID: the console prints your ID. Details in Step 3 below.
From Hermes Agent's log. When someone not on its list sends a direct message, its log (~/.hermes/logs/gateway.log) gets a warning starting "Unauthorized user" with the sender's numeric ID (in brackets after their name when strangers are set to be ignored, as on PlayNHost).
A third-party bot. Hermes Agent's docs suggest @userinfobot or @get_id_bot, which reply with your ID.
Step 3 on PlayNHost: paste the token and your ID
You need an AI provider key on the same page. Without one, Start stops with "Your agent is not set up yet: it needs an API key from one AI provider and a Telegram or Discord bot token."
Under Chat apps, press Set on Telegram bot token, paste the token from BotFather and press Save. The panel checks its shape; a wrong paste gets "That is not a valid telegram bot token." Once saved, the row shows only the last four characters, and the token is never shown again.
Don't know your ID yet? Leave Telegram user IDs empty and press Start. The first start installs Hermes Agent, which took about 2.5 to 4 minutes in our tests. When the agent is up, the console prints:
[PlayNHost] Your agent is running
[PlayNHost] Telegram: nobody can message your agent yet. Send your bot any message: your Telegram user ID appears here in the console. Put it on the Agent page, then restart.
Send your bot a message in Telegram. It does not answer, not even with a pairing code: on PlayNHost, Hermes Agent ignores anyone who is not on the list. Within about 20 seconds (the console checks Hermes Agent's log every 20 seconds) it shows your ID:
[PlayNHost] Telegram user 123456789 messaged your agent and was ignored. If that is you, add 123456789 to the Telegram user IDs on the Agent page, then restart.
Under Who can message it, type the number into Telegram user IDs and press Save. Several IDs go on one line, separated by commas or spaces.
The page says "Changes apply the next time your agent starts." Press Restart now. The console then confirms:
[PlayNHost] Telegram: only user 123456789 can message your agent.
Message your bot. Your agent answers. Messages from any other Telegram account are ignored, and each new sender who messages the bot directly appears in the console once per start, so you can add a friend the same way.
What PlayNHost sets for you
The IDs on the Agent page reach Hermes Agent as TELEGRAM_ALLOWED_USERS. Every other way to let people in (allow-all switches, other allowlists, group grants, pairing approvals) is switched off at each start, and the agent is stopped if one appears while it runs.
Strangers are ignored (unauthorized_dm_behavior: ignore) instead of getting Hermes Agent's default pairing code, because a PlayNHost server has no command line to approve a code with.
The token reaches Hermes Agent as TELEGRAM_BOT_TOKEN. A copy of it written into .hermes/.env is removed at the next start, so the token on the Agent page is the one used.
Only Telegram and Discord are on. WhatsApp is refused: Hermes Agent's own docs say its WhatsApp bridge emulates a WhatsApp Web session and carries a ban risk.
Step 3 on your own machine
Run the setup wizard and choose Telegram. It asks for the token and the allowed user IDs and writes them for you:
Start the gateway with hermes gateway and send your bot a message. To keep it running after you log out, see how to run Hermes Agent 24/7.
Without any allowlist, Hermes Agent denies everybody. Its default for strangers is a pairing code that you approve with hermes pairing approve telegram <code>; codes expire after one hour. Hermes Agent's docs also offer GATEWAY_ALLOW_ALL_USERS=true, and warn against it for a bot that can run commands.
When it does not answer
What you see
Cause and fix
Console: "Telegram: nobody can message your agent yet"
No ID is on the Agent page. Message the bot, copy your ID from the console line that follows, add it and restart.
Console: "Telegram user ... messaged your agent and was ignored"
That account is not on the list. If it is yours, add the number and restart.
Console: "... entry in the Telegram user IDs is not a Telegram user ID and was left out"
A number on the list is shorter than 5 or longer than 25 digits, so it cannot be a user ID. Check it against the console line with your ID.
Console: "Telegram refused the bot token. Check it on the Agent page, then restart."
The token was revoked or mistyped. In @BotFather, send /mybots, choose your bot, then API Token, copy it again and press Replace on the Agent page.
Nothing in the console after your message, and no answer
Another program is using the same token, or you messaged a different bot. Stop the other copy or create a new bot, then restart.
Nothing in a group
Talk to the agent in a direct message. In groups, Telegram's privacy mode lets a bot see only commands and replies to it unless you change it in BotFather, and on PlayNHost only the user IDs on your list are answered.
We use cookies to keep the site working, to understand how it is used, and to measure our marketing. You can accept all, accept essential cookies only, or choose per category.We use cookies to keep the site working, to understand how it is used, and to measure our marketing. They are on by default here. You can switch off anything you do not want.Read our privacy policy