Enbbox Docs

Telegram

Integrate Telegram with Enbbox for chat notifications. Send notifications to Telegram users and groups via Bot API.

Overview

Telegram is a messaging platform with a powerful Bot API. Enbbox uses Telegram Bots to send notifications directly to users or groups.

[!IMPORTANT] Telegram requires a Bot Token from BotFather and the recipient's Chat ID. Unlike webhook-based providers, you must create a Telegram bot and have users interact with it first.

Step 1: Create a Telegram Bot

  1. Open Telegram and search for @BotFather
  2. Start a conversation and send /newbot
  3. Choose a name for your bot (e.g., "My App Notifications")
  4. Choose a username for your bot (must end in bot, e.g., myapp_notify_bot)
  5. BotFather will respond with your Bot Token — save it securely
Use this token to access the HTTP API:
7123456789:AAHxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

[!CAUTION] Keep your Bot Token secret. Anyone with the token can control your bot.

Step 2: Get the Chat ID

The Chat ID identifies who receives the notification — a user, group, or channel.

For a User

  1. Have the user open your bot in Telegram and click Start
  2. Send any message to the bot
  3. Call the Telegram API to find the chat ID:
curl https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  1. In the response, find "chat": { "id": 123456789 } — this is the user's chat ID

For a Group

  1. Add your bot to the group
  2. Send a message in the group
  3. Call getUpdates as above — the group chat ID will be a negative number (e.g., -987654321)

For a Channel

  1. Add your bot as an administrator to the channel
  2. The chat ID is @channel_username or use getUpdates after posting

Step 3: Connect to Enbbox

  1. Navigate to Integrations in the Enbbox dashboard
  2. Click Add Provider → select ChatTelegram
  3. Enter your Bot Token from Step 1
  4. Click Test Connection to verify the token is valid
  5. Activate the integration

Step 4: Configure Subscriber Credentials

Store each subscriber's Telegram chat ID in their credentials:

import { SubscriberCredentialsApi, Configuration } from "@enbbox/api";

const config = new Configuration({ accessToken: "your-api-key" });
const credentialsApi = new SubscriberCredentialsApi(config);

await credentialsApi.setCredentials("subscriber-123", "telegram", {
  credentials: { chat_id: "123456789" },
});

[!NOTE] The chat_id is a numeric string. For groups it's negative (e.g., "-987654321").

Step 5: Send a Test Notification

Create a workflow with a Chat step, then trigger it:

import { EventsApi, Configuration } from "@enbbox/api";

const config = new Configuration({ accessToken: "your-api-key" });
const eventsApi = new EventsApi(config);

await eventsApi.triggerEvent({
  name: "welcome-message",
  to: { subscriberId: "subscriber-123" },
  payload: { message: "Hello from Enbbox! 🎉" },
});

Troubleshooting

IssueSolution
Bot token invalidRegenerate via /token command in BotFather
Chat not foundEnsure the user has clicked "Start" on your bot
Group messages not receivedDisable "Privacy Mode" via /setprivacy in BotFather
Rate limitedTelegram limits bots to ~30 msg/sec. Use the Enbbox queue for throttling

On this page