/ask API, renders markdown tables as PNG images, and surfaces case-law sources as tappable inline-keyboard buttons. Source code at github.com/Vaquill-AI/integrations/telegram-bot.
Features
- Per-chat conversation history (last N exchanges, configurable)
- Markdown tables rendered as styled PNG images using Pillow
- Source citations shown inline and as inline-keyboard buttons that open PDFs
- Telegram HTML sanitisation with plain-text fallback
- Automatic chunking of long answers (4096-char limit)
- Per-user rate limits (per-minute and per-day)
- Optional user ID allowlist
Prerequisites
Platform setup
1
Open BotFather
Search for @BotFather in Telegram (or open t.me/botfather) and press Start.
2
Create the bot
Send
/newbot. Provide a display name (e.g. Vaquill Legal AI), then a username ending in bot (e.g. vaquill_legal_bot). BotFather replies with your API token - copy it as TELEGRAM_BOT_TOKEN.3
Register slash commands (optional)
Send The bot also sets these on startup, but doing it manually makes them appear before the first run.
/setcommands, choose your bot, and paste:4
Description and avatar (optional)
/setdescription and /setabouttext set the text shown on the bot’s profile. /setuserpic sets the avatar (use a square image at least 512x512).Quickstart
Local development uses polling mode - no public URL or HTTPS certificate required.1
Clone and install
2
Configure
3
Run
INFO - Vaquill Telegram bot starting (mode=standard). Open Telegram, search your bot by username, tap Start, and ask:Polling vs webhook
To switch to webhook mode, deploy behind HTTPS and register:
getWebhookInfo. Switch back to polling any time with deleteWebhook.
Configuration
Top env vars. Full list in the repo.env.example.
To find your own Telegram user ID, message @userinfobot.
Commands
Any non-command message is treated as a legal question.
Deployment
Docker
The included Dockerfile usespython:3.11-slim and installs DejaVu fonts for table-image rendering.
Cloud hosts
Render
Deploy as a Background Worker (not Web Service) - polling does not need an HTTP port.
render.yaml is included in the repo.Railway
railway init && railway up. Add TELEGRAM_BOT_TOKEN and VAQUILL_API_KEY in the Variables tab.VPS + systemd
Plain systemd unit with
Restart=always. No reverse proxy needed.Fly.io
fly launch, fly secrets set ..., fly deploy.render.yaml:
Troubleshooting
Related
Twilio-based, comparable consumer-messenger surface.
Signal
Privacy-focused alternative.
Chatbots overview
Compare all six platforms.
Authentication
How Vaquill API keys work.

