Connect Telegram
This guide walks you through connecting a Telegram bot to Manasvi so you can send messages directly from your phone or Telegram desktop app.
What you'll need: A Telegram account. That's it.
How it works
- You create a bot in Telegram using BotFather
- Telegram gives you a secret token that identifies your bot
- Manasvi's ingress service polls the Telegram API for new messages (no public URL needed for local development)
- Manasvi processes messages and replies through the same bot
Step 1 — Create a Telegram bot
- Open Telegram and search for @BotFather
- Start a chat and type
/newbot - Follow the prompts — give your bot a name and a username
- BotFather will give you a bot token that looks like:
7123456789:AAEOm3xyzABCdef...
Keep this token safe — it's the password for your bot.
Step 2 — Add the channel via CLI
pnpm manasvi channels add telegram
The CLI will prompt you for your bot token and write it to .env.local:
Add channel telegram
? Telegram bot token: ****************************
✔ Telegram channel configured
→ Restart services to apply: pnpm manasvi restart
That's it for local development. Polling mode is the default — no public URL or ngrok required.
Step 3 — Restart and verify
pnpm manasvi restart
pnpm manasvi channels status
You should see:
Channels
telegram ● active polling
Send a message to your bot in Telegram. Manasvi will respond.
Using webhook mode (optional)
If you want to use webhook mode instead of polling — for example, to reduce latency in production — you need a publicly accessible URL.
With ngrok (local development)
ngrok http 4101
Copy the URL ngrok gives you (e.g., https://abc123.ngrok-free.app), then add it to .env.local:
TELEGRAM_WEBHOOK_URL=https://abc123.ngrok-free.app
Then register the webhook with Telegram:
curl -X POST "https://api.telegram.org/bot<TOKEN>/setWebhook" \
-H "Content-Type: application/json" \
-d '{
"url": "https://abc123.ngrok-free.app/channels/telegram/webhook",
"secret_token": "<your-TELEGRAM_WEBHOOK_SECRET>"
}'
What Manasvi does with Telegram messages
When a Telegram message arrives:
- The ingress service verifies the source (polling: always Telegram API; webhook: validates the secret)
- The user's Telegram ID becomes their principal identity (
telegram:12345) - The message is normalized and routed through the full agent pipeline
- The response is sent back to the same chat
Troubleshooting
Run pnpm manasvi doctor — it checks ingress service health and Telegram configuration.
No response from bot:
pnpm manasvi status
# Make sure ingress-service shows healthy
Wrong token:
pnpm manasvi channels remove telegram
pnpm manasvi channels add telegram
# Re-enter the correct token