# Omnisend webhooks in production: duplicates, ordering, retries and timeouts

Agent skill: `npx skills add hookdeck/webhook-skills --skill omnisend-webhooks` ([details](https://hookdeck.com/webhooks/omnisend/skill))

This guide covers the problems you meet when an Omnisend automation workflow calls your endpoint from a Webhook block, and how to handle each one. Omnisend publishes no timeout, retry policy or ordering guarantee for these requests, so much of the advice here is about designing around what isn't documented.

What Omnisend sends is on the [Omnisend webhooks](/webhooks/omnisend) overview, and how to check the secret header is on [Verify Omnisend webhooks](/webhooks/omnisend/verify).

## At a glance

| Problem | What to do | With Event Gateway |
| --- | --- | --- |
| [Timeouts](#timeouts) | Respond quickly and process in a background job | Answers Omnisend at once, then queues the request for your service |
| [Duplicates](#duplicates) | Put a unique value in the template and skip values you've processed | Drops repeats before they reach your handler |
| [Ordering](#ordering) | Send a timestamp in the body, or fetch current state | Logs every request, so you can see arrival order when debugging |
| [Retries](#retries) | Treat a failed request as possibly lost, and reconcile where it matters | Accepts requests while your service is down and retries on your schedule |
| [Choosing events](#choosing-events) | Name the event in every template | Filters and routes on the fields you send |
| [Testing](#testing) | Use a public HTTPS URL that forwards to localhost | Forwards to localhost and replays past requests |
| [Other limits](#other-limits) | Allow for blank tags, size limits and changes to live workflows | Compares the secret header, and shows you what was rejected |

## Omnisend webhook timeouts {#timeouts}

Respond as quickly as you can and do the work afterwards, because Omnisend doesn't document a timeout. The only response it describes is the `200 OK` its [Help Center article](https://support.omnisend.com/en/articles/9924457-use-webhooks-in-automation) tells you to look for when you test a block.

**Why it happens:** Omnisend's docs explain how to configure a Webhook block, but not how long it waits for your response or what it does with a slow one. Your handler can't count on any particular number of seconds.

**Fix it in your handler:**

1. Check the secret header, store the request and return `200`. See [why to process webhooks asynchronously](/webhooks/guides/why-implement-asynchronous-processing-webhooks).
2. Do the work in a worker, outside the request.

**With Event Gateway:** Hookdeck answers Omnisend as soon as a request arrives, then queues it and delivers it to your service at a rate it can handle. Your handler can take as long as it needs.

## Duplicate Omnisend requests {#duplicates}

Put something unique in the template and skip values you've processed, because Omnisend documents no delivery ID. It doesn't say whether it ever resends a request, but one contact can cause several requests anyway.

**Why it happens:** A contact who re-enters a workflow reaches the Webhook block again, and the rendered body can be identical. The [frequency limiter](https://api-docs.omnisend.com/docs/automations) controls this per automation: `once` limits a contact to one entry per lifetime, and `interval` lets them back in after a duration you set.

**Fix it in your handler:**

1. Build an identifier into the template, such as the contact email plus a property of the trigger event from `[[event.raw.<property>]]`.
2. Track processed identifiers in a table with a unique constraint.
3. Set the frequency limiter to `once` if a workflow should only ever fire once for a contact.
4. Make every handler [idempotent](/webhooks/guides/implement-webhook-idempotency).

**With Event Gateway:** Hookdeck [deduplicates](/docs/deduplication) requests before they reach your endpoint, using the fields you choose.

## Out-of-order Omnisend requests {#ordering}

Don't assume requests arrive in the order things happened, because Omnisend documents no guarantee. Send a timestamp from the trigger event in the body, or fetch the record's current state when the request arrives.

**Why it happens:** A request goes out when a contact reaches the Webhook block, not when the trigger fired. Omnisend's [own example](https://api-docs.omnisend.com/docs/how-to-send-webhooks-from-automations) waits 5 minutes first, so two workflows with different delays can send in a different order from the events behind them.

**Fix it in your handler:**

1. Template in a time from the trigger event. Omnisend's help article uses `[[event.raw.created_at]]` in an order example, though the properties available depend on the trigger.
2. Ignore anything older than what you've stored for that record.
3. Or read the current state from Omnisend's API when the request arrives.

**With Event Gateway:** Hookdeck logs every request and attempt, so you can see arrival order when debugging. For more on the general problem, see [Webhook Ordering: Why It's Hard and How to Handle It](/webhooks/guides/webhook-ordering-why-its-hard-and-how-to-handle-it).

## Omnisend retries and failed requests {#retries}

Treat a request your endpoint didn't accept as possibly lost. Omnisend doesn't document whether it retries a failed request, and it describes no way to resend one.

**Why it happens:** The docs cover configuring and verifying a Webhook block, and their troubleshooting section stops at why a request might not reach you: your server must accept `POST`, have a valid certificate and not block Omnisend's IP addresses. They give no retry schedule, and don't say what happens to the contact when a request fails.

**Fix it in your handler:**

1. Keep the endpoint available, and return a `2xx` only once the request is stored.
2. Allow Omnisend's IP addresses at your firewall, or the request never reaches you.
3. Where a missed request would matter, compare your records against Omnisend's API on a schedule, for example with [List contacts](https://api-docs.omnisend.com/reference/get_contacts).
4. To learn how your workflow behaves, point a block at a test endpoint that returns `500` and see whether a second request arrives.

**With Event Gateway:** Hookdeck accepts and stores each request as it arrives, then delivers it to your service with [retries](/docs/retries) you configure. [Issues](/docs/issues) alert you when deliveries fail, and you can replay any request after a fix.

## Naming Omnisend events yourself {#choosing-events}

Omnisend has no webhook event types, because each body is a template you write. Put a fixed `event` or `workflow` key in every template, or your endpoint can't tell one workflow's requests from another's.

**Why it happens:** A workflow's trigger, such as `subscribed to marketing` or `placed order`, decides which contacts enter it. Omnisend doesn't send the trigger's name unless you type it into the body. Its [API guide](https://api-docs.omnisend.com/docs/how-to-send-webhooks-from-automations) does that by hand:

```json
{
  "contactEmail": "[[contact.email]]",
  "contactName": "[[contact.first_name]]",
  "event": "subscribed"
}

```

**Fix it in your handler:**

1. Agree one convention for every template: an `event` value, the contact email, and the trigger properties you need.
2. Route on `event`, and log values you don't recognise instead of failing.
3. Change a template and its handler together, because nothing in the request tells you which version sent it.

**With Event Gateway:** Hookdeck [filters](/docs/filters) can route requests to different destinations by a body field, so each workflow's requests reach the service that handles them.

## Testing Omnisend webhooks {#testing}

Point the block at a public HTTPS URL that forwards to your machine, because Omnisend rejects `localhost`, IP addresses and non-standard ports.

**Why it happens:** The `callbackUrl` must be HTTPS on a fully qualified domain on port 443 with a valid certificate, and internal addresses are blocked. A URL that breaks these rules gets a `400` when you create or patch the automation.

**What to do:**

1. Run `hookdeck listen 3000 omnisend --path /webhooks/omnisend` to get a public HTTPS URL on port 443 that forwards to your local port.
2. Test the block and check your endpoint returned `200`, then enable the automation and put a test contact through it.
3. Try a contact with empty properties and one whose name contains a double quote. Omnisend validates the template as JSON, but doesn't say whether it escapes values when it fills in a tag.

**With Event Gateway:** The [Hookdeck CLI](/docs/cli) forwards to any local port, and Hookdeck keeps each request so you can replay it while you fix your handler.

## Other Omnisend limits {#other-limits}

The limits that catch people out come from templates and from changing a workflow that's running.

**Why it happens:** Omnisend renders one template per contact and treats a workflow's blocks as locked while it's enabled.

* **Blank tags:** A tag with no data is [left blank](https://support.omnisend.com/en/articles/1061845-use-personalization-in-omnisend), and the request still goes out.
* **Size:** The body can be up to 64 KB and must be valid JSON. A block can have up to 15 headers, with keys up to 256 characters and values up to 10,000.
* **Reserved headers:** You can't set `Content-Type`, `User-Agent`, `Host`, `Content-Length`, `Transfer-Encoding`, `Connection`, `Keep-Alive`, `Upgrade`, `TE`, `Trailer`, `Proxy-Authorization`, `Proxy-Authenticate` or `Expect`.
* **Live changes:** Changing an enabled automation returns `409`, so you have to disable it first.
* **Disabling:** With [`contactsInWorkflow` set to `keep`](https://api-docs.omnisend.com/reference/post_automations-id-disable), contacts already in the workflow carry on, so requests can arrive after you disable it. `exit` removes them.
* **Secret exposure:** The Automations API returns header values verbatim to anyone with the `automations.read` scope.

**Fix it in your handler:**

1. Validate each field, and handle an empty value as a normal case.
2. Keep secrets in a header rather than the body, and use a key without `automations.read` wherever you can.
3. Expect requests for a while after disabling a workflow unless you used `exit`.

**With Event Gateway:** Hookdeck's Omnisend source compares the header you name with the exact value you enter. A request with a missing or wrong value is rejected and never reaches your destination, and you can see it under [Requests](/docs/requests).

[Get started with Hookdeck](https://dashboard.hookdeck.com/signup) for free and receive Omnisend automation requests reliably in minutes.