Telegram Bot API
🌐 Türkçe

giftPremiumSubscription

Kategori: Ödemeler · Bot API 10.3 · Resmi dokümantasyon

Telegram Premium aboneliği hediye eder.

Dönüş değeri: Başarılı olduğunda True döndürür.

Parametreler

ParametreTürZorunluAçıklama
user_idIntegerEvetKullanıcı ID'si
month_countIntegerEvetAy sayısı (1, 3, 6 veya 12)
star_countIntegerEvetStars cinsinden fiyat: 3 ay için 1000, 6 ay için 1500, 12 ay için 2500
textStringİsteğe bağlıMesaj metni (0-255)
text_parse_modeStringİsteğe bağlıMetin biçimlendirme modu
text_entitiesArray of MessageEntityİsteğe bağlıJSON MessageEntity dizisi

Parametre açıklamaları kısa özetlerdir; tam metin için resmi dokümantasyona bakın.

Örnek istek

curl

curl -s -X POST "https://api.telegram.org/bot$TOKEN/giftPremiumSubscription" \
  -H "Content-Type: application/json" \
  -d '{"user_id":123456789,"month_count":3,"star_count":100}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/giftPremiumSubscription",
    json={
        "user_id": 123456789,
        "month_count": 3,
        "star_count": 100
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/giftPremiumSubscription`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "user_id": 123456789,
    "month_count": 3,
    "star_count": 100
  }),
});
console.log(await res.json());

Adım adım rehber: Telegram bot nasıl yapılır? BotFather ile adım adım bot oluşturma