Telegram Bot API
🌐 Türkçe

deleteMessages

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

Birden fazla mesajı siler.

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

Parametreler

ParametreTürZorunluAçıklama
chat_idInteger or StringEvetSohbet ID'si
message_idsArray of IntegerEvetMesaj ID'lerinin JSON dizisi [1,2,3]

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/deleteMessages" \
  -H "Content-Type: application/json" \
  -d '{"chat_id":123456789,"message_ids":[42,43]}'

Python

import requests

TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
    f"https://api.telegram.org/bot{TOKEN}/deleteMessages",
    json={
        "chat_id": 123456789,
        "message_ids": [
            42,
            43
        ]
    },
    timeout=30,
)
print(resp.json())

JavaScript

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