> ## Documentation Index
> Fetch the complete documentation index at: https://midway.hazyio.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Telegram notifications

> Connect Midway to a Telegram chat with a bot

## Create a Telegram bot

1. Open [BotFather](https://telegram.me/BotFather) in Telegram and send `/newbot`.
2. Follow the instructions to name your bot and choose its username.
3. Copy the bot token that BotFather provides. Keep it private; anyone with the token can control your bot.

## Find your chat ID

1. Open your new bot in Telegram and send `/start`.
2. Open `https://api.telegram.org/bot<TOKEN>/getUpdates`, replacing `<TOKEN>` with your bot token.
3. In the response, copy the value of `result[0].message.chat.id`.

If `result` is empty, send another message to your bot and reload the URL.

## Add Telegram to Midway

Run the Midway setup command and paste the bot token and chat ID when prompted:

```bash theme={null}
midway init
```

By default, Midway sends notifications to all configured methods. To restrict delivery, define `notification.send_to` and include `Telegram`; configured methods left out of the list will not receive notifications. With `pick_from: All`, Midway sends through every method listed there:

```yaml theme={null}
notification:
	send_to:
		- Telegram
	pick_from: All
```

`pick_from` can further select a subset of the methods in `send_to` for each notification.

You can also add them directly to `midway.yaml` under `tokens.telegram`:

```yaml theme={null}
tokens:
	telegram:
		token: "BOT_TOKEN"
		chat_id: 123456789
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.