A webhook sends consignment events to your own system as they happen, so it can react without checking MachShip for changes.
Before you start
- You need the Company Automations permission at Create/Delete.
- You need an endpoint in your system that accepts HTTPS requests on port 443.
How to set up a webhook
- Go to Admin > Rules > Automations and click Create Automation.
- In Details, enter a Name, for example "Send events to our system", and choose the Company.
- In Trigger, choose When something happens and the event, for example Consignment ยท Created. Optionally, add Filters.
- In Do this, choose Fire a webhook.
- Choose the Method: POST or PUT.
- Enter the Endpoint URL. It must start with https and use port 443.
- Optionally, enter a Signing secret of at least 32 characters, so your system can check that each delivery came from MachShip. Leave it empty to send deliveries unsigned.

- Optionally, under Custom headers, click Add header to send a header with every delivery, for example an API key your endpoint expects. You cannot use Content-Type, Idempotency-Key, Accept-Encoding, X-MachShip headers or connection headers.
- Click Save.

Result
Each time the event happens to a matching consignment, MachShip sends a request to your endpoint. Check each delivery in View logs.
What your endpoint receives
- A JSON body with four fields: id (the consignment ID), companyId, carrierConsignmentId and eventData. To get more detail, call the MachShip API with the ID.
- The headers X-MachShip-Event, X-MachShip-Timestamp and Idempotency-Key, plus your custom headers.
- With a signing secret, an X-MachShip-Signature header:
sha256= followed by the HMAC-SHA256 of the X-MachShip-Timestamp, X-MachShip-Event and Idempotency-Key values and the raw body, joined by new lines. Recompute it with your secret, compare the two, and reject deliveries with an old timestamp.
Retries
- A 2xx response is a success.
- A 5xx response or no response within 10 seconds is retried.
- A 3xx or 4xx response is a failure and is not retried. Redirects are not followed.
Use the Idempotency-Key header to ignore a delivery your system has already processed.
Change a webhook later
Saved URLs, secrets and header values are hidden for security. Click Replace to enter a new one. If you change the Endpoint URL, enter the signing secret and header values again.

Related guides