Insights · Developer account
setBotWebhook
Set a webhook on behalf of a bot owner
This method authenticates with your developer account. The easiest way to call it is the dashboard, which signs the request for you. Direct calls need a dashboard session cookie.
Owner-scoped version of setWebhook for the dashboard/in-app UI: registers an HTTPS webhook URL for one env (upsert on bot_id,env). Unlike the token method it takes no allowed_updates/max_connections and has no drop_pending_updates option. Setting a URL clears is_disabled and previous error state.
Request
curl https://api.sprintelex.com/setBotWebhook \
# authenticated with your dashboard session \
-H "Content-Type: application/json" \
-d '{"bot_id":"<bot-id>","url":"https://example.com/sprintex-webhook"}'Parameters
| Name | Type | Required | Rules |
|---|---|---|---|
| bot_id | string | Yes | - |
| env | string | No (default 'live') | must be 'live' or 'test' |
| url | string | Yes | same SSRF gate as setWebhook: valid URL, https-only, no credentials, no private/loopback IP or local hostname, hostname must not DNS-resolve private |
| secret_token | string | No | optional; at most 256 characters |
Response
{ ok: true, result: true }Rate limit: none in code
Errors
| Status | Error | When |
|---|---|---|
| 400 | bot_id is required | missing bot_id |
| 400 | env must be 'live' or 'test' | env not live/test |
| 404 | bot not found | no such bot, not owned by caller, or deleted |
| 400 | url is required | missing url |
| 400 | url is not a valid URL | webhook url must be https | webhook url must not contain credentials | webhook url must not target a private or loopback IP | webhook url must not target a local hostname | webhook host resolves to a private or loopback IP | whichever SSRF check failed (exact string from _shared/webhook.ts) |
| 400 | secret_token must be at most 256 characters | secret_token longer than 256 |
| 500 | could not save webhook | DB upsert failed |