Skip to main content
Most of what happens in Hammock isn’t started by your API calls. An employee enrolls, changes a contribution or has a claim approved; a pull settles; an employer passes review. Each of those creates an event, and Hammock delivers it to your webhook endpoints.

Thin events

Events are thin. An event says what happened and which object it happened to, and doesn’t carry a copy of the object.
When you receive one, retrieve related_object.url to read the object as it is now. This has three advantages:
  • You always act on current state. A delayed or out-of-order delivery can’t overwrite newer data with older data.
  • No personal data in transit. Deliveries contain IDs only, so nothing sensitive sits in your request logs or queues.
  • No payload versions. The object comes back in the API version your code asks for.
request is set when one of your own API calls caused the event, and holds its request ID and idempotency key.

Set up an endpoint

The response includes the endpoint’s signing secret, which starts with whsec_. This is the only time it’s returned, so store it. enabled_events takes event types, or ["*"] for all of them. One endpoint receives events for all your employers; use the event’s employer field to route them.

Handle a delivery

Hammock sends each event as a POST with a JSON body and a Hammock-Signature header.
1

Verify the signature

Check the Hammock-Signature header against the raw request body before you trust it. See verify signatures.
2

Acknowledge quickly

Return any 2xx status within 10 seconds. Put the event on a queue and do the work afterwards, so a slow job doesn’t turn into a failed delivery.
3

Skip duplicates

An event can be delivered more than once. Record the id of each event you process and ignore repeats.
4

Fetch the object

Retrieve related_object.url and act on what comes back.

Delivery behavior

Catch up after downtime

Events are kept for 30 days. If your endpoint was down, list what you missed:
A periodic reconciliation is also worth having: before each payroll, read deductions for the pay date and pending reimbursements directly, so a missed event can never put a wrong amount on a paycheck.