getUpdates
Obtiene actualizaciones. Usa el botón 'Iniciar' para long polling.
Devuelve: Si la llamada tiene éxito, devuelve Array of Update.
Parámetros
| Parámetro | Tipo | Obligatorio | Descripción |
|---|---|---|---|
offset | Integer | Opcional | Offset para la siguiente solicitud |
limit | Integer | Opcional | Cantidad máxima (1-100) |
timeout | Integer | Opcional | Tiempo de espera en segundos |
allowed_updates | Array of String | Opcional | Array JSON de tipos |
Ejemplo de solicitud
curl
curl -s "https://api.telegram.org/bot$TOKEN/getUpdates"
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.get(f"https://api.telegram.org/bot{TOKEN}/getUpdates", timeout=30)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/getUpdates`);
console.log(await res.json());
Guía paso a paso: Cómo obtener el chat id de Telegram: usuarios, grupos, canales y temas
Métodos relacionados
getWebhookInfoDevuelve información del webhook.setWebhookEstablece un webhook.deleteWebhookElimina el webhook.