# Telegram

> Send task notifications from albus to a Telegram chat or topic using a bot token and chat ID.

albus can post task activity to Telegram whenever events occur in a project. Unlike Slack and Discord, Telegram uses a bot token plus a chat ID instead of an incoming webhook URL.

## Create a Telegram bot

1. Open Telegram and start a chat with [`@BotFather`](https://t.me/BotFather).
2. Send `/newbot` and follow the prompts.
3. Copy the bot token that BotFather returns. It will look like:

```
123456789:AAExampleBotToken1234567890
```

> **Warning:** Treat the bot token like a password. Anyone with the token can send messages as your bot.

## Add the bot to your destination

Add the bot to the private chat, group, supergroup, or channel where you want notifications.

- Personal chat: start a conversation with the bot and send any message.
- Add the bot to a group or supergroup, then send a message in that chat.
- A channel may require adding the bot as an administrator so it can post updates.
- Forum-style supergroups need the bot added to the group, plus the topic you want to post into.

## Find the chat ID

1. After adding the bot, send at least one message in the destination chat.
2. Open this URL in your browser, replacing `BOT_TOKEN` with your real token:

```
https://api.telegram.org/botBOT_TOKEN/getUpdates
```

3. Look for one of these fields in the JSON response:

- Private chat or group: `message.chat.id`
- Channel: `channel_post.chat.id`
- Topic/thread in a forum group: use the same chat ID, and also copy `message.message_thread_id`

Typical values look like:

```json
{
  "message": {
    "chat": {
      "id": -1001234567890
    },
    "message_thread_id": 42
  }
}
```

> **Info:** If `getUpdates` returns an empty result, send a fresh message in Telegram and reload the URL. If you see a `404`, double-check that the URL format is exactly `https://api.telegram.org/bot&lt;token&gt;/getUpdates`.

If you use your own Bot API server, open the same path on it instead, for example `https://tg.example.com/botBOT_TOKEN/getUpdates`.

## Connect Telegram in albus

1. Open **Settings** in the sidebar.
2. Under **Projects**, select the project you want to connect.
3. Open the **Integrations** tab.
4. Expand the **Telegram** section.
5. Paste your bot token.
6. Optionally enter a Bot API server URL if you run your own server. Leave it empty to use `https://api.telegram.org`.
7. Enter the chat ID.
8. Optionally enter a topic thread ID if you want messages posted into a specific Telegram forum topic.
9. Optionally add a chat label for your own reference.
10. Choose which events to subscribe to.
11. Click **Connect Telegram**.

Once connected you can enable or disable the integration with the toggle, update event subscriptions, rotate the bot token, or disconnect entirely.

## Supported events

| Event | Default | Description |
| --- | --- | --- |
| Task created | On | A new task is created in the project |
| Task status changed | On | A task moves to a different status column |
| Task priority changed | Off | A task's priority is changed |
| Task title changed | Off | A task's title is edited |
| Task description changed | Off | A task's description is edited |
| Task comment created | On | A new comment is added to a task |

You can change these toggles at any time in the integration settings.

## Message format

albus sends formatted Telegram messages with:

- The event title
- A direct link to the task in albus
- Project, status, and priority details
- The name of the user who triggered the event when available

Make sure [`KANEO_CLIENT_URL`](/docs/core/installation/environment-variables) is set to your public albus URL so task links work correctly.

## Custom Bot API server

If `api.telegram.org` is not reachable from your server, you can run your own [Telegram Bot API server](https://github.com/tdlib/telegram-bot-api) or a mirror and point albus at it. albus sends messages to `<server URL>/bot<token>/sendMessage`, so a path prefix like `https://proxy.example.com/telegram` works too.

- The URL must use `https`. Plain `http` is only accepted when `KANEO_ALLOW_PRIVATE_WEBHOOK_DESTINATIONS=true`, because the bot token is part of the request URL.
- By default albus refuses a server that resolves to a private or loopback address. If your Bot API server runs on the same host or inside your network, for example `http://127.0.0.1:8081`, set [`KANEO_ALLOW_PRIVATE_WEBHOOK_DESTINATIONS=true`](/docs/core/installation/environment-variables) on the API. The same variable lifts the check for Gitea, GitLab, and notification destinations, so only enable it on a trusted deployment.

## Updating credentials

To rotate the bot token after connecting, paste a new token in the bot token field and click **Save Changes**. If you leave the token field empty, albus keeps the currently stored token.

You can also update the chat ID, thread ID, label, and event subscriptions at any time. Changing the Bot API server URL requires entering the bot token again, so a saved token is never sent to a different server.

## Disconnecting

Click Disconnect to remove the integration. This deletes the stored Telegram configuration for that project. You can reconnect at any time with a new bot token and chat ID.
