Fullstack

Telegram Bot Setup

The Telegram bot connects to the same Aomi backend as the web app. Messages are processed by the same AI, with the same tools and capabilities. No frontend deployment needed -- configure everything in a single TOML file.

Configuration File

Create a bot.toml file in your project root. The bot reads all settings from this file:

enabled = true
bot_token = "YOUR_BOT_TOKEN"
dm_policy = "open"
group_policy = "mention"
mini_app_url = "https://your-app.com/telegram-wallet"
streaming = true
server_wc_enabled = false
# allow_from = [123456789, 987654321]

Configuration Options

OptionTypeDescription
enabledboolEnable or disable the bot entirely.
bot_tokenstringTelegram Bot API token from BotFather.
dm_policystringWho can message the bot in DMs. See below.
group_policystringHow the bot responds in group chats. See below.
allow_fromint[]Telegram user IDs allowed when dm_policy = "allowlist".
mini_app_urlstringHTTPS URL for the wallet mini-app.
streamingboolStream responses in real time or send a single message when complete.
server_wc_enabledboolEnable server-side WalletConnect as an alternative to the mini-app.

dm_policy

ValueBehavior
"open"Anyone can DM the bot.
"allowlist"Only users in allow_from can DM.
"disabled"Bot ignores all DMs.

group_policy

ValueBehavior
"mention"Responds only when mentioned (@bot_name help).
"always"Responds to every message in the group.
"disabled"Bot ignores all group messages.

Transport Modes

The bot supports two transport modes for receiving updates from Telegram.

Long Polling (Default)

When no [webhook] section is present, the bot uses long polling. Simpler to set up, works without a public URL.

# No [webhook] section = long polling mode
enabled = true
bot_token = "YOUR_TOKEN"

Webhook

For production deployments, webhooks are more efficient. Telegram sends updates directly to your server via HTTPS POST.

[webhook]
url = "https://bot.example.com/webhook"
addr = "0.0.0.0:8443"
FieldDescription
urlPublic HTTPS URL that Telegram will POST updates to.
addrLocal bind address for the webhook HTTP server.

The url must be publicly accessible and use HTTPS. Use a reverse proxy (nginx, Cloudflare Tunnel, ngrok) to terminate TLS if needed.

Example Configurations

Development

enabled = true
bot_token = "YOUR_TOKEN"
dm_policy = "open"
group_policy = "mention"
mini_app_url = "http://localhost:3000"
streaming = true

Production (Restricted Access)

enabled = true
bot_token = "YOUR_TOKEN"
dm_policy = "allowlist"
group_policy = "mention"
mini_app_url = "https://app.yourcompany.com/wallet"
streaming = true
allow_from = [111111111, 222222222]

[webhook]
url = "https://bot.yourcompany.com/webhook"
addr = "0.0.0.0:8443"

Production (Group-Only)

enabled = true
bot_token = "YOUR_TOKEN"
dm_policy = "disabled"
group_policy = "always"
mini_app_url = "https://app.yourcompany.com/wallet"
streaming = true

Next Steps

  • Building Apps -- define tools, preambles, and model selection for your bot's backend.
  • Wallet Integration -- connect wallet features to the Telegram mini-app.
  • Apps -- route bot traffic to the correct backend app.

On this page