Bot API · Bot token

setWebhook

Set the webhook URL for incoming updates

Registers an HTTPS webhook URL for this bot+env (upsert on bot_id,env). Deliveries POST the update JSON with headers X-Sprintelex-Bot-Secret: <secret_token> (empty string when none set) and X-Sprintelex-Signature: sha256=<hex HMAC-SHA256(body, secret_token)> (absent when no secret is set). an empty url string DELETES the webhook instead of setting one. Setting a URL clears is_disabled and any previous error state.

Request

curl https://api.sprintelex.com/setWebhook \
  -H "Authorization: Bearer <bot-token>" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/sprintex-webhook"}'

Parameters

NameTypeRequiredRules
urlstringYesempty string deletes the webhook; otherwise must pass SSRF gate: valid URL, https-only, no userinfo/credentials, no literal private/loopback/link-local/multicast IP host, no localhost/.localhost/.local/.internal/.invalid hostname, and the hostname must not DNS-resolve to a private IP
secret_tokenstringNooptional; at most 256 characters; echoed back on deliveries as X-Sprintelex-Bot-Secret and used for X-Sprintelex-Signature
allowed_updatesarrayNofiltered to known types; the only known type in v1 is 'message'
max_connectionsintegerNo (default 40)clamped to 1-100
drop_pending_updatesbooleanNowhen true, undelivered poll updates are marked delivered_poll=true (they will not be returned by getUpdates afterwards)

Response

{ ok: true, result: true }

Rate limit: 10 calls per 60-second window per bot+env

Errors

StatusErrorWhen
429rate limit exceeded: slow downmore than 10 calls in 60 seconds
400url is not a valid URLurl does not parse as a URL
400webhook url must be httpsnon-https scheme
400webhook url must not contain credentialsuserinfo present in URL
400webhook url must not target a private or loopback IPliteral IP host in a blocked range
400webhook url must not target a local hostnamelocalhost/.local/.internal/.invalid host
400webhook host resolves to a private or loopback IPDNS A/AAAA records resolve private
400secret_token must be at most 256 characterssecret_token longer than 256
500could not save webhookDB upsert failed