One of the vital necessary nicest problems about working an area AI agent is that it does no longer have to stay trapped on the tool where it all started.
Once I connected Hermes to Telegram, it grow to be much more useful. I would possibly message it from anywhere, check out workflows in brief, and handle it a lot much less like a terminal-bound device and additional like an assistant I would possibly in truth succeed in when I sought after it.
The setup isn’t laborious, alternatively a few details subject. The principle one is this: Hermes splits credentials and behavior into different places. Your secrets and techniques and methods pass in .env. Your Telegram behavior lives in config.yaml. Put those inside the fallacious place and also you’ll waste time for no excellent reasons why.
Proper right here’s the clean approach to set it up.
What You Need Quicker than You Get began
Quicker than touching any config data, be sure that you already have:
- Hermes installed to your tool
- a Telegram account
- a Telegram bot token, which you’ll create in a 2d
Create a Telegram Bot
Open Telegram and search for @BotFather.
Get began a chat and run:
/newbot

BotFather will walk you by way of the remainder. You give the bot a name, then a username, and in return Telegram gives you a bot token that looks something like this:
123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ
Save that token somewhere safe. You’ll need it shortly, and likewise you will have to no longer paste it spherical carelessly.
To search out Your Telegram Chat ID
Next, search for @userinfobot in Telegram and get began a conversation with it.
It replies along side your numeric Telegram particular person ID. It’ll look something like this:
123456789
Save that too.
That’s the ID Hermes uses to make a decision who is permitted to talk to your bot.

Put Credentials in .env
That’s the section that is easy to get fallacious.
Your Telegram bot token and allowed particular person file belong in:
~/.hermes/.env
They do no longer belong in config.yaml.
Open ~/.hermes/.env and add or substitute the ones values:
# Telegram bot token from @BotFather BOT_TOKEN=your_bot_token_here TELEGRAM_BOT_TOKEN=your_bot_token_here # Your numeric Telegram particular person ID from @userinfobot # For a few consumers, separate with commas TELEGRAM_ALLOWED_USERS=123456789
In case you’re the only one who will have to be capable of keep up a correspondence to the bot, keep merely your own ID there. If a few people will have to have get right to use, separate their IDs with commas.
Set Telegram Conduct in config.yaml
Once credentials are in place, configure how Hermes will have to behave on Telegram.
Open:
~/.hermes/config.yaml
Then add a telegram: section if it does no longer already exist:
telegram: require_mention: true
This surroundings controls whether or not or no longer Hermes best responds when explicitly mentioned.
With require_mention: true, you wish to have to call the bot directly inside the chat, generally by the use of mentioning its username.
With false, Hermes responds to all messages in allowed chats, which is ok in some setups alternatively no longer at all times what you wish to have.
For most of the people, true is the extra protected default.
Optionally Add a Prefix
You probably have a few bots within the identical chat, or just want cleaner regulate over what triggers Hermes, you’ll be capable to moreover define a prefix.
Example:
telegram: require_mention: true prefix: "/hermes"
That implies consumers must type something like:
/hermes summarize this
It’s not obligatory, alternatively useful if the bot shares a noisy group of workers chat with other apparatus. If you want to pass broader than Telegram later, this roundup of equipment to construct your personal chatbots is a good next save you.
Restart the Gateway
After improving .env and config.yaml, restart the Hermes gateway so it reloads the new settings:
hermes gateway restart
If you want to verify it in truth were given right here once more up, run:
hermes gateway status
That is generally enough. No drama required.
Check out the Bot
Now open Telegram, to search out your bot by the use of its username, and send it a message.
Something simple is ok:
Hello, are you there?
If the whole lot is configured as it should be, Hermes will have to solution.

And that’s the second one it stops feeling like a space experiment and starts feeling appropriately useful.
What Normally Goes Improper
If Hermes does no longer answer, the ones are the principle problems I’d test.
The Token Is Improper
Double-check that the bot token in .env is right kind.
One dangerous persona is enough to make all of the factor quietly fail.
The Allowed Shopper ID Is Improper
Make sure TELEGRAM_ALLOWED_USERS accommodates the correct numeric Telegram particular person ID.
If the ID is fallacious, Hermes is also working totally and however disregard about you.
The Gateway Was once as soon as Not Restarted
Must you edited the config alternatively didn’t restart the gateway, Hermes may however be running with the out of date settings.
The Improper Bot Token Is Being Loaded
Must you put up a few Telegram bots, be sure that Hermes is learning the token you suppose it’s learning.
That one gets people additional frequently than they admit.
Neighborhood or Firewall Issues
If outbound connections to Telegram are blocked, the bot received’t behave irrespective of how right kind your config is.
A Rapid Protection Realize
Don’t share your bot token publicly.
Care for it like a credential, because of it’s one.
Moreover, keep the TELEGRAM_ALLOWED_USERS file tight. That file is effectively your get right to use regulate layer for Telegram chat get right to use.
Final Thought
Once Hermes is connected to Telegram, all of the setup feels different.
It’s however your local agent. It’s however running to your tool. Then again now it’s reachable from anywhere, which makes it much more simple to use in exact existence as an alternative of best when you happen to be sitting at your desk.
Must you put it up cleanly, all of the factor is surprisingly painless.
The put up How you can Attach Hermes to Telegram appeared first on Hongkiat.
Supply: https://www.hongkiat.com/blog/connect-hermes-to-telegram-2/



![How Efficiency Advertising and marketing Works [+ 6 Tools You Can Use]](https://wpmountain.com/wp-content/uploads/2021/07/aacfe6c7-71e6-4f49-979f-76099062afa0-150x59.png)

0 Comments