Skip to main content

Learn More About AfterShip Tracking Webhooks

AfterShip Tracking Webhooks: follow setup steps, configure key options, verify behavior, and troubleshoot workflow issues, and avoid setup errors.

Plans: Premium, Enterprise Platforms: All Platforms

Overview

Webhooks act as a gateway to receive raw data at a particular destination that you define. Webhook is used to ask AfterShip to push back any updates to your system. This is used when the store wants to send out notifications by itself or receive the latest delivery status/checkpoint. Users can select when to ask AfterShip pushes back delivery updates when using webhook.

How to setup webhook

  1. Go to notification settings in your AfterShip Tracking admin.

  2. Add webhook URL (up to 10).

  3. Select Events to start receiving updates.

AfterShip verifies the webhook by sending a POST request to the provided URL. The webhook would be added successfully upon responding 200 HTTP status code.

How to secure webhooks

Webhooks(v4.3 or above) include a calculated digital signature for verification. Each webhook request includes an aftership-hmac-sha256 header. The signature is a base64-encoded HMAC generated using the SHA-256 algorithm with the webhook request body and webhook secret of your account.

Each webhook request could be verified by comparing the computed HMAC digest and the attached HMAC digest in the header.

The following Node.js example demonstrates the computation of a webhook signature.

const crypto = require('crypto');
const WEBHOOK_SECRET = "....."; // your webhook secret

function generateSignature(requestBodyString) {
return crypto
.createHmac('sha256', WEBHOOK_SECRET)
.update(requestBodyString, 'utf8', 'hex')
.digest('base64');
}

Please note that the webhook secret can be obtained by going to Settings > Notifications.

In case you need any further assistance, please contact our support team.

Did this answer your question?