Webhooks
A webhook lets another service (a CI pipeline, a form, a monitoring tool) start a task by sending an HTTP request. For example, "when a deployment finishes, ask the agent to check the site".
Turn on a webhook
- Open the agent's Schedules and create or edit a schedule.
- Set Activation to Webhook and save.
- Choose Show webhook details to get the URL and the private token.
The URL uses your PANEL_URL, so the calling service must be able to reach it. Use HTTPS if it's reachable from outside your computer (see Use your own domain).
Call it
sh
curl -X POST 'https://nimbot.example.com/hooks/schedules/SCHEDULE_ID' \
-H "Authorization: Bearer $WEBHOOK_TOKEN" \
-H 'Content-Type: application/json' \
--data '{"event":"deployment","environment":"production"}'- An empty body runs the saved prompt as is.
- A JSON body (up to 16 KiB) is added to the prompt as extra information. It can't replace the prompt or change where results go.
- Results go to the schedule's delivery channel, as with any schedule.
Responses
| Code | Meaning and what to do |
|---|---|
202 | Accepted. The task is queued. |
401 | Wrong or old token, or the schedule no longer uses a webhook. Copy the current token from Show webhook details. |
409 | The schedule is paused or changed, or the agent is stopped or its chat isn't linked. Nothing was queued. Fix it and retry. |
413 / 415 / 400 | The body is larger than 16 KiB, isn't application/json, or isn't valid JSON. |
429 | Too many requests (more than five per minute, or 20 tasks already waiting). Wait and retry. |
503 | Nimbot is shutting down. |
Good to know
- Requests that arrive while a previous one is still running are queued, not skipped. They run in order.
- Every request creates a new task. Don't retry blindly if you're unsure whether the first one arrived.
- Webhooks never start a stopped agent.
- Pausing the schedule blocks the webhook. Run now still works.
- Regenerate token cancels the old token immediately. Switching to a timed schedule or deleting it also turns the webhook off.
For the webhook API, see the diagnostics reference.