Best practice around consuming status updates via Webhooks

Follow these best practices for consuming the Shipment Updates via Webhooks

All status Webhooks:

  1. If you subscribe to all status webhooks, Clickpost will trigger an update for each scan received from the courier partner.
  2. Sometimes, couriers send multiple scans in one go. To handle such cases, Clickpost identifies the latest status from the bulk scans received from the courier partner. Clickpost sends the latest_status of the shipment in the "latest_status" object of the webhook while the outer status represents the scan for which the webhook is triggered to you.
  3. If you want to use webhooks to log data and store all the scans received from courier partner, apply logic on the outer status of the webhook payload [clickpost_status_code outside latest_status]
  4. If you want to use webhooks to trigger communications to customers, consume latest_status and trigger communications based on that.
  5. Sometimes couriers send scans in random order

πŸ“˜

Example:

Clickpost received: In transit, out for delivery and delivered scan together from the courier. In this case, Clickpost will trigger 3 webhooks, one for In transit, 2nd for out for delivery and the third for the delivered update, but all the webhooks will have latest_status as delivered.

In case you want to trigger communications, always rely on the latest_status information.

🚧

Note

If you want to store data in your bookkeeping database, store the outer scan information in your system.

Also, make sure you implement a de-duplication check for the same scan as Clickpost gives you the capability to re-trigger the latest status webhook on your system.

Without deduplication, you might get multiple records for same scan in the system.