How to run 4 distinct Telegram channels for 4 different users on a single Hermes Agent instance
Hermes Agent's Telegram gateway has built-in multi-user support. Each Telegram user gets their own isolated session, meaning:
| Requirement | Status | Notes |
|---|---|---|
| Hermes Agent installed | Required | Already running on your VM |
| Telegram Bot Token | Required | From @BotFather |
| 4 Telegram user accounts | Required | Users who will DM the bot |
| Network access | Optional | For webhook mode |
Each user gets their own session key in format: telegram:CHAT_ID
Search for @BotFather in Telegram and start a chat with it.
Send the command:
/newbot
Follow the prompts to name your bot. You'll receive a bot token like:
1234567890:ABCdefGHIjklMNOpqrsTUVwxyz
For better UX, set the bot commands menu:
/setcommands
Paste this command list:
new - Start a fresh session
reset - Clear and start fresh
model - Show/change AI model
skills - Manage skills
status - Show connection status
YOUR_BOT_TOKEN_HERE
Add these variables to your ~/.hermes/.env file:
# Telegram Bot Configuration
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_ALLOWED_USERS=
TELEGRAM_ALLOWED_USERS empty for now. We'll add user IDs after Step 3.
To find each user's Telegram chat_id, you need to either:
Start a chat with @userinfobot on Telegram.
The bot will reply with user information including the ID. This is the user's chat_id.
Example response:
ID: 123456789
First Name: John
Last Name: Doe
Username: johndoe
Set in ~/.hermes/.env:
TELEGRAM_ALLOWED_USERS=*
cd ~/.hermes/hermes-agent
source venv/bin/activate
python -m gateway.run &
When users message the bot, their chat_id appears in ~/.hermes/logs/gateway.log
* after getting chat_ids.
Now add the 4 user chat_ids to your environment:
TELEGRAM_BOT_TOKEN=your_bot_token_here
TELEGRAM_ALLOWED_USERS=123456789,987654321,555555555,111111111
Separate multiple user IDs with commas. No spaces!
| User # | Chat ID | Purpose |
|---|---|---|
| User 1 | 123456789 |
Primary user (Thota) |
| User 2 | 987654321 |
Secondary user |
| User 3 | 555555555 |
Third user |
| User 4 | 111111111 |
Fourth user |
hermes gateway restart
Or if running manually:
cd ~/.hermes/hermes-agent
source venv/bin/activate
python -m gateway.run
Check the gateway log:
tail -20 ~/.hermes/logs/gateway.log
Look for:
[Telegram] Bot connected successfully
[Telegram] Listening for messages...
Now test with each user:
Have User 1 open a chat with @YourBot and send:
/status
They should get a response confirming their user ID.
User 2 sends a message â should get a fresh session, not User 1's history.
Each user should have isolated sessions.
You can give each user different settings by using session profiles:
# In config.yaml
sessions:
profiles:
user_123456789:
model: anthropic/claude-sonnet-4
toolsets: [terminal, file, web]
user_987654321:
model: openai/gpt-4o
toolsets: [terminal, file]
Use the /boot feature to send custom welcomes per user:
# ~/.hermes/gateway/builtin_hooks/welcome.md
# This message sent on first contact
{% if user_id == "123456789" %}
đ Welcome to your personal AI assistant, Thota!
{% elif user_id == "987654321" %}
đ Hello! How can I help you today?
{% endif %}
Ensure each user's memory is isolated by using the default session-based storage. It automatically separates by chat_id.
| Problem | Solution |
|---|---|
| "Not authorized" | Add user ID to TELEGRAM_ALLOWED_USERS |
| Messages not arriving | Check allowed_updates in config or restart gateway |
| Session mixup | Use /new to start fresh session |
| Bot offline | Run `hermes gateway restart` |
# List sessions
hermes sessions list
# Delete a specific session
hermes sessions delete SESSION_ID
# Show gateway status
hermes gateway status
# View live logs
tail -f ~/.hermes/logs/gateway.log