Yangilanishlar
getWebhookInfo
Webhook holati: manzil, navbat, oxirgi xato.
GET
https://api.zamin.app/bot<TOKEN>/getWebhookInfoPOST ham ishlaydi. Parametrlar: query, JSON, form yoki multipart — batafsil.
Webhook holatini WebhookInfo ko'rinishida qaytaradi. Webhook o'rnatilmagan bo'lsa, url bo'sh qator. pending_update_count — yetkazilmagan (yoki getUpdates bilan olinmagan) yangilanishlar soni.
Parametrlar
Parametrlar yo'q.
Javob
Natija (result): WebhookInfo
JSON
{
"ok": true,
"result": {
"url": "https://bot.example.com/zamin/webhook",
"has_custom_certificate": false,
"pending_update_count": 2,
"max_connections": 40,
"last_error_date": 1791106200,
"last_error_message": "Wrong response from the webhook: 502",
"allowed_updates": ["message", "callback_query"]
}
}Xatolar
Bu metodga xos xato yo'q.
Istalgan metodda bo'lishi mumkin: 401 Unauthorized, 403 Forbidden: bot is suspended, 429 Too Many Requests, 400 Bad Request: <maydon>: … — xato kodlari.
Misol
Python
import os
import requests
TOKEN = os.environ["ZAMIN_BOT_TOKEN"]
API = f"https://api.zamin.app/bot{TOKEN}"
info = requests.get(f"{API}/getWebhookInfo", timeout=15).json()["result"]
print("URL:", info["url"] or "(o'rnatilmagan)")
print("Navbatda:", info["pending_update_count"])
if "last_error_message" in info:
print("Oxirgi xato:", info["last_error_message"])curl
curl -s "https://api.zamin.app/bot$ZAMIN_BOT_TOKEN/getWebhookInfo"