Telegram Setup
Clawbolt uses a Telegram bot as its messaging interface. Here’s how to set one up.
Create a bot
Section titled “Create a bot”- Open Telegram and search for @BotFather
- Send
/newbotand follow the prompts - Choose a name and username for your bot
- Copy the bot token (looks like
123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11) - Set it in your
.env:
TELEGRAM_BOT_TOKEN=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11Webhook auto-registration
Section titled “Webhook auto-registration”When using Docker Compose, the webhook is registered automatically on startup:
- Docker Compose starts a Cloudflare Tunnel alongside the app
- The tunnel creates a public HTTPS URL (a random
*.trycloudflare.comdomain) - The app discovers the tunnel URL and calls Telegram’s
setWebhookAPI
No Cloudflare account or auth token is required. Check the tunnel URL with:
docker compose logs tunnelManual webhook registration
Section titled “Manual webhook registration”If you’re running without Docker (e.g., local development), register the webhook manually:
# Start a tunnelcloudflared tunnel --url http://localhost:8000
# Copy the https://*.trycloudflare.com URL from the output, then:curl -X POST "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook" \ -H "Content-Type: application/json" \ -d '{"url": "https://<your-tunnel-url>/api/webhooks/telegram"}'Access control
Section titled “Access control”Clawbolt rejects all incoming messages by default. You must configure at least one allowlist:
# Allow only specific chat IDsTELEGRAM_ALLOWED_CHAT_IDS=123456789,987654321
# Allow only specific usernamesTELEGRAM_ALLOWED_USERNAMES=johndoe,janedoe
# Or allow all users explicitlyTELEGRAM_ALLOWED_CHAT_IDS=*If both are set, a message is allowed when EITHER the chat ID or username matches.
Verify the webhook
Section titled “Verify the webhook”curl "https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getWebhookInfo"This returns the current webhook URL, pending update count, and any errors.