Webhook Overview
You can configure webhook endpoints directly from your personal dashboard. Biteship has multiple webhook events
- order.status
Webhook will be fired every time there is an status update - order.price
Webhook will be fired every time there is a change in price. This happens when the shipping rates is different from the actual weight - order.waybill_id
Webhook will be fired every time there is an update for your waybill number
Benefits of Webhooks for Tracking Shipments
Webhooks offer several advantages for tracking shipments:
Real-time Updates: Webhooks provide instant notifications about shipment status changes, allowing you to stay up-to-date without constantly polling the API.
Automated Workflows: You can trigger automated actions in your system based on shipment events, such as sending customer notifications or updating internal databases.
Improved Customer Experience: With real-time data, you can keep your customers informed about their shipments promptly, enhancing their satisfaction.
Reduced API Load: Webhooks eliminate the need for frequent API calls to check for updates, reducing the load on both your system and Biteship's servers.
Efficient Resource Usage: By receiving updates only when changes occur, you can optimize your system's resource allocation and processing.
Enhanced Tracking Accuracy: Webhooks ensure you have the most current information about shipments, improving the accuracy of your tracking systems.
Scalability: As your business grows, webhooks can easily handle increased shipment volumes without requiring changes to your integration.
By leveraging webhooks for shipment tracking, you can create a more responsive, efficient, and customer-friendly logistics system.
Webhook Delivery
Biteship sends each webhook as an HTTP POST request with a JSON body to the URL you configured. This applies to both live and test (sandbox) webhooks.
Outgoing IP Address
All webhooks are sent from the following IP address. If your endpoint is behind a firewall, add it to your allowlist:
43.218.194.247
Verification Request When Adding a Webhook
When you add a webhook, Biteship first sends a test POST request to your URL to check that it is reachable. The webhook is only saved if your endpoint responds with a 2xx status code.
This test request has an empty body, not even an empty JSON object ({}), although it is sent with the Content-Type: application/json header. If you set a signature key and secret, that header is included too. The X-Biteship-Delivery-Id and X-Biteship-Delivery-Attempt headers are not sent, and the test request is never retried.
Some frameworks reject a request with Content-Type: application/json and an empty body, or your own validation may expect a payload. Make sure your endpoint responds with 2xx to this request. If it does not, adding the webhook fails with:
Webhook URL doesn't respond with ok response. Please make sure it respond with ok upon installation, by disabling validation, and accepting empty request body for application/json. After the installation succeed, validation can be applied.
Response and Timeout
Your endpoint must respond with a 2xx status code within 45 seconds. Any other status code, a timeout, or a connection error is treated as a failed delivery.
We recommend responding as soon as the request is received and processing the payload afterwards, for example in a background job.
Request Headers
| Header | Description |
|---|---|
Content-Type | Always application/json. |
X-Biteship-Delivery-Id | Unique ID of the delivery. It stays the same on every retry of the same webhook, so you can use it to ignore duplicates. |
X-Biteship-Delivery-Attempt | Attempt number of this request, starting from 1 for the first attempt. |
If you set a signature key and secret on your webhook, it is sent as an additional header with the key as the header name and the secret as its value.
Retries
Retries are off by default. When they are off, a failed delivery is not sent again.
You can turn retries on for each webhook from the Webhook Settings page in the dashboard, either when you add the webhook or later with Retry Settings on an existing one. Once on, you choose how many times a failed delivery is retried, from 1 to 3. Retries are sent on a fixed schedule:
| Attempt | Sent |
|---|---|
| 1 | Immediately |
| 2 (retry 1) | 1 minute after attempt 1 |
| 3 (retry 2) | 5 minutes after attempt 1 |
| 4 (retry 3) | 30 minutes after attempt 1 |
With fewer retries, the schedule stops early: 1 retry is sent at 1 minute only, 2 retries at 1 and 5 minutes. A retry is only sent if every attempt before it failed. Because each attempt can take up to 45 seconds, a retry may arrive a couple of minutes later than scheduled.
After the last attempt fails, the webhook is not sent again.
A few things to keep in mind:
- Retries carry the same body and the same
X-Biteship-Delivery-Idas the first attempt. If your endpoint processed a request but responded too late, you may receive it again. - If you deactivate or delete the webhook, pending retries are cancelled. Changing the retry settings applies to failures from then on; retries already scheduled keep their original schedule.
- For
order.status, a retry is skipped when a newer status update for the same order has already been sent, so an old status never overwrites a newer one. - Webhooks passed in an order request, instead of being added in the dashboard, are not retried.
Event Type
Order Status
The Order Status webhook provides real-time updates about the status changes of your shipments. By implementing this webhook, you can maintain real-time synchronization between Biteship's system and your own, ensuring you always have the most up-to-date information about your orders.
{
"event": "order.status"
"courier_tracking_id": "XYZ-123-PQS"
"courier_waybill_id": "SKS-XXXXX",
"courier_company": "JNE",
"courier_type": "REG",
"courier_driver_name": "Maulana Imran",
"courier_driver_phone": "088888888888",
"courier_driver_photo_url": "https://picsum.photos/200",
"courier_driver_plate_number": "B 1234 AAA",
"courier_link": "https://xxx-yyy-zzz.com",
"order_id": "5dd6da88f43bd430ecd5aa2e",
"order_price": 100000,
"status": "confirmed"
}
Order Price
The Order Price webhook provides real-time updates about the price changes of your shipments. By implementing this webhook, you can maintain real-time synchronization between Biteship's system and your own, ensuring you always have the most up-to-date information about your orders.
Price changes when the actual weight is different from the weight used to calculate the price. Order price is the price that will be charged to the customer.
{
"cash_on_delivery_fee": 100000,
"courier_tracking_id": "ASjsd92Asd2d1ASdj91",
"courier_waybill_id": "Abc-123",
"event": "order.price",
"order_id": "ASjsd92Asd2d1ASdj91",
"price": 100000,
"proof_of_delivery_fee": 2000,
"shippment_fee": 10000,
"status": "picked"
}
Order Waybill Id
The Order Waybill Id webhook provides real-time updates about the waybill id changes of your shipments. By implementing this webhook, you can maintain real-time synchronization between Biteship's system and your own, ensuring you always have the most up-to-date information about your orders.
Order waybill id changes when the courier has updated the waybill id for the shipment. It happens when the shipment is picked up by the courier and then there's a switch to the next courier.
{
"order_id": "AbSASD12213dadas",
"courier_tracking_id": "AbSASD12213dadas",
"courier_waybill_id": "abc-1234",
"event": "order.waybill_id",
"status": "picked"
}