Aimfox webhooks in production: duplicates, ordering, retries and timeouts
This guide covers the problems Aimfox webhooks cause in production and how to handle each one. How deliveries work is on the Aimfox webhooks overview, every event is listed on Aimfox webhook events, and checking the authentication header is on Verify Aimfox webhooks.
At a glance
| Problem | What to do | With Event Gateway |
|---|---|---|
| Timeouts | Return a 2xx quickly; process in a background job | Accepts each event at once, then queues it for your service |
| Duplicates | Deduplicate on id, and on the message across reply events | Drops repeats you define before they reach your handler |
| Ordering | Compare timestamps before overwriting state | Logs every request and attempt, so you can see arrival order |
| Retries | Stay up inside the schedule; reconcile from the API after it | Accepts events during your outage, then retries on your schedule |
| Choosing events | Subscribe to the narrowest reply event | Filters out event types a destination doesn't need |
| Testing | Trigger an event from an action that sends nothing on LinkedIn | Forwards requests to localhost |
| Other limits | Always set a header; parse each timestamp on its own terms | Checks the header and keeps every request |
Aimfox webhook timeouts and slow handlers
Return a 2xx quickly and do the work in a background job, because Aimfox retries calls that time out and doesn't say how long it waits.
Why it happens: Aimfox lists network timeouts among the failures it retries, but its docs state no response time limit. A handler that updates a CRM before responding risks being treated as failed.
Fix it in your handler:
- Check the authentication header, store the event and return
200. - Do the work from a queue. See why to process webhooks asynchronously.
- Keep slow CRM calls out of the request entirely, since there's no documented limit to design against.
With Event Gateway: Hookdeck accepts each Aimfox event as it arrives, then queues it and delivers it at a rate your service can handle, so your handler can take as long as it needs.
Duplicate Aimfox webhooks
The same event can reach you more than once, and one message can produce several events. Deduplicate on id for retries, and on the message across reply events.
Why it happens: A call that times out after your handler did the work is retried. Separately, several event types can report the same reply, each as its own event.
Fix it in your handler:
- Store
idbefore processing and skip repeats. Aimfox calls it a unique identifier for the event, though it doesn't say outright that a retry keeps the same value. See our guide to webhook idempotency. - If you subscribe to more than one reply event, also key on the message.
new_reply,campaign_replyandinbox_eventcarryevent.message_urn. Aimfox'sreplyandinmail_replyexamples don't, so they can't be matched to those three this way. - Make writes idempotent where you can, so an upsert on the lead gives the same result however many times it runs.
With Event Gateway: Hookdeck can deduplicate on the fields you choose, such as id or the message URN, before events reach your endpoint.
Out-of-order Aimfox webhooks
Aimfox documents no ordering guarantee, so don't assume events arrive in the order they happened.
Why it happens: A failed call waits for its retry while newer events are delivered, and the last retry comes about 32 hours after the failure. An accepted event could therefore arrive after the message that followed it.
Fix it in your handler:
- Store the latest time you've seen per lead or campaign, and ignore anything older before overwriting state.
- Use the top-level
timestamp. In Aimfox's examples it's ISO 8601 and matches the time of the activity, but the docs don't describe the field. - For campaign activity, read
event.prev_stateandevent.staterather than inferring the lead's position from arrival order.
With Event Gateway: Hookdeck logs every request and delivery attempt, so when state looks wrong you can see the order events arrived in and replay them.
Aimfox webhook retries and what happens after them
Aimfox retries a failed call up to 6 times over about 32 hours, and documents nothing after the last attempt.
Why it happens: Aimfox names network timeouts, server errors and an unavailable endpoint as failures, and retries on this schedule:
| Retry | When |
|---|---|
| 1 | 1 minute after the failure |
| 2 | 5 minutes after the previous retry |
| 3 | 30 minutes after the previous retry |
| 4 | 1 hour after the previous retry |
| 5 | 6 hours after the previous retry |
| 6 | 1 day after the previous retry |
Its docs don't say which status codes count as success, whether a 4xx is retried, whether an endpoint is disabled after repeated failures, or how to resend a delivery.
Fix it in your handler:
- Return a 2xx for anything you've stored, including event types you don't recognise, so a new type doesn't count as a failure.
- Alert on your endpoint's error rate, because an outage over a weekend outlasts the schedule.
- After an outage longer than the schedule, reconcile from the Aimfox API. List Interactions, List Conversations and List Recent Leads cover most of what these events report.
With Event Gateway: Hookdeck accepts each Aimfox event as it arrives, so Aimfox's schedule only has to cover the short path to Hookdeck. Hookdeck then retries delivery to your service on your own schedule, and you can replay any event.
Choosing Aimfox webhook events
Subscribe to the narrowest event that fits, especially for replies, because the reply events overlap.
Why it happens: A lead's first reply to a campaign message matches reply, campaign_reply and new_reply, and inbox_event covers all inbox activity on the account.
| Event | Fires on |
|---|---|
reply | A lead's first reply to a campaign message, once per lead |
campaign_reply | Every reply to a campaign message |
inmail_reply | A reply to a campaign InMail |
new_reply | A reply in any conversation on a workspace account, from a campaign or not |
inbox_event | All inbox activity, with event.type saying sent or received |
Fix it in your handler:
- Pick one reply event per purpose:
campaign_replyto log a whole conversation,replyto stop a sequence or notify sales once,new_replywhen replies outside campaigns matter too. - Use
inbox_eventalone if you want every message in one stream, and checkevent.type. - Add
account_logged_outto a separate endpoint that alerts someone, because it means a LinkedIn account was logged out by hand or its session expired. - Treat
eventas a different shape for eachevent_type.
With Event Gateway: Hookdeck filters can drop the event types a destination doesn't need and route the rest, so one webhook URL can feed several services.
Testing Aimfox webhooks
Aimfox documents no test delivery, so trigger a real event from an action that sends nothing on LinkedIn.
Why it's awkward: Most events fire when a running campaign acts on LinkedIn, or when a real lead responds, and you won't want either in a test.
Test your handler:
- Copy example bodies from Aimfox's webhook docs, which have one for each event, into your handler's tests.
- Add a label to a lead for
lead_label_added, or create a campaign without starting it forcampaign_created. - Test a failure by returning a
500from your endpoint, and watch for the retry a minute later.
With Event Gateway: hookdeck listen 3000 aimfox --path /webhooks/aimfox with the Hookdeck CLI gives you a public HTTPS URL that forwards to your machine. Use it as the webhook URL.
Other Aimfox webhook limits
Plan for an optional credential, mixed timestamp formats and a feature still marked beta.
- The header is optional and static: A webhook saved without an authentication header sends events your endpoint can't check, and one saved with it sends the same value every time. Nothing is computed over the body and no signed timestamp ties a request to a time, so a captured request can be replayed. Use a long random value over HTTPS only, and change it if it leaks. Hookdeck's Aimfox source compares the header you name with the exact value you enter, and a request without it is rejected as failed verification before it reaches your destination.
- Timestamps come in several forms: In Aimfox's examples the top-level
timestampis ISO 8601,workspace.created_atis Unix seconds, andcampaign.created_atandmessage.created_atare milliseconds.event.timestampis ISO 8601 except onaccount_logged_out, where it's a number in milliseconds. Parse each field on its own terms. - Beta: Aimfox labels webhooks as beta and doesn't describe payload versioning, so validate only the fields you use and ignore unknown ones. Every request is stored in Hookdeck with its headers and body, so a change in what Aimfox sends shows up in the request history.
- No published source IPs: Aimfox names no egress addresses, so you can't rely on an allowlist. The header is your only check.
Keep an outage from outlasting Aimfox's six retries.
Event Gateway checks your authentication header, accepts each event as it arrives and queues it, then retries to your service on your schedule.