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
| Option | Type | Description |
|---|---|---|
enabled | bool | Enable or disable the bot entirely. |
bot_token | string | Telegram Bot API token from BotFather. |
dm_policy | string | Who can message the bot in DMs. See below. |
group_policy | string | How the bot responds in group chats. See below. |
allow_from | int[] | Telegram user IDs allowed when dm_policy = "allowlist". |
mini_app_url | string | HTTPS URL for the wallet mini-app. |
streaming | bool | Stream responses in real time or send a single message when complete. |
server_wc_enabled | bool | Enable server-side WalletConnect as an alternative to the mini-app. |
dm_policy
| Value | Behavior |
|---|---|
"open" | Anyone can DM the bot. |
"allowlist" | Only users in allow_from can DM. |
"disabled" | Bot ignores all DMs. |
group_policy
| Value | Behavior |
|---|---|
"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"| Field | Description |
|---|---|
url | Public HTTPS URL that Telegram will POST updates to. |
addr | Local 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 = trueProduction (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 = trueNext 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.