# 6. Telegram Application Configuration ## 6.1 Minimum Working Loop The minimum working loop in this chapter can be summarized as follows: > Telegram message trigger -> **Gateway** routes the message to the email **Agent** -> `email-fetch` retrieves emails -> `mail-agent` performs structured analysis -> `feishu-send` pushes the result back to the group chat. In this loop, each component has a clear role. 1. `Gateway`: Receives Telegram events and routes sessions. 2. `Agent`: Determines the workflow and selects the required **Skill**. 3. `Skills`: Handle email retrieval, analysis, and message pushing. 4. `Workflow`: Connects retrieval, analysis, and pushing into a fixed process. **This chapter covers the first and most important part of the loop: connecting Telegram to the OpenClaw Gateway. The email and Telegram integration will be covered in later chapters.** ## 6.2 Preparation * **Step 1: Confirm that OpenClaw is running properly.** Run the following commands in the terminal to confirm that the **Gateway** status is normal and the environment has no configuration issues. ```bash openclaw gateway status openclaw doctor ``` * **Step 2: Confirm that the Agent for the email workflow exists.** An **Agent** is required for the email workflow covered in later chapters. Run the following command to view the current **Agent** list: ```bash openclaw agents list --json ``` > [!NOTE] > > **The following steps use the Agent named `main` by default.** * **Step 3: Confirm that a Telegram account is available.** Make sure a Telegram account is available and ready to use. ## 6.3 Telegram Configuration > [!NOTE] > > **Telegram can be set up from either the app or Telegram Web. The steps below use Telegram Web.** Telegram Web address: https://web.telegram.org/k/ * **Step 1: Log in to Telegram.** Scan the QR code with the app, or log in with a phone number and verification code.
` with the Pairing code received in Telegram. **Do not include the angle brackets when entering it.**
```bash
openclaw pairing approve telegram
```
* **Step 7**: After the command runs successfully, send a test message to the Telegram Bot, such as `hello`. If the bot replies like an AI assistant, the Telegram connection to OpenClaw is working properly.
The Telegram integration for **OpenClaw** is now complete.