# 5. Telegram

Control the bot from your phone and get notifications when something important happens. Set it up in **Settings → Telegram**.

***

## What you get

| Feature                 | What it does                                                                               |
| ----------------------- | ------------------------------------------------------------------------------------------ |
| 📩 **Notifications**    | Get pinged when the character dies, needs repair, needs to store, or something goes wrong. |
| 🎛️ **Remote commands** | Start, stop, and check the bot right from Telegram.                                        |
| 🔌 **Test buttons**     | One click to check the setup is working.                                                   |

***

## 1. Create a Telegram bot

1. Open Telegram and chat with [@BotFather](https://t.me/BotFather).
2. Send `/newbot` and follow the prompts — pick a name and a username.
3. BotFather gives you a **token** (a long string of letters and numbers). Copy it.

> ⚠️ Treat the token like a password — anyone with it can send messages as your bot.

## 2. Link it to the bot app

1. Open a chat with your new bot and send `/start` to it. This is required.
2. In **Settings → Telegram**, paste the token in the **Bot Token** field.
3. Click **Detect Chat ID**. The app finds the chat automatically and fills it in.

> If it says *"No messages found"*, you forgot to send `/start` to your bot first. Do it and try again.

## 3. Pick what to get notified about

Toggle the events you care about:

| Event              | When you get a message            |
| ------------------ | --------------------------------- |
| **Repair needed**  | Gear is about to break.           |
| **Storage needed** | Inventory is full.                |
| **Player died**    | Your character died.              |
| **Bot stopped**    | The bot turned off.               |
| **Bot error**      | Something went wrong.             |
| **Bot started**    | Useful if you start it remotely.  |
| **Loop completed** | A full run of the route finished. |

## 4. Test it

1. Click **Test Connection** — checks the token is valid.
2. Click **Send Test Message** — you should get a message on Telegram within a second.

***

## Remote commands

Turn on **Remote commands** to control the bot from Telegram:

| Command   | What it does                                                     |
| --------- | ---------------------------------------------------------------- |
| `/start`  | Starts the bot with whatever spot and rotation you had selected. |
| `/stop`   | Stops the bot.                                                   |
| `/status` | Tells you if the bot is running, idle, or in an error state.     |

> 💡 Only the chat you linked works. Other people messaging your bot get no reply.

> ⚠️ `/start` uses the **last spot and rotation you selected** in the app. You can't pick a different route from Telegram — open the app for that.

***

## Troubleshooting

| Problem                        | What to do                                                                        |
| ------------------------------ | --------------------------------------------------------------------------------- |
| "Detect Chat ID" finds nothing | Send `/start` to your bot from Telegram and try again.                            |
| Test message never arrives     | Make sure the bot isn't muted or blocked in Telegram, and double-check the token. |
| Remote `/start` does nothing   | Turn on **Remote commands** in the settings.                                      |
| Too many messages              | Turn off the events you don't care about.                                         |
| Says the token is invalid      | Ask BotFather for a new token and paste it again.                                 |

***

## Need Help?

Join our [Discord](https://discord.gg/3pMUfYXjra) for support.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pixelbot-docs.gitbook.io/pixelbot/configuration/telegram.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
