StaticGramBot API

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

Informs a user that some of the Telegram Passport elements they provided contains errors. The user will not be able to re-submit their Passport to you until the errors are fixed (the contents of the field for which you returned the error must change). Returns True on success.

Use this if the data submitted by the user doesn't satisfy the standards your service requires for any reason. For example, if a birthday date seems invalid, a submitted document is blurry, a scan shows evidence of tampering, etc. Supply some details in the error message to make sure the user knows how to correct the issues.

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

Telegram Passport core: secure secret in account.get/updatePasswordSettings, account.get(All)/save/deleteSecureValue (encrypted data, secure files via inputSecureFileLocation), getAuthorizationForm (values + errors from setPassportDataErrors / users.setSecureValueErrors), acceptAuthorization → Message.passport_data to the bot (files via getFile); errors cleared on accept; help.getPassportConfig. Not implemented: phone/e-mail verification (only the account's own phone; e-mail → EMAIL_VERIFICATION_NEEDED), bot public-key registration (any PEM key is accepted)

Параметры

user_idIntegerобязательный
User identifier
errorsArray of PassportElementErrorобязательный
A JSON-serialized Array describing the errors

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

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

Ответ (True)

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

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