Skip to Content
TutorialsBuild a Telegram Bot with Hermes

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:


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:

/newbot

BotFather will ask for:

  1. A name for your bot (e.g. “My Hatcher Assistant”) — this is the display name
  2. A username for your bot (e.g. my_hatcher_bot) — must end in bot, must be unique

Copy your bot token

BotFather will reply with a token that looks like:

5839201847:AAF2kJdV9Qg3mNpXwT8vRkLzHyC1oBsE4Xo

Copy 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:

  1. Generate config.yaml, .env, and SOUL.md from your settings
  2. Start a Hermes container with your configuration
  3. 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:

/setcommands

Then list your commands:

help - Show what I can do reset - Clear conversation history summarize - Summarize our last conversation

Add 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):

ResourceAllocation
CPU1 vCPU
RAM1 GB
Storage2GB workspace
Auto-sleepAfter 12h idle
Hosted AI500 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
Last updated on