Build a Telegram Bot with Hermes
This tutorial walks you through creating a Telegram bot powered by Hermes — an AI agent framework that learns and improves from every conversation through persistent memory.
What you’ll build: A fully functional Telegram bot that responds to messages, remembers context over time, and gets smarter with every interaction.
Time required: ~8 minutes
Prerequisites:
- A free Hatcher account (sign up here )
- A Telegram account
Step 1: Create a Telegram Bot
Before deploying on Hatcher, you need a bot token from Telegram.
Open Telegram and find BotFather
Search for @BotFather in Telegram and open it. BotFather is Telegram’s official bot for creating and managing bots.
Create a new bot
Send the command:
/newbotBotFather will ask for:
- A name for your bot (e.g. “My Hatcher Assistant”) — this is the display name
- A username for your bot (e.g.
my_hatcher_bot) — must end inbot, must be unique
Copy your bot token
BotFather will reply with a token that looks like:
5839201847:AAF2kJdV9Qg3mNpXwT8vRkLzHyC1oBsE4XoCopy this token — you’ll need it in the next step.
Keep your bot token secret. Anyone with this token can control your bot.
Step 2: Deploy on Hatcher
Create a new agent
Go to your Hatcher Dashboard and click Create Agent.
Set the following:
- Framework: Hermes
- Prompt: Describe the customer-support bot you want Chat-to-Hatch to build
- Name: Give it a name matching your Telegram bot’s display name
Review the generated identity
Chat-to-Hatch generates the agent identity and SOUL.md preview from your prompt. Review the generated fields and edit anything that should be more concrete.
Example:
You are a helpful assistant named Alex. You are friendly, concise, and always try to give practical answers.
You remember previous conversations and use that context to give better responses over time.
When you don't know something, you say so clearly rather than guessing.A good identity prompt:
- Gives the agent a clear name and role
- Sets the tone (friendly, formal, technical, etc.)
- Defines how to handle uncertainty
- Keeps it focused on a specific domain if needed
Configure Telegram integration
In the Integrations section, enable Telegram and paste your bot token from Step 1.
That’s all Telegram needs — Hatcher handles the rest (polling, message routing, error handling).
Choose your LLM
Hermes uses your selected hosted Hatcher model by default, routed through the LLM proxy and metered with AI Credits.
BYOK is always free from Hatcher AI Credit metering. Add your own provider key if you want usage billed directly by your provider.
Launch your agent
Click Launch Agent. Hatcher will:
- Generate
config.yaml,.env, andSOUL.mdfrom your settings - Start a Hermes container with your configuration
- Connect to Telegram via the bot token
Wait for the status to show Running (usually 15–30 seconds).
Step 3: Test Your Bot
Open Telegram and find your bot by its username (e.g. @my_hatcher_bot).
Send it a message:
Hello! What can you help me with?Your bot should respond within a few seconds.
If the bot doesn’t respond within 30 seconds, check the agent status on your Hatcher dashboard. Common issues: invalid bot token, or the agent is still starting up.
How Hermes Learns Over Time
Hermes stores conversation context in persistent memory. Unlike a stateless chatbot, it:
- Remembers key facts from past conversations
- Builds context about each user over time
- Improves responses based on what it has learned
The memory is stored as structured data in the agent’s workspace (300MB on free tier). You can view and edit it from the Files tab on Pro plans.
Optional: Make Your Bot Smarter
Set commands in BotFather
Users can discover your bot’s capabilities via the / command menu. Set them up in BotFather:
/setcommandsThen list your commands:
help - Show what I can do
reset - Clear conversation history
summarize - Summarize our last conversationAdd a description and profile photo
In BotFather, use /setdescription and /setuserpic to make your bot look polished when users find it.
What’s Running in the Container
Your Hermes agent runs with these resources (free tier):
| Resource | Allocation |
|---|---|
| CPU | 1 vCPU |
| RAM | 1 GB |
| Storage | 2GB workspace |
| Auto-sleep | After 12h idle |
| Hosted AI | 500 AI Credits/month |
The free-tier container auto-sleeps after 12 hours of inactivity and wakes up when the next Telegram message arrives.
Next Steps
- Add Discord — Use the same agent on multiple platforms simultaneously → Discord guide
- Upgrade to always-on — Any paid tier removes auto-sleep and keeps your bot live 24/7 → Plans & Pricing
- Explore Hermes features — Cron jobs, skill creation, advanced memory → Hermes guide
- Use BYOK — Provider-paid model usage without spending Hatcher AI Credits → BYOK guide