Skip to content

Telegram Bot Integration

This guide explains how to connect your Telegram Bot to the chat.smsbat.com panel.

1. Adding the Bot to the Panel

In the dashboard, navigate to My Accounts -> Telegram bots.

  1. Click on Add Bot.
  2. Fill in the Telegram bot data (name, token) and save it in the system.
  3. After saving, go to the bot settings and retrieve its ID to formulate the callback URL.

2. Integration Options with Chat.SMSBAT

Option 2.1: Proxying callbacks from Telegram to Omni Chat

In this flow, your server receives the Telegram webhook directly and then forwards the payload to SMSBAT.

sequenceDiagram
    participant Client as Client Server
    participant Tg as Telegram
    participant Proxy as SMSBAT Proxy
    participant Chat as Omni Chat
    actor Operator

    Client->>Tg: Send data to bot
    Tg->>Client: Callback from Telegram
    Client->>Proxy: Forward Telegram callback to SMSBAT
    Proxy->>Chat: Reaction to trigger message
    Operator->>Chat: Review and respond
    Chat->>Tg: Interaction with Telegram

Requirements: - Ensure the client system proxies the incoming callbacks directly to the chat.smsbat.com webhook. - Provide the exact text/action of the "Start Chat" button. - Provide the exact text/action of the "End Chat" button.

Option 2.2: Proxied logic back to the client

In this flow, SMSBAT is set as the direct webhook in Telegram. SMSBAT receives the event and then proxies the callback back to your system.

sequenceDiagram
    participant Client as Client Server
    participant Tg as Telegram
    participant Proxy as SMSBAT Proxy
    participant Chat as Omni Chat
    actor Operator

    Client->>Tg: Send data to bot
    Tg->>Proxy: Callback on events from Telegram
    Proxy->>Client: Forward Telegram callback to Client
    Proxy->>Chat: Reaction to trigger message
    Operator->>Chat: Review and respond
    Chat->>Tg: Operator interaction with Telegram

Requirements: - Provide the generated callback URL formulated after adding the bot. The URL will look like: https://restapi.smsbat.com/api/tg_callback/{ID} - Provide the exact text/action of the "Start Chat" button. - Provide the exact text/action of the "End Chat" button.