Channels

Telegram

Connect a Telegram bot to handle customer messages with AI.

Create a Telegram bot and connect it to Vlozi. The AI will respond to messages sent to your bot automatically.

Creating a Telegram bot

  1. Open Telegram and message @BotFather
  2. Send /newbot
  3. Choose a name and username for your bot (username must end in bot, e.g., mybusiness_bot)
  4. BotFather sends you a bot token — copy it

Connecting in Vlozi

  1. Go to Chatbot → Channels → Add channel → Telegram
  2. Paste your bot token
  3. Vlozi validates the token (calls Telegram's /getMe), registers a webhook, and creates the channel

The channel is now live. Messages to your Telegram bot are routed to the AI automatically.

How messages flow

Customer sends message to your Telegram bot
        │
        ▼
Telegram delivers update to Vlozi (POST /chatbot/webhooks/telegram/{tenantId})
        │
        ▼
Webhook secret token verified (Telegram-Secret-Token header)
        │
        ▼
Customer Telegram user ID resolved to CI contact
        │
        ▼
Session found or created for this chat ID
        │
        ▼
AI processes message → replies via Telegram Bot API

Webhook security

Vlozi sets a random secret token when registering the Telegram webhook. Every incoming update carries this token in the Telegram-Secret-Token header. Requests without the correct token are rejected.

Supported message types

Type Supported
Text messages ✅
Photos / media ❌ Ignored
Stickers ❌ Ignored
Commands (/start, /help) ⚠️ Treated as plain text
Forwarded messages ❌ Ignored
Bot messages (from other bots) ❌ Ignored

Only plain text messages from human users trigger a bot response.

Response format

Responses are sent in Markdown format (Telegram's parse_mode: Markdown). If a response contains formatting that Telegram can't parse, the bot automatically retries with plain text.

Session handling

Session keys are based on the Telegram chat ID (format: tg-{chatId}). Each unique Telegram user gets their own session. Group chats are not supported — the bot should be used in private chats only.

Multiple bots

You can connect multiple Telegram bots to the same account — each with its own bot token and channel row. All bots share the same AI configuration and knowledge base.

Bot token security

Bot tokens are stored AES-256-GCM encrypted in the database. Tokens are never logged or returned in API responses.

Disconnecting

In Chatbot → Channels → [channel] → Delete. Vlozi calls Telegram's /deleteWebhook before removing the channel. You can reconnect the same bot token at any time.

Testing your bot

After connecting, message your bot on Telegram. You should receive an AI-powered reply within a few seconds. If not:

  1. Check that the channel status is Active (not Paused or Auth Failed)
  2. Verify the bot token is correct — delete and reconnect if unsure
  3. Check the session in Chatbot → Inbox to see if the message was received
Chatbot · ChannelsEdit on GitHub