Why send an Idempotency-Key?#
Tools that call webhooks retry when a request times out, so one lead can arrive twice. With a key, Agent Studio recognizes the repeat. The first delivery writes the contact, records the visit, counts once and starts your workflows. A repeat does none of that.
How do I send the key?#
Add the header to each delivery. Use a value that is the same on every retry of one delivery, such as your system's event id. Create the webhook under Forms, Inbound webhooks, then post to its address.
curl -X POST 'https://<your webhook address>' \
-H 'content-type: application/json' \
-H 'x-suede-hook-secret: YOUR_SECRET' \
-H 'Idempotency-Key: lead-48213' \
-d '{"email":"test@example.com","first_name":"Test","phone":"555-0100"}'| Rule | Detail |
|---|---|
| Header | Idempotency-Key, or x-suede-idempotency-key. If you send both, the values must match. |
| Length | 1 to 200 characters |
| Characters | Visible ASCII with no spaces |
| Scope | One webhook. The same key on a different webhook is a different delivery. |
What does the webhook answer?#
| Status | Body | Meaning |
|---|---|---|
| 200 | { ok: true } | First delivery with this key. The contact was written and workflows started. |
| 200 | { ok: true, duplicate: true } | Repeat of a key already delivered. Nothing was written. |
| 409 | in_progress | A delivery with this key is still being processed. Send it again in a few seconds. |
| 400 | invalid_request | The key is malformed, or two key headers disagree. |
What if I send no key?#
Every delivery is processed. Add the header on the sender's retrying calls to make them safe. Your webhook's secret is checked first, so a caller without the secret learns nothing about keys. Set up the webhook and its field mapping in Forms.