Telegram Bot API
🌐 Tiếng Việt

createForumTopic

Danh mục: Diễn đàn · Bot API 10.3 · Tài liệu chính thức

Tạo chủ đề diễn đàn.

Giá trị trả về: Nếu thành công, trả về ForumTopic.

Tham số

Tham sốKiểuBắt buộcMô tả
chat_idInteger or StringCóID chat hoặc @username
nameStringCóTên chủ đề (1-128 ký tự)
icon_colorIntegerTùy chọnMàu biểu tượng (RGB, ví dụ 7322096)
icon_custom_emoji_idStringTùy chọnID emoji tùy chỉnh cho biểu tượng

Mô tả tham số chỉ là bản tóm tắt ngắn gọn; xem tài liệu chính thức để đọc toàn văn.

Ví dụ request

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/createForumTopic" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":123456789,"name":"Example"}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/createForumTopic",
    json={
        "chat_id": 123456789,
        "name": "Example"
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/createForumTopic`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "name": "Example"
  }),
});
console.log(await res.json());

Hướng dẫn từng bước: Cách tạo bot Telegram từ A đến Z: BotFather, token và tin nhắn đầu tiên