Skip to main content

Telegram

KhunQuant connects to Telegram via the Telegram Bot API. The TelegramChannel adapter translates incoming Telegram messages into the internal event bus format and routes responses back. Telegram is the recommended starting channel due to its straightforward setup and first-class voice transcription support.

Capabilities

  • Typing indicator (TypingCapable)
  • Message editing (MessageEditor)
  • Emoji reactions (ReactionCapable)
  • Slash command menus (CommandRegistrarCapable)
  • Voice message transcription (via Whisper)
  • Photo, audio, and document handling

Configuration

Add to ~/.khunquant/config.json:

{
"channels": {
"telegram": {
"enabled": true,
"token": "TELEGRAM_BOT_TOKEN",
"allow_from": ["@your_username"],
"reasoning_channel_id": "-100xxxxxxxxxx",
"base_url": "",
"proxy": ""
}
}
}

Store the bot token in ~/.khunquant/.security.yml:

channels:
telegram:
token: "1234567890:AAF..."
FieldTypeDescription
enabledboolEnable the Telegram channel
tokenSecureStringBot token from @BotFather
allow_from[]stringAllowlist of Telegram usernames or chat IDs
reasoning_channel_idstringOptional channel ID for streaming reasoning output
base_urlstringCustom Telegram API server endpoint (optional)
proxystringNetwork proxy in socks5:// or http:// format (optional)

Setup steps

  1. Open Telegram and start a chat with @BotFather.
  2. Send /newbot and follow the prompts to create a bot — copy the authentication token.
  3. Contact @userinfobot to retrieve your numeric user ID.
  4. Add the token to .security.yml and your user ID to allow_from.
  5. Start KhunQuant — it will begin polling for messages immediately.

Built-in bot commands

Once the bot is running, the following commands are available inside Telegram:

CommandDescription
/startDisplay the welcome message
/helpShow available commands and usage
/showPrint the current active configuration
/listList all available configuration options

Voice transcription

To enable automatic transcription of voice messages, configure a Whisper-compatible model in your provider settings:

{
"asr": {
"model": "groq/whisper-large-v3",
"api_key": "YOUR_GROQ_API_KEY"
}
}

Obtain a free API key from console.groq.com.

Group chats

Add the bot to a group, then set allow_from to the group chat ID. Use group_trigger settings to control whether the bot responds to every message or only when explicitly mentioned.

Regional restrictions

If Telegram is blocked in your region, set the proxy field to a socks5:// or http:// proxy address.