Telegram Bot API
🌐 Türkçe

sendMediaGroup

Kategori: Medya · Bot API 10.3 · Resmi dokümantasyon

Medya grubu (albüm) gönderir.

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

Parametreler

ParametreTürZorunluAçıklama
business_connection_idStringİsteğe bağlıİşletme bağlantısı ID'si
chat_idInteger or StringEvetSohbet ID'si veya @username
message_thread_idIntegerİsteğe bağlıForum konusu ID'si
direct_messages_topic_idIntegerİsteğe bağlıDoğrudan mesajlar konusu ID'si (Bot API 10.0)
mediaArray of InputMediaAudio, InputMediaDocument, InputMediaLivePhoto, InputMediaPhoto and InputMediaVideoEvetJSON InputMedia dizisi (2-10 öğe)
disable_notificationBooleanİsteğe bağlıSessiz gönder
protect_contentBooleanİsteğe bağlıİçeriği koru
allow_paid_broadcastBooleanİsteğe bağlıÜcretli yayına izin ver
message_effect_idStringİsteğe bağlıMesaj efekti ID'si
reply_parametersReplyParametersİsteğe bağlıJSON ReplyParameters nesnesi

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/sendMediaGroup" \
  -H "Content-Type: application/json" \
  -d '{
  "chat_id": 123456789,
  "media": [
    {
      "type": "photo",
      "media": "https://telegram.org/img/t_logo.png"
    },
    {
      "type": "photo",
      "media": "https://telegram.org/img/t_logo.png"
    }
  ]
}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/sendMediaGroup",
    json={
        "chat_id": 123456789,
        "media": [
            {
                "type": "photo",
                "media": "https://telegram.org/img/t_logo.png"
            },
            {
                "type": "photo",
                "media": "https://telegram.org/img/t_logo.png"
            }
        ]
    },
    timeout=30,
)
print(resp.json())

JavaScript

const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/sendMediaGroup`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "media": [
      {
        "type": "photo",
        "media": "https://telegram.org/img/t_logo.png"
      },
      {
        "type": "photo",
        "media": "https://telegram.org/img/t_logo.png"
      }
    ]
  }),
});
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