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

# Telegram Bot Setup

> Set up a Telegram bot for remote video monitoring control

## Step 1: Create the Bot

<Steps>
  <Step title="Access Telegram Web">
    Go to [https://web.telegram.org/](https://web.telegram.org/) and log into your Telegram account
  </Step>

  <Step title="Start Chat with BotFather">
    Open a new chat with BotFather → [https://web.telegram.org/k/#@BotFather](https://web.telegram.org/k/#@BotFather)
  </Step>

  <Step title="Initialize Bot Creation">
    1. Click **Start**
    2. Type `/newbot` and follow the instructions in the chat
  </Step>

  <Step title="Get Bot Token">
    You'll receive a message with the bot token. It should follow the format `12345812:AAHFfasdfasdf`. Store it securely.
  </Step>
</Steps>

### Example Bot Token Message

```
Done! Congratulations on your new bot. You will find it at t.me/testing_atai_bot.
Use this token to access the HTTP API:
796286017123123:AAHfDqivpCQXxM5SNt_BqBjNANddAdowHJASJU
Keep your token secure and store it safely, it can be used by anyone to control your bot.
```

## Step 2: Get Your Chat ID

There are two simple ways to get your Chat ID:

### Option 1: Using @WhatChatIDBot

<Steps>
  <Step title="Open Chat with Bot">
    Start a conversation with [@WhatChatIDBot](https://t.me/WhatChatIDBot) in Telegram
  </Step>

  <Step title="Get Your Chat ID">
    The bot will give you a number - that's your Chat ID (e.g., `908246003`)
  </Step>
</Steps>

<img src="https://mintcdn.com/archetypeai-bd6fb3cf/0LSNUGlqp3Pob7Kj/code-examples/telegram-alerts/setup/whatchatidbot-example.png?fit=max&auto=format&n=0LSNUGlqp3Pob7Kj&q=85&s=9cef27bfd748078d473a26857a50f41c" alt="WhatChatIDBot example showing Chat ID" width="1388" height="714" data-path="code-examples/telegram-alerts/setup/whatchatidbot-example.png" />

### Option 2: Using @RawDataBot

<Steps>
  <Step title="Open Chat with Bot">
    Start a conversation with [@RawDataBot](https://t.me/RawDataBot) in Telegram
  </Step>

  <Step title="Copy the ID Field">
    The bot will return JSON data. Copy the `id` field - that's your Chat ID
  </Step>
</Steps>

<img src="https://mintcdn.com/archetypeai-bd6fb3cf/o1Hx_MeBi4dgJHp7/code-examples/telegram-alerts/setup/rawdatabot-example.png?fit=max&auto=format&n=o1Hx_MeBi4dgJHp7&q=85&s=4d843feb71e2a9fcc7561ee5854543be" alt="RawDataBot JSON response showing ID field" width="1364" height="1562" data-path="code-examples/telegram-alerts/setup/rawdatabot-example.png" />

## Step 3: Add Your Credentials

Now you should have both:

* **Bot Token**: `796286017123123:AAHfDqivpCQXxM5SNt_BqBjNANddAdowHJASJU`
* **Chat ID**: `908246003`

### Update Application Code

Add these credentials to your application:

<CodeGroup>
  ```python app_telegram.py theme={"system"}
  # Update these values in your code
  BOT_TOKEN = "796286017123123:AAHfDqivpCQXxM5SNt_BqBjNANddAdowHJASJU"
  CHAT_ID = "908246003"
  ```

  ```bash Environment Variables (Recommended) theme={"system"}
  # Create .env file
  TELEGRAM_BOT_TOKEN=796286017123123:AAHfDqivpCQXxM5SNt_BqBjNANddAdowHJASJU
  TELEGRAM_CHAT_ID=908246003
  ```
</CodeGroup>

## Step 4: Test the Connection

<Steps>
  <Step title="Start the Application">
    Run the bot application: `python app_telegram.py`
  </Step>

  <Step title="Send Test Command">
    Send `/start` to your bot in Telegram
  </Step>

  <Step title="Verify Response">
    Your bot should respond with available commands and usage instructions
  </Step>
</Steps>
