Unlike Meta channels that require business verification and app review, Telegram lets support teams deploy an official branded bot in under two minutes. Yet relying on shared Telegram apps leaves client chats scattered across personal devices with zero Perfex CRM audit trail.
PolyUtilities v3.7.0 integrates the Telegram Bot API directly into Perfex CRM Unified Inbox using setWebhook secret-token verification, automatic getFile local media downloads for .ogg voice notes and photos, and instant AI transcription or auto-reply.
Confirm your OmniChat module status in the Guide to Install and Use PolyUtilities for Perfex CRM before creating your bot.
| Telegram Setting | Source / Format | Security & Routing Purpose |
|---|---|---|
| Account ID | Bot username (for example mycompany_support_bot) | Identifies bot record when running multiple Telegram bots |
| Token / API Key | HTTP API Bot Token from @BotFather (123456:AAH...) | Authenticates sendMessage and getFile media downloads |
| App / Webhook Secret | Alphanumeric secret (A-Z, a-z, 0-9, _, -) | Validated via X-Telegram-Bot-Api-Secret-Token header |
| Webhook URL | https://your-crm-domain.com/poly_utilities/omnichat/webhook/telegram | Receives real-time messages, voice clips, photos, and documents |
1. Create Your Bot and Register setWebhook With secret_token
Poly_omnichat_telegram_adapter rejects any unsigned webhook POST that omits or mismatches the X-Telegram-Bot-Api-Secret-Token header. Always save the Bot Token and Webhook Secret inside Perfex CRM first, then call Telegram’s setWebhook endpoint once over HTTPS so both sides share the identical secret token.
- Message
@BotFatheron Telegram, run/newbot, set a display name and unique_botusername, and copy the HTTP API Bot Token. - In Perfex CRM > OmniChat Settings > Channels, select Telegram Bot, enter your Bot Token and an alphanumeric Webhook Secret, and click Save Channel.
- Click the
?guide icon in OmniChat Settings to copy the pre-filledsetWebhookURL (https://api.telegram.org/botYOUR_BOT_TOKEN/setWebhook?url=...&secret_token=YOUR_SECRET) and open it once until Telegram returns{"ok":true,"result":true}.
2. Capture Voice Notes, Photos, and Trigger AI Workflows
Telegram sends customer voice clips as OGG/Opus files alongside photos, videos, and documents identified by file_id. PolyUtilities resolves each file_id via getFile, inspects it through the 10-layer file security pipeline, and hands transcripts or Vision summaries to your AI Copilot alongside channels such as Viber Business Bot and Slack Events API.
- Enable Auto-Download Inbound Media so Telegram
.oggvoice notes play inline inside Unified Inbox without opening external links. - Turn on Whisper-1, GPT-4o Mini Transcribe, or Gemini 2.5 Flash Native Audio to transcribe Telegram voice notes into searchable CRM text automatically.
- Use Automation Rules to auto-create Perfex Tickets or route urgent messages whenever spoken transcripts or typed messages match SLA keywords.
Common Pitfalls and Quick Fixes
- setWebhook succeeds but Perfex returns HTTP 403: Verify the
secret_tokenquery parameter insetWebhookmatches the saved App Secret / Webhook Secret character for character and contains onlyA-Za-z0-9_-. - Bot fails to receive group messages: Disable Group Privacy via
@BotFather(/setprivacy> Disable) if the bot must read non-command messages in Telegram groups. - Voice clips show attachment only without audio player: Confirm
getFiledownloads are enabled under Multimodal AI anduploads/poly_utilities/omnichat/inbound/is writable.
Frequently Asked Questions
Is Telegram Bot API free to connect with PolyUtilities?
Yes. Creating a bot via @BotFather and registering webhooks against Telegram Bot API costs nothing, and PolyUtilities routes every message directly to your Perfex CRM server with zero third-party middleware fees, monthly relay plans, or per-seat chat surcharges for your support agents.
How does PolyUtilities handle Telegram .ogg voice notes?
When a customer sends a Telegram voice message, the adapter captures the voice.file_id, downloads the .ogg audio locally via Telegram getFile, checks its magic bytes, and optionally transcribes it using Whisper or Gemini Native Audio right inside the message bubble.
Can I run multiple Telegram bots for different departments?
Yes. Add each bot as a distinct Telegram channel record with its Bot Username saved as Account ID, and append ?account_id=YOUR_BOT_ID to the webhook callback URL passed to setWebhook so PolyUtilities matches each bot’s token and secret token cleanly during webhook verification.
What happens if a Telegram webhook POST lacks a valid secret token?
Poly_omnichat_telegram_adapter::verify_signature() compares the incoming X-Telegram-Bot-Api-Secret-Token HTTP header against your stored webhook secret using timing-safe hash_equals(). Any forged, missing, or unauthenticated request is rejected immediately with HTTP 403 before touching any conversation or message table inside your Perfex CRM database.

Leave a Reply