Delivery
This page describes how Crewsum delivers webhook events today. Build your endpoint for this behavior: one attempt per event, no retries, and no delivery IDs.
The request
Section titled “The request”Crewsum sends each event as an HTTP POST to the webhook’s URL.
| Part | Value |
|---|---|
| Body | JSON with two fields: event (the event type, such as clients.created) and data (the payload). See the event reference. |
x-timestamp | The time Crewsum signed the request, in Unix seconds. |
x-crewsum-signature | The HMAC-SHA256 signature of the request. See Validating Webhook Signatures. |
Content-Type | Currently application/x-www-form-urlencoded, although the body is JSON. Read the raw body and parse it as JSON yourself. |
{ "event": "clients.created", "data": { "clients": [{ "id": "client-ghi123jkl4567890", "name": "Northwind Logistics" }] }}The example is shortened. The body has no event ID, delivery ID, or tenant ID.
When Crewsum sends an event
Section titled “When Crewsum sends an event”- Crewsum sends the event during the request that made the change: after the change is saved, and before Crewsum responds to the person or API client that made it.
- If the request fails or is rejected before the change is saved, no event is sent.
- Crewsum waits for your endpoint to respond. There is no timeout. A slow endpoint makes the Crewsum action that triggered the event slow, for the user in the app or for the API client.
- If several webhooks subscribe to the same event, Crewsum sends to them one at a time.
Responses and failures
Section titled “Responses and failures”- Any status from
200to500ends the delivery. Crewsum does not read the response body. - Crewsum does not retry. An event that your endpoint does not process, for example because it returned
500or was offline, is not sent again. - If the connection fails, or your endpoint returns a status above
500(such as502or503), Crewsum stops sending that event. Webhooks that were still waiting for the same event do not receive it.
A failed delivery does not change the result of the action that triggered it. The change is still saved.
The Enabled switch
Section titled “The Enabled switch”Order of events
Section titled “Order of events”- One action can send several events. They are sent one after another, in a fixed order. For example, creating a client in the app with projects, contacts, and tasks sends
clients.created, thenprojects.created,project-contacts.created,tasks.created, andassociations.created. - Events from different actions that happen at the same time can arrive in any order.
- If order matters to you, compare the
updatedAtvalue in the payload with the value you stored, or read the current record from the API.
Build a reliable receiver
Section titled “Build a reliable receiver”- Validate the signature first. Reject requests that fail with
401. - Respond quickly with
200. Put the event on a queue and process it after you respond. Because Crewsum waits for your response, slow processing slows down Crewsum for your users. - Return a
2xxstatus after you accept the event, even if you ignore that event type. Do not return a status above500on purpose: it stops delivery of that event to your other webhooks. - Make processing idempotent. There is no event ID. Use the record ID and
updatedAtfromdatato detect events you have already processed. - Reconcile on a schedule. Crewsum does not retry or replay events. Use the API list endpoints, such as Get Clients or Get Timesheets, to find changes you missed while your endpoint was unavailable.
- Handle the
debugevent. Send test and Send Event in Crewsum send{"event":"debug","data":{"message":"Debug Event"}}. Return200for it.