Bot platform adapters now ship in the
praisonai-bot package. praisonai bot serve still works exactly as documented here; for a standalone install see praisonai-bot Migration.Quick Start
Simple — works with any vision model
No configuration needed. Point a vision-capable agent at your bot.Send the bot a photo (with or without a caption). The agent sees the image and responds.
How It Works
| Step | What happens |
|---|---|
| Download | WhatsApp: fetches via Graph API by media id. Telegram: uses get_file() → download_to_drive() |
| Size cap | File rejected if size exceeds max_inbound_media_bytes. Default: 20 MiB |
| Magic-byte check | File header bytes checked against declared content-type — prevents type confusion |
| SSRF guard | URL must use http/https and resolve to a public IP — rejects loopback, link-local, and RFC-1918 ranges |
| Forward | Validated path passed to agent.chat(attachments=[path]) |
Platform Coverage
| Platform | Media types | Caption support |
|---|---|---|
| WhatsApp (Cloud API) | Photos, documents | ✅ Caption forwarded as prompt |
| Telegram | Photos, all documents | ✅ Caption forwarded as prompt |
Telegram registers a
PHOTO | Document.ALL handler — both photos and any document type (PDF, DOCX, etc.) flow through the same validation pipeline.Configuration
| Option | Type | Default | Description |
|---|---|---|---|
max_inbound_media_bytes | int | 20971520 | Maximum file size in bytes. 0 = disable inbound media. |
BotConfig:
Common Patterns
Photo + question (most common)
The user sends a photo with a caption asking a question. The caption becomes the prompt; the image is the attachment.Document analysis
Send a PDF or Word document. The agent reads the content via vision.Oversized file rejected
Files abovemax_inbound_media_bytes are silently dropped. Only the caption text is forwarded.
Non-vision agent (backward compatible)
Ifagent.chat() does not accept attachments, the adapter skips the file gracefully.
Best Practices
Set a tighter cap for public bots
Set a tighter cap for public bots
The default 20 MiB is generous. For public-facing bots, set 2–5 MiB to reduce processing time and storage use.
Disable with 0 for text-only agents
Disable with 0 for text-only agents
If your agent doesn’t use vision, set
max_inbound_media_bytes=0. Users still get a response — just from the caption text alone.Watch logs for SSRF rejects
Watch logs for SSRF rejects
The SSRF guard logs rejections at WARNING level. If you see unexpected rejections in production, check that the platform’s media CDN URLs resolve to public IPs.
Use gpt-4o or claude-3 for vision
Use gpt-4o or claude-3 for vision
Not all models support vision. Pass a vision-capable model to see image attachments.
Related
WhatsApp Bot
WhatsApp setup, Cloud API, Web mode, and message filtering
Messaging Bots
All supported platforms: Telegram, Discord, Slack, WhatsApp
Platform-Aware Agents
Session context, channel directory, and
BotSessionManager parametersBot Streaming Replies
Live streaming responses for Telegram, Slack, and Discord

