StaticGramBot API

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

Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user. On success, an Array of Message objects is returned.

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

newest posts of User.PersonalChannelID; 400 if the user has no personal chat

Параметры

user_idIntegerобязательный
Unique identifier for the target user
limitIntegerобязательный
The maximum number of messages to return; 1-20

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

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

Ответ (Array of Message)

JSON
{
  "ok": true,
  "result": [
    {
      "message_id": 1,
      "date": 1790000000,
      "chat": {
        "id": 1780243423,
        "type": "private"
      }
    }
  ]
}

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