Guides

Long polling

Best for local dev without a public URL. Conflicts with webhooks.

When to use

Use long polling when you lack public HTTPS. Prefer webhooks in production.

Steps

  1. Remove any webhook (deleteWebhook or console).
  2. Call POST /api/v1/bots/getUpdates in a loop; set next offset to max(update_seq)+1.
  3. Or use the SDK startPolling() / stopPolling().

Example

curl -X POST "$API/bots/getUpdates" \
  -H "Authorization: Bearer $SOCHAT_BOT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"offset":0,"limit":100,"timeout":30}'

Limits & errors

  • timeout 0–50s; limit 1–100.
  • Active webhook → 409.
Most local failures are leftover webhooks in the console.

Next

API · Quickstart.