202. Instead of polling, pass a webhook URL with the call: when the call ends, Connie POSTs its outcome there.
Ask for a webhook
Addwebhook next to input when you run a tool:
- The URL must use
https, contain no username or password and be at most 2,048 characters. Otherwise the call is refused with400 invalid_webhookand nothing runs. - Connie looks up the URL’s host when it accepts the call. A host on a private network, or one with no DNS address, is refused with
400 invalid_webhookand nothing runs; send the corrected call with a newIdempotency-Key. If the lookup fails for a moment, the call answers503 webhooks_unavailableand nothing runs: send the same request again. - The webhook is part of the request: sending the same
Idempotency-Keywith a different webhook (or none) is409 idempotency_conflict. - You can still poll the operation as usual. A successful call that ends within 25 seconds answers
200with its outcome and also sends the webhook. A failed call returns its error status and sends the corresponding outcome.
What Connie sends
OnePOST with a JSON body, when the call ends:
data is the operation returned by GET /api/tool-invocations/{invocationId}, without replayed or chargedThisRequest. A result over 1 MiB comes as resultRef: fetch it with ?result=full.
Headers on every webhook:
Verify the signature
Webhooks are signed the Standard Webhooks way, so any Standard Webhooks library verifies them. Get your workspace’s signing secret once and keep it on your server:{webhook-id}.{webhook-timestamp}.{raw body}, keyed with the base64-decoded part of the secret after whsec_. Check it against the raw body, before parsing it, and reject timestamps more than 5 minutes off.
- Node.js
- Python
Answer quickly, handle duplicates
- Answer with any
2xxwithin 10 seconds, then do the work. Connie doesn’t read the body. - Retries: any other answer, a timeout or a connection error is retried after 30 seconds, 2 minutes, 10 minutes, 30 minutes, 1 hour, 2 hours, 4 hours and 8 hours (about 16 hours in all). Answer
410 Goneto stop retries for that event. - Redirects are not followed. Give Connie the final URL.
- A host that can’t be looked up is retried on the same schedule. Connie stops for good only if the host now points to a private network.
- Duplicates happen. The same event can arrive more than once: skip a
webhook-idyou have already handled. - Order isn’t guaranteed between different calls. For one call, the event’s
datais its final outcome. If a call that only reads was interrupted and ran again, you may get anunknown_outcomeevent first and then, with a newwebhook-id, the real outcome.