This guide covers setting up Kōan with Telegram as the messaging provider.
Note: Telegram is the default provider. If you've followed the standard
INSTALL.mdsetup, you're already using Telegram — no additional configuration needed.
- A Telegram account
- Open Telegram, message @BotFather
- Send
/newbot, choose a name and username - Copy the bot token (format:
123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11)
- Open a chat with your new bot in Telegram and send any message (e.g., "hello")
- Run:
curl -s "https://api.telegram.org/botYOUR_TOKEN/getUpdates" | python3 -m json.tool
- Look for
"chat": {"id": 123456789}in the response — that number is your chat ID
Edit your .env file:
# Telegram credentials (required)
KOAN_TELEGRAM_TOKEN=123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
KOAN_TELEGRAM_CHAT_ID=987654321Optionally, you can explicitly set the messaging provider (defaults to Telegram):
KOAN_MESSAGING_PROVIDER=telegramOr in instance/config.yaml:
messaging:
provider: "telegram"make startYou should see in the logs:
[init] Messaging provider: TELEGRAM, Channel: 987654321
- Verify token:
curl "https://api.telegram.org/botYOUR_TOKEN/getMe"should return bot info - Verify chat ID: Make sure
KOAN_TELEGRAM_CHAT_IDmatches the ID fromgetUpdates - Check logs:
make logs— look for[error]entries - Restart:
make stop && make start
Your .env file is missing or the variable name is wrong. Double-check the format:
- Token: Starts with digits, then
:, then alphanumeric string (e.g.,123456789:ABC-DEF1234ghIkl-zyx57W2v1u123ew11) - Chat ID: Numeric only, no letters or
@symbol (e.g.,987654321)
- Telegram has a 4000-character limit per message. Long messages are auto-chunked.
- Duplicate messages within 5 minutes are flood-protected (first duplicate triggers a warning, subsequent ones are silently dropped).
- Polling: Kōan polls the Telegram API every 3 seconds for new messages
- No webhooks: No public URL or reverse proxy needed — works from any network
- Single chat: Kōan only responds in the configured chat ID (ignores other chats)