> For the complete documentation index, see [llms.txt](https://vitrina-blogerov.gitbook.io/bloggers-showcase/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vitrina-blogerov.gitbook.io/bloggers-showcase/product-docs/product-docs-en/telegram-bot/administrator-access.md).

# Administrator access

React to deploys, comments, and external events with workflows that run on the platform.

Admin access in the Telegram bot is granted by Telegram ID. This is a separate mechanism that is not tied to the web admin panel login and password.

{% hint style="warning" %}
A Telegram administrator can perform operational actions in the bot. Add only people you can truly trust with mailings, posts, and quick settings.
{% endhint %}

### How the bot identifies an administrator

The list of administrators is stored in the setting `ADMIN_IDS` in the project database.

When a user sends `/start` or presses the admin button, the bot checks their Telegram ID:

```mermaid
flowchart LR
    A["User"] --> B["Telegram ID"]
    B --> C{"Is the ID in ADMIN_IDS?"}
    C -->|Yes| D["Admin menu available"]
    C -->|No| E["Normal user mode"]
```

### Where to manage the list

The list of Telegram administrators is managed through the web admin panel.

The backend uses the methods:

| Method                      | Purpose                              |
| --------------------------- | ------------------------------------ |
| `GET /api/admin/bot/admins` | Get the current list of Telegram IDs |
| `PUT /api/admin/bot/admins` | Save the new list of Telegram IDs    |

Data format:

```json
{
  "admin_ids": ["123456789", "987654321"]
}
```

After saving, the bot starts using the updated list from the database.

{% hint style="info" %}
You need to add the Telegram ID specifically, not the username. The username can be changed, but the Telegram ID remains constant.
{% endhint %}

### What the administrator sees

After `/start` the administrator receives a greeting, then a message that they have logged in as an administrator, and an additional keyboard.

{% tabs %}
{% tab title="Communications" %}
The administrator can send mailings to bot users and publish posts to the Telegram channel.
{% endtab %}

{% tab title="Settings" %}
The administrator can view or change the greeting, the final message after AI selection, and the final buttons.
{% endtab %}

{% tab title="Statistics" %}
The administrator can view user statistics, export an Excel file, and remove users who have blocked the bot.
{% endtab %}
{% endtabs %}

### Mailings

The administrator sends a post for mailing; the bot shows a preview, offers to add a button, and asks to confirm sending.

After confirmation, the bot copies the message to all users from the database `bot_users`.

<details>

<summary>Why the bot cannot message just anyone</summary>

Telegram does not allow a bot to message a user first. The user must start the bot at least once. After that, they are added to the database `bot_users`, and the bot will be able to send mailings to them.

</details>

### Channel posts

To publish to the channel, a configured `CHANNEL_ID`. Also, the bot must be added to the channel and have administrator rights.

If the channel is not configured or there are not enough permissions, Telegram will reject the publication, and the bot will report an error.

### Statistics and database cleanup

The administrator can see the number of bot users and the number of users who have blocked the bot.

The Excel export contains the Telegram ID, username, first name, last name, and the result of the last mailing.

Database cleanup removes only users with the status `blocked`.

### Difference from the web admin panel

{% tabs %}
{% tab title="Web admin panel" %}
Protected by login, password, and JWT. It is used to manage cards, storefront settings, the Telegram token, AI, the channel, and general project parameters.
{% endtab %}

{% tab title="Telegram admin" %}
Identified by Telegram ID. Needed for quick actions inside Telegram: mailings, posts, statistics, greeting, and quick access to the admin panel.
{% endtab %}
{% endtabs %}

### Secure granting of access

Add only the personal Telegram IDs of people who truly need access.

Remove an employee's ID if access is no longer needed.

If in doubt, first ask the person to message the bot and make sure the correct account is specified.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://vitrina-blogerov.gitbook.io/bloggers-showcase/product-docs/product-docs-en/telegram-bot/administrator-access.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
