Documentation
Notifications

Telegram

Configure Telegram notifications and send messages from GoLiveKit.

AI Skill for notifications

Prompt: Type /notifications in your Copilot / Cursor or other chat to use skill with the provided context.
/notifications Add notification sending for [describe action/event].

This guide shows how to:

  • Create a Telegram bot
  • Get your bot token
  • Create a group and connect the bot
  • Get the group chat ID
  • Send notifications from your code

Environment variables

Add the following variables to your .env:

TELEGRAM_BOT_TOKEN=123456789:your_bot_token
TELEGRAM_CHANNEL_ID=1001234567890

Both variables are optional. If one is missing, the notifier safely skips sending.

1. Create a Telegram bot

  1. Open Telegram and search for @BotFather.
  2. Start a chat and run /newbot.
  3. Enter a display name for your bot.
  4. Enter a unique bot username ending in bot (for example golivekit_notify_bot).
  5. Copy the token from BotFather.

Save this token as TELEGRAM_BOT_TOKEN.

2. Create a group and add the bot

  1. Create a new Telegram group.
  2. Add your bot to the group.
  3. Promote the bot to admin if your group permissions require it.

3. Get the group chat ID

The Easiest Way (Using an ID Bot):

  1. Add @GetIDsBot to your group.
  2. The bot will instantly post the Chat ID for that group.
  3. Once you have the ID, you can remove that bot.

Telegram groups use negative chat IDs. In this project, keep only the numeric part in env (TELEGRAM_CHANNEL_ID) and the code adds the - prefix.

Use this URL in your browser (replace <BOT_TOKEN>):

https://api.telegram.org/bot<BOT_TOKEN>/getUpdates

Then send any message in the group and refresh the URL. Look for:

{
  "message": {
    "chat": {
      "id": -1001234567890,
      "title": "My Project Alerts"
    }
  }
}

Set TELEGRAM_CHANNEL_ID=1001234567890 (without -).

4. Send notifications from code

Use the default notifier

import notify from '@/lib/notify';

await notify('*Build succeeded* on production');

Use Telegram provider directly

import { notifyTelegram } from '@/lib/notify/providers/telegram';

const sent = await notifyTelegram([
  '*Deployment completed*',
  '',
  'Environment: `production`',
  'Commit: `abc1234`',
].join('\n'));

if (!sent) {
  console.error('Telegram notification was not sent');
}

5. How to test notifications

To verify your setup, open this endpoint in your browser or call it with any HTTP client:

http://localhost:3000/api/v1/test/notify/telegram

It sends a test Telegram message using your configured credentials.

If TELEGRAM_BOT_TOKEN or TELEGRAM_CHANNEL_ID is missing, or Telegram responds with a non-2xx status, the helper logs the failure and returns false.

On this page