MxChat Telegram Integration

Connect your MxChat chatbot to Telegram for live agent support. When visitors request human help, conversations are routed to your Telegram supergroup where agents can respond in real-time.

📋 Requirements
  • MxChat plugin installed and activated
  • No Pro licence required — the Telegram live agent handoff is part of the free core plugin
  • Telegram account (free)
  • SSL certificate on your website (https://)

Quick Setup

Follow these steps to connect MxChat to Telegram. The entire setup takes about 5 minutes.

  1. Create a Telegram Bot

    Open Telegram and search for @BotFather. Send the command /newbot and follow the prompts to name your bot.

    BotFather will give you a Bot Token that looks like this:

    7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    Save this token – you’ll need it in step 4.

  2. Create a Supergroup with Topics

    Create a new Telegram group and convert it to a supergroup with topics enabled:

    • Create a new group in Telegram
    • Add your bot (the one you just created) to the group
    • Open group settings and enable “Topics”
    • Make your bot an administrator with permission to manage topics
    ✅ Tip

    When creating the group, add your bot immediately. This ensures the bot can see all messages from the start.

  3. Get Your Group ID

    Add @raw_data_bot to your group temporarily. It will display your group’s chat ID, which looks like:

    -1001234567890

    Copy this ID, then remove @raw_data_bot from the group.

  4. Configure MxChat Settings

    In your WordPress admin, go to MxChat → Settings → Integrations → Telegram and enter:

    Setting Value
    Bot Token Your token from BotFather
    Group Chat ID Your supergroup ID (starts with -100)
    Webhook Secret Any random string (auto-generated)

    Click Save Settings.

  5. Set the Webhook

    Click the “Set Webhook” button in MxChat settings. This tells Telegram where to send messages from your agents.

    You should see a success message. Your integration is now active!

💡 That’s it!

When a visitor requests a live agent on your website, a new topic will be created in your Telegram group. Your agents can reply directly in Telegram and messages will appear on your website in real-time.

Core Features

🗂️ Organized Topics

Each visitor conversation gets its own forum topic. No message chaos – just clean, organized support threads.

🔄 Real-Time Sync

Messages sync instantly between your website and Telegram. Visitors see agent replies immediately.

📱 Mobile Support

Agents respond from the Telegram app on any device. No special software or dashboard needed.

🔒 Secure Webhooks

Secret token verification ensures only legitimate messages from Telegram are processed.

📜 Context Transfer

The last 10 messages of the conversation are shared with agents as readable text, so they have context before they reply.

🤖 AI Fallback

Visitors can switch back to AI assistance anytime by typing “Switch to AI” in the chat.

How It Works

Here’s the flow when a visitor requests live agent support:

  1. Visitor Requests Help

    A visitor clicks “Talk to a human” or types a request for live support in your chatbot.

  2. Topic Created

    MxChat creates a new topic in your Telegram supergroup with the visitor’s session info, the current message, and the last 10 messages of the conversation.

  3. Agent Responds

    Any team member in the Telegram group can reply to the topic. Their message is sent to the visitor.

  4. Conversation Continues

    Messages flow bidirectionally until the conversation ends or the visitor switches back to AI.

  5. Agent Ends the Conversation

    Type #close, #end, #disconnect, or #done in the topic to end the session. MxChat closes the topic and returns the visitor to the AI assistant. Closing the topic from Telegram itself does the same. If that visitor asks for an agent again, MxChat opens a fresh topic rather than reusing the closed one.

Telegram Setup Details

Bot Permissions

Your bot needs the following admin permissions in the supergroup:

  • Manage Topics – Create new topics for each conversation
  • Send Messages – Post visitor messages to topics
  • Delete Messages – Optional, for cleanup

Converting to Supergroup

If your group isn’t already a supergroup, Telegram will automatically convert it when you enable topics. You can also manually convert by:

  1. Opening group settings
  2. Going to “Group Type”
  3. Selecting “Supergroup”
⚠️ Important

Topics must be enabled for the integration to work. Regular groups without topics are not supported because we need separate threads for each visitor conversation.

MxChat Settings

Setting Description Required
Bot Token The API token from BotFather for your Telegram bot Yes
Group Chat ID Your supergroup’s numeric ID (starts with -100) Yes
Webhook Secret Random string for webhook verification (auto-generated) Yes
Away Message Message shown when no agents are available No
Welcome Message Initial message when live chat connects No

Webhook Setup

The webhook allows Telegram to send agent messages to your website. MxChat handles this automatically when you click “Set Webhook”.

Manual Webhook Setup

If automatic setup fails, you can set the webhook manually using this URL in your browser:

https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook?url=https://yoursite.com/wp-json/mxchat/v1/telegram-webhook&secret_token=<YOUR_SECRET>

Replace:

  • <YOUR_BOT_TOKEN> with your actual bot token
  • yoursite.com with your domain
  • <YOUR_SECRET> with your webhook secret

Verify Webhook Status

Check if your webhook is set correctly:

https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getWebhookInfo

Troubleshooting

Messages not appearing on website

Agent replies in Telegram aren’t showing on the visitor’s chat widget.

Solution:

1. Verify the webhook is set correctly using getWebhookInfo
2. Ensure your site has a valid SSL certificate (https)
3. Check that your webhook secret in MxChat matches what was sent to Telegram

Topics not being created

When visitors request live chat, no topic appears in the Telegram group.

Solution:

1. Confirm your bot is an admin in the supergroup
2. Verify the bot has “Manage Topics” permission
3. Double-check the Group Chat ID is correct (should start with -100)

Webhook returns 401/403 error

The webhook endpoint is rejecting messages from Telegram.

Solution:

1. Regenerate the webhook secret in MxChat settings
2. Click “Set Webhook” again to update Telegram
3. If using a security plugin, whitelist the webhook endpoint

Bot not responding in group

The bot was added to the group but doesn’t react to anything.

Solution:

1. Remove and re-add the bot to the group
2. Make sure the bot is set as administrator
3. Check that “Group Privacy” is disabled for the bot in BotFather (/setprivacy → Disable)

Frequently Asked Questions

Do I need a paid Telegram account?

+

No. Telegram is completely free for personal and business use. Creating bots and supergroups costs nothing.

How many agents can use the Telegram group?

+

Unlimited. Anyone in the supergroup can see and respond to visitor conversations. Messages show which agent sent them.

What happens when all agents are offline?

+

Visitors see your configured “away message.” They can also type “Switch to AI” to return to chatbot assistance anytime.

Can I use Telegram and Slack at the same time?

+

Yes. Slack, Telegram and Webhook are three independent handoffs — each is enabled on its own and each has its own availability schedule, so you can run more than one, and the chatbot only offers a destination that is currently inside its hours. If several are enabled, the bot picks one per conversation.

Are conversations saved?

+

Yes. All messages are stored in MxChat conversation history on your WordPress site. Telegram also keeps a copy in your supergroup topics.

Can visitors send images or files?

+

Currently, the integration supports text messages. Image and file sharing may be added in future updates.

🚀 Ready to get started?

Download the MxChat Telegram add-on and follow the Quick Setup guide above. Most users complete setup in under 5 minutes!