Bot API · Guides
Webhooks
With a webhook Orbeo sends every update to your https address the moment it happens. Polling is simpler to start; a webhook is better for a bot that lives on a server.
Set the webhook
curl -X POST https://orbeo.me/botapi/bot$T/setWebhook \
-H 'Content-Type: application/json' \
-d '{"url":"https://example.com/orbeo-hook","secret_token":"long-random-string"}'
curl https://orbeo.me/botapi/bot$T/getWebhookInfoOnly https addresses are accepted. Orbeo sends secret_token back in the X-Telegram-Bot-Api-Secret-Token header — check it, so nobody else can post to your endpoint.
A minimal server
from aiohttp import web
SECRET = "long-random-string"
async def hook(request):
if request.headers.get("X-Telegram-Bot-Api-Secret-Token") != SECRET:
return web.Response(status=403)
update = await request.json()
msg = update.get("message")
if msg and msg.get("text"):
# answer right in the webhook response — no extra request
return web.json_response({"method": "sendMessage",
"chat_id": msg["chat"]["id"],
"text": "You said: " + msg["text"]})
return web.json_response({})
app = web.Application()
app.router.add_post("/orbeo-hook", hook)
web.run_app(app, port=8080)Replying with {"method": …} in the webhook response executes that method — handy for one quick answer.
Polling or webhook
getUpdates— long polling up to 50 s, one poller per bot (a second one gets 409). No public address needed.- Webhook — needs https, scales better, no idle connection.
- Switching back:
deleteWebhook.
Updates wait for 24 hours, so a short outage loses nothing.