Webhook Overview
AfterShip Tracking can send webhook events to notify your system when a particular event has happened. Learn to set up webhooks.
How to setup the Webhooks
You can enable the webhook from the notifications webhooks settings
- Select Webhook version, the latest version is preferred
- Insert Webhook URL, you can create up to 10 Webhook URLs. Your URL port number should be 80,443,8080.
- (Optional) Add custom headers(up to 5 per URL) to the URL for authentication
- (Optional) To validate the webhook URL, click on Send test webhook to initiate a test event. It is crucial to ensure that the HTTP response code falls within the range of 200 to 299. If AfterShip does not receive a valid response code within this range, it will be considered as a failed validation.”
- Click Save to create the webhook destination URL
Securing Webhooks
We currently support either HTTP or HTTPS URLs, so you can have security by using an SSL-enabled URL. But keep in mind that your endpoint is going to be wide-open on the internet, and you might not want others to be able to submit random data to your systems. At this time, aside from trying to keep the URL private, our best advice is to verify the request using the AfterShip webhook signature or verify the request by the basic authentication, verification (bearer) token, or secret key base on the custom headers.
Retry Webhooks
AfterShip Tracking sends event driven data to webhook URL via POST method. In case of an unsuccessful event (HTTP response code NOT between 200 and 299), AfterShip Tracking attempts to deliver your webhooks for up to 14 times with an exponential back off. The attempts are based on your original webhook setting of the first attempt.
The current attempt webhook delay is calculated by this formula: 2^(number of retry) x 30s
# of attempt | # of retry | Delay (sec) before send out | Acc. Delay (sec) |
---|---|---|---|
1 | 0 | 0 | 0 |
2 | 1 | 30 | 30 |
3 | 2 | 60 | 90 |
4 | 3 | 120 | 210 |
5 | 4 | 240 | 450 |
6 | 5 | 480 | 930 |
7 | 6 | 960 | 1890 |
8 | 7 | 1920 | 3810 |
9 | 8 | 3840 | 7650 |
10 | 9 | 7680 | 15330 |
11 | 10 | 15360 | 30690 |
12 | 11 | 30720 | 61410 |
13 | 12 | 61440 | 122850 |
14 | 13 | 122880 | 245730 |
For example, If the attempt fails, AfterShip Tracking will retry the 2nd attempt 30s later. If the 7th attempts fail, AfterShip Tracking retry the 8th attempt 960s later If the 14th attempts fail, AfterShip Tracking will not send out that webhook any more.