# Tạo Telegram Bot

## Telegram Bot dùng để làm gì?

Các thao tác tạo Telegram Bot dùng trong trường hợp thông báo về dữ liệu thông qua ứng dụng Telegram

## Bước 1/  Tạo con BOT trên Telegram

### 1.1/ Trên telegram sẽ gõ từ @BotFather và chọn "START"

<figure><img src="/files/VnEvETdTnwbmqnxz2f2r" alt=""><figcaption></figcaption></figure>

### 1.2/ Tại khung type, bạn gõ chữ /newbot để tạo 1 group BOT chat

<figure><img src="/files/sJaZK8VUBsYMNz4X7QkK" alt=""><figcaption></figcaption></figure>

### 1.3/ Gõ vào Type để đặt tên con BOT\_Telegram

<figure><img src="/files/YXWvNhUB50J9YevPibCV" alt=""><figcaption></figcaption></figure>

### 1.4/ Tạo UserName để log-in vào con BOT\_Telegram và lấy Token\_Access.&#x20;

{% hint style="info" %}
Lưu ý: cuối tên tài khoản kết thúc bằng từ “bot”, ví dụ: **haidltele\_bot**
{% endhint %}

<figure><img src="/files/DjRuSrolsso4D2ypbaQi" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/QFy8eGl7n9avfU2fhtA1" alt=""><figcaption></figcaption></figure>

### 1.5/ Tạo Group\_Telegram và add con BOT\_Telegram được tạo ở bước 1.3

<figure><img src="/files/gU8XNREp2geRztB5eYHr" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/KAyR5sEYUYZB3DRJ5nwj" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/DyUuYKKnjocXsqn03QmP" alt=""><figcaption></figcaption></figure>

Có 2 cách để Add con Telegram Bot vừa tạo:

Cách 1: Gõ tên Telegram Bot vừa tạo và bấm "Create" để add vào Group

<figure><img src="/files/EUrE5GVdfPGCXQq18myV" alt=""><figcaption></figcaption></figure>

Cách 2: Sau khi tạo Group\_Telegram, để add được con BOT\_Telegram thì bạn cần click vào link tin nhắn sau khi tạo ở 1.3

<figure><img src="/files/4ZfO43WaMoNAi60QXZl3" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/gCQDEJOOPYW9c97zfGgb" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ThOxoxTDseM9yYMkXCAn" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/UrN3MD4a6rwy9CyziaUx" alt=""><figcaption></figcaption></figure>

Và kết quả

<figure><img src="/files/M7rp2J0JsktufIhFTFeF" alt=""><figcaption></figcaption></figure>

## Bước 2: Connect BOT\_Telegram vừa tạo vào PangoCDP

* Vào [Module Console](https://console.mydatalakes.com/connections?cate=Notification)
* Chọn Connections / Notification / Telegram Bot
* Chọn "+ Connect" / "+Connect"
* Điền thông tin và tạo Connection (xem hướng dẫn tạo kết nối Telegram Bot [tại đây](/user-guide/module-console/connections/notification/ket-noi-telegram-bot.md))

<figure><img src="/files/MY0g3y5bOiPRBZmzPvj9" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/ERbwXrH4n6a3qXLycv2e" alt=""><figcaption></figcaption></figure>

| Trường thông tin              | Mô tả                                                                               |                                                                                                                                                                                                             |
| ----------------------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Bot Name                      | Tên con Bot Telegram                                                                |                                                                                                                                                                                                             |
| Access Token                  | API Access Token được cung cấp ngay sau khi tạo tên tài khoản (UserName) ở bước 1.4 |                                                                                                                                                                                                             |
| Confirm that added to a group | Bật / Tắt tính năng cho con Bot gửi tin vào Group\_Telegram                         |                                                                                                                                                                                                             |
| Group Name                    | Tên Group\_Telegram (bước 1.5) được tạo và đã add con Bot\_Telegram vào             |                                                                                                                                                                                                             |
| Chat ID                       | Chọn "Get Update" để lấy Chat ID.                                                   | Để có thể lấy được Chat ID, cần phải add thêm 1 User khác vào chung Group có con bot Telegram, sau đó gõ typing 1 dòng vào Group chung. Lúc này bấm Get Update mới có thể lấy được Chat ID con Bot Telegram |
| Send Message                  | Test con Bot Telegram gửi tin                                                       |                                                                                                                                                                                                             |
| Save                          | Lưu thiết lập để hoàn thành                                                         |                                                                                                                                                                                                             |

<figure><img src="/files/vECt21LOHaxtv38zBkc4" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/fQ7RwSHgr1rw5P78ZW3C" alt=""><figcaption></figcaption></figure>

## Bước 3/ Thiết kế Template Bot Telegram

* Vào [Module Console](https://console.mydatalakes.com/connections?cate=Notification)
* Chọn Connections / Notification / Telegram Bot
* Chọn "Manage"
* Chọn con Telegram Bot cần thiết lập
* Chọn Template / "+Add"
* Điền thông tin để tạo Template mới và "Add"
* Chọn "Build Message" để thiết kế Template

<figure><img src="/files/X1rKt2nS6eS2l29H2EWx" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/kzHONYZSKH62XPCzvCEG" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/jnRKgJbO0CrV4CPtBbK2" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/JpUKPhCpUfwkMXqe9QsZ" alt=""><figcaption></figcaption></figure>

## Bước 4/ Gửi Testing Bot\_Telegram

* &#x20;Vào [Module Console](https://console.mydatalakes.com/)&#x20;
* Chọn Connections / Notification / Manage
* Chọn con Telegram Bot cần thiết lập
* Chọn Testing
* Chọn con Bot Telegram dùng gửi tin / Chọn Template đã tạo để gửi
* Chọn "Send Message" để hoàn thành

<figure><img src="/files/3c0U7Aybhh5OgltL5qrD" alt=""><figcaption></figcaption></figure>


---

# 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://help.pangocdp.com/user-guide/module-console/connections/notification/tao-telegram-bot.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.
