Saltar a contenido

Integración de bots de Telegram

Esta guía explica cómo conectar su Telegram Bot al panel chat.smsbat.com.

1. Agregar el Bot al Panel

En el panel, navega hasta Mis cuentas -> Bots de Telegram.

  1. Haga clic en Agregar Bot.
  2. Complete los datos del bot de Telegram (nombre, token) y guárdelos en el sistema.
  3. Después de guardar, vaya a la configuración del bot y recupere su ID para formular la URL de devolución de llamada.

2. Opciones de integración con Chat.SMSBAT

Opción 2.1: enviar devoluciones de llamadas desde Telegram a Omni Chat

En este flujo, su servidor recibe el webhook de Telegram directamente y luego reenvía la carga útil a 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

Requisitos: - Asegúrese de que el sistema cliente envíe las devoluciones de llamadas entrantes directamente al webhook chat.smsbat.com. - Proporcione el texto/acción exacto del botón "Iniciar chat". - Proporcione el texto/acción exacto del botón "Finalizar chat".

Opción 2.2: Lógica enviada por proxy al cliente

En este flujo, SMSBAT se configura como el webhook directo en Telegram. SMSBAT recibe el evento y luego envía la devolución de llamada a su sistema.

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

Requisitos: - Proporcione la URL de devolución de llamada generada después de agregar el bot. La URL se verá así: https://restapi.smsbat.com/api/tg_callback/{ID} - Proporcione el texto/acción exacto del botón "Iniciar chat". - Proporcione el texto/acción exacto del botón "Finalizar chat".