StaticGramBot API

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

Use this method when you need to tell the user that something is happening on the bot's side. The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status). Returns True on success.

Example: The ImageBot needs some time to process a request and upload the image. Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use sendChatAction with action = upload_photo. The user will see a “sending photo” status for the bot.

We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.

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

all 11 actions, message_thread_id; business_connection_id shows the action as the business account

Параметры

business_connection_idStringнеобязательный
Unique identifier of the business connection on behalf of which the action will be sent
chat_idInteger or Stringобязательный
Unique identifier for the target chat or username of the target bot or supergroup in the format @username. Channel chats and channel direct messages chats aren't supported.
message_thread_idIntegerнеобязательный
Unique identifier for the target message thread or topic of a forum; for supergroups and private chats of bots with forum topic mode enabled only
actionStringобязательный
Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.

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

curl
curl "https://api.staticgram.top/bot$TOKEN/sendChatAction" \
  -H "Content-Type: application/json" \
  -d '{
    "chat_id": 123456789,
    "action": "typing"
  }'
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.send_chat_action(chat_id=123456789, action="typing")
JavaScript
const res = await fetch(`https://api.staticgram.top/bot${TOKEN}/sendChatAction`, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "chat_id": 123456789,
    "action": "typing"
  }),
});
const data = await res.json();

Ответ (True)

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

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