Telegram Bot API
🌐 Tiếng Việt

createChatSubscriptionInviteLink

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

Tạo liên kết mời theo gói đăng ký.

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

Tham số

Tham sốKiểuBắt buộcMô tả
chat_idInteger or StringCóID kênh
nameStringTùy chọnTên liên kết
subscription_periodIntegerCóChu kỳ gói đăng ký tính bằng giây
subscription_priceIntegerCóGiá gói đăng ký tính bằng Telegram Stars

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/createChatSubscriptionInviteLink" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_id": 123456789,
  "subscription_period": 2592000,
  "subscription_price": 100
}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/createChatSubscriptionInviteLink",
    json={
        "chat_id": 123456789,
        "subscription_period": 2592000,
        "subscription_price": 100
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/createChatSubscriptionInviteLink`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "subscription_period": 2592000,
    "subscription_price": 100
  }),
});
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