← Build an AI Team Lesson 9 of 12

Reach it from your phone

The gateway

Your bots live on your laptop. To reach them from your phone, Hermes runs a gateway: a program that stays on in the background, connects to a messaging app like Telegram, passes your messages to the bot, and sends its replies back.
phone → Telegram → gateway → bot → back to your phone

Step through one message.

Telegram is free and easy for bots, so we use it here. The gateway also speaks WhatsApp, Slack, Discord and more.

First, Telegram needs a bot account.

Make a Telegram bot

In Telegram, chat with @BotFather, Telegram's own bot for making bots. Send /newbot, choose a name, and a username ending in bot. It gives you a token: the password the gateway uses to speak as that bot. Each of your bots needs its own.
one Hermes bot → one Telegram bot → one token

Step through BotFather.

Anyone with the token can control your bot. If it ever leaks, send /revoke to BotFather for a new one.

Now: who is allowed to talk to it?

Only your people

Anyone can find a Telegram bot. So Hermes answers only the people on a list: TELEGRAM_ALLOWED_USERS, in the bot's .env. The list holds numeric user IDs (your username can change; the number can't). Message @userinfobot to get yours. With no list at all, Hermes answers no one.
allowed users = numeric IDs · everyone else is ignored

Edit the list. Who gets an answer?
Try:

The bot and the list are ready. Switch it on.

Start the gateway

Each bot runs its own gateway, with its own token. First, gateway setup asks for the token and the allowed IDs, and saves them in the bot's .env. Then test it in the open terminal. When it works, install it as a service: a program your laptop starts by itself, even after a restart.
setup → test → install as a service

For Marketing. Then the same for each bot.
marketing gateway setup

Choose Telegram, paste Marketing's token, type the allowed IDs.

Checked against Hermes Agent v0.23 (November 2026). See the Telegram docs if a step looks different.

Count it on new numbers.

✏️ Practice 9.1

Remember:
one Hermes bot → one Telegram bot → one token
allowed users = numeric IDs · everyone else is ignored
Each bot runs its own gateway.

Work each one out. Type the answer, press Check.
You connect all 4 bots to Telegram. How many tokens do you need from BotFather?
The CEO, the social media manager and the designer should all reach Marketing. How many IDs go in Marketing's TELEGRAM_ALLOWED_USERS?
A customer finds your bot and sends it 5 messages. How many replies do they get?
All 4 bots are on Telegram. How many gateway services run on your laptop?

Four bots in four chats? One group is better.

The team in one group

Make a Telegram group, say “Amal Designers HQ”, add your people and all four bots. Then, in each bot's config.yaml, set two things: require_mention: true (answer only when tagged) and exclusive_bot_mentions: true (stay quiet when another bot is tagged). Without them, bots can chat to each other all night.
in a group: require_mention + exclusive_bot_mentions

Flip the settings. Who replies to “@Production is size 5 in stock?”

# in each bot's config.yaml
telegram:
  require_mention: true
  exclusive_bot_mentions: true

And when it doesn't answer at all?

When it goes wrong

Most Telegram problems are a token, the allowed list, or the gateway not running. gateway status and the gateway's log tell you which.

Match each problem to its fix.

Quick check: did it all make sense?

Lesson 9 test

5 questions, one for each idea in this lesson. Answer them all right to pass. A wrong answer tells you why, and which page to look at again.

1. IdeaWhat does the gateway do?
2. ActMarketing's token appeared in a screenshot you posted. What do you do?
3. PredictYou leave TELEGRAM_ALLOWED_USERS empty. Who can use the bot?
4. Keep itThe bot works while the terminal is open, but stops when you close it. What's missing?
5. PredictBoth settings are on. In the group you write “@Production how many red frocks?”. Who replies?

What's next.

Only when asked

Your team now answers from anywhere, but only when someone writes first. Tick what you've really done:

The social media manager needs today's post idea at 9 AM. Do I have to wait to be asked every day?

This leaves a question
It answers when you ask. Can it start work on its own?
Lesson 10 answers it.
For your business: who should be allowed to message each bot? Write each bot's list of people, and the name of your team group.