One of the vital nicest issues about working an area AI agent is that it does now not have to stick trapped at the device the place it began.
After I hooked up Hermes to Telegram, it become a lot more helpful. I may message it from any place, take a look at workflows briefly, and deal with it much less like a terminal-bound software and extra like an assistant I may in fact achieve once I wanted it.
The setup isn’t exhausting, however a couple of main points topic. The primary one is that this: Hermes splits credentials and behaviour into other puts. Your secrets and techniques cross in .env. Your Telegram conduct lives in config.yaml. Put the ones within the flawed position and you’ll waste time for no just right explanation why.
Right here’s the blank method to set it up.
Contents
- 1 What You Want Sooner than You Get started
- 2 Create a Telegram Bot
- 3 To find Your Telegram Chat ID
- 4 Put Credentials in .env
- 5 Set Telegram Habits in config.yaml
- 6 Optionally Upload a Prefix
- 7 Restart the Gateway
- 8 Take a look at the Bot
- 9 What Generally Is going Mistaken
- 10 A Fast Safety Notice
- 11 Ultimate Idea
What You Want Sooner than You Get started
Sooner than touching any config information, ensure that you have already got:
- Hermes put in in your device
- a Telegram account
- a Telegram bot token, which you’ll create in a second
Create a Telegram Bot
Open Telegram and seek for @BotFather.
Get started a talk and run:
/newbot

BotFather will stroll you via the remaining. You give the bot a reputation, then a username, and in go back Telegram will give you a bot token that appears one thing like this:
123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ
Save that token someplace protected. You’ll want it in a while, and also you must now not paste it round carelessly.
To find Your Telegram Chat ID
Subsequent, seek for @userinfobot in Telegram and get started a dialog with it.
It replies together with your numeric Telegram person ID. It’ll glance one thing like this:
123456789
Save that too.
That is the ID Hermes makes use of to come to a decision who is authorized to speak for your bot.

Put Credentials in .env
That is the phase this is simple to get flawed.
Your Telegram bot token and allowed person record belong in:
~/.hermes/.env
They do now not belong in config.yaml.
Open ~/.hermes/.env and upload or replace those values:
# Telegram bot token from @BotFather BOT_TOKEN=your_bot_token_here TELEGRAM_BOT_TOKEN=your_bot_token_here # Your numeric Telegram person ID from @userinfobot # For a couple of customers, separate with commas TELEGRAM_ALLOWED_USERS=123456789
If you’re the one one that must have the ability to communicate to the bot, stay simply your personal ID there. If a couple of other people must have get admission to, separate their IDs with commas.
Set Telegram Habits in config.yaml
As soon as credentials are in position, configure how Hermes must behave on Telegram.
Open:
~/.hermes/config.yaml
Then upload a telegram: phase if it does now not exist already:
telegram: require_mention: true
This atmosphere controls whether or not Hermes most effective responds when explicitly discussed.
With require_mention: true, you want to name the bot at once within the chat, in most cases by way of citing its username.
With false, Hermes responds to all messages in allowed chats, which is okay in some setups however now not all the time what you need.
For the general public, true is the more secure default.
Optionally Upload a Prefix
When you have a couple of bots in the similar chat, or simply need cleaner keep an eye on over what triggers Hermes, you’ll be able to additionally outline a prefix.
Instance:
telegram: require_mention: true prefix: "/hermes"
That suggests customers will have to sort one thing like:
/hermes summarize this
It’s non-compulsory, however helpful if the bot stocks a loud workforce chat with different equipment. If you wish to cross broader than Telegram later, this roundup of equipment to construct your personal chatbots is a tight subsequent prevent.
Restart the Gateway
After enhancing .env and config.yaml, restart the Hermes gateway so it reloads the brand new settings:
hermes gateway restart
If you wish to ascertain it in fact got here again up, run:
hermes gateway standing
This is in most cases sufficient. No drama required.
Take a look at the Bot
Now open Telegram, to find your bot by way of its username, and ship it a message.
One thing easy is okay:
Hi, are you there?
If the entirety is configured accurately, Hermes must answer.

And that’s the second it stops feeling like an area experiment and begins feeling correctly helpful.
What Generally Is going Mistaken
If Hermes does now not reply, those are the primary issues I’d verify.
The Token Is Mistaken
Double-check that the bot token in .env is proper.
One unhealthy personality is sufficient to make the entire thing quietly fail.
The Allowed Consumer ID Is Mistaken
Be certain that TELEGRAM_ALLOWED_USERS incorporates the proper numeric Telegram person ID.
If the ID is flawed, Hermes could also be running completely and nonetheless forget about you.
The Gateway Was once No longer Restarted
Should you edited the config however didn’t restart the gateway, Hermes might nonetheless be working with the outdated settings.
The Mistaken Bot Token Is Being Loaded
Should you set up a couple of Telegram bots, ensure that Hermes is studying the token you assume it’s studying.
That one will get other people extra regularly than they admit.
Community or Firewall Problems
If outbound connections to Telegram are blocked, the bot won’t behave regardless of how proper your config is.
A Fast Safety Notice
Don’t percentage your bot token publicly.
Deal with it like a credential, as a result of it’s one.
Additionally, stay the TELEGRAM_ALLOWED_USERS record tight. That record is successfully your get admission to keep an eye on layer for Telegram chat get admission to.
Ultimate Idea
As soon as Hermes is hooked up to Telegram, the entire setup feels other.
It’s nonetheless your native agent. It’s nonetheless working in your device. However now it’s reachable from any place, which makes it a lot more straightforward to make use of in actual lifestyles as a substitute of most effective while you occur to be sitting at your table.
Should you set it up cleanly, the entire thing is strangely painless.
The publish How you can Attach Hermes to Telegram gave the impression first on Hongkiat.
WordPress Website Development Source: https://www.hongkiat.com/blog/connect-hermes-to-telegram-2/
