StaticGramBot API

deleteBusinessMessagesПоддерживается

Delete messages on behalf of a business account. Requires the can_delete_sent_messages business bot right to delete messages sent by the bot itself, or the can_delete_all_messages business bot right to delete any message. Returns True on success.

Особенности StaticGram

can_delete_sent_messages (own outgoing) / can_delete_all_messages; revoke for both sides

Параметры

business_connection_idStringобязательный
Unique identifier of the business connection on behalf of which to delete the messages
message_idsArray of Integerобязательный
A JSON-serialized list of 1-100 identifiers of messages to delete. All messages must be from the same chat. See deleteMessage for limitations on which messages can be deleted.

Пример запроса

curl
curl "https://api.staticgram.top/bot$TOKEN/deleteBusinessMessages" \
  -H "Content-Type: application/json" \
  -d '{
    "business_connection_id": "<business_connection_id>",
    "message_ids": [
      42,
      43
    ]
  }'
aiogram 3
from aiogram import Bot
from aiogram.client.session.aiohttp import AiohttpSession
from aiogram.client.telegram import TelegramAPIServer

session = AiohttpSession(api=TelegramAPIServer.from_base("https://api.staticgram.top"))
bot = Bot(TOKEN, session=session)

result = await bot.delete_business_messages(
    business_connection_id="<business_connection_id>",
    message_ids=[42, 43],
)
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/deleteBusinessMessages`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "business_connection_id": "<business_connection_id>",
    "message_ids": [
      42,
      43
    ]
  }),
});
const data = await res.json();

Ответ (True)

JSON
{
  "ok": true,
  "result": true
}

Описания методов и типов взяты из официальной документации Telegram Bot API (Bot API 10.3). Адрес API: https://api.staticgram.top