This guide shows how to configure the Telegram channel in Sendbot (backend + Studio) to receive and reply to messages.

Prerequisites

  • A Telegram bot created with BotFather
  • A valid Bot Token
  • A Secret Token to validate the webhook

Backend Configuration (API)

In your API environment, both production and staging, configure:
NEXT_PUBLIC_SENDBOT_API_URL=https://api.sendbot.co
Important notes
  • NEXT_PUBLIC_SENDBOT_API_URL must point to your public API so Studio can generate the webhook URL.
  • In a local environment, use a public URL such as https://<your-ngrok>.ngrok.io and make sure HTTPS is enabled.

Webhook Configuration in Telegram

In Telegram, configure the webhook using the Bot API:
https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook
With this payload:
{
  "url": "https://api.sendbot.co/v3/integrations/telegram/{workspaceId}/telegram/{credentialsId}/webhook",
  "secret_token": "<YOUR_SECRET_TOKEN>"
}

Studio Configuration

  1. Go to Share on the bot -> Telegram.
  2. Create the credentials:
    • Bot Token
    • Secret Token
  3. Copy the Webhook URL and the Secret Token.
  4. Configure the webhook in Telegram with the URL and secret token.
  5. Enable Enable Telegram integration and publish the bot.

Production Checklist

  • NEXT_PUBLIC_SENDBOT_API_URL configured in the backend
  • Webhook configured in Telegram with secret_token
  • Credentials saved and integration enabled on the bot

Quick Troubleshooting

  • Webhook 401: invalid or missing secret token
  • No reply: make sure the webhook was registered correctly in Telegram