ts-shipment-tracking
Unified shipment tracking data from FedEx, UPS, and USPS APIs.
Table of Contents
- About
- Installation
- Usage
- Built With
- Acknowledgements
About
Returns a unified response from FedEx, UPS, and USPS tracking APIs.
Installation
$ npm install ts-shipment-tracking
Usage
Input:
import { trackFedex, trackUps, trackUsps } from 'ts-shipment-tracking';
(async (): Promise<void> => {
try {
const fedex = await trackFedex('<fedex-tracking-number>', {
key: '<fedex-key>',
password: '<fedex-password>',
accountNumber: '<fedex-account-number>',
meterNumber: '<fedex-meter-number>'
});
console.log(fedex);
const ups = await trackUps('<ups-tracking-number>', {
accessLicenseNumber: '<ups-access-license-number>'
});
console.log(ups);
const usps = await trackUsps('<usps-tracking-number>', {
userId: '<usps-user-id>'
});
console.log(usps);
} catch (error) {
console.log(error);
}
})();
Output:
{
events: [
{
status: 'IN_TRANSIT',
label: 'Arrived at FedEx location',
location: 'LEBANON TN US 37090',
date: 1616823540000
},
...
],
estimatedDelivery: 1616996340000
}
Statuses:
'UNAVAILABLE'
'LABEL_CREATED'
'IN_TRANSIT'
'OUT_FOR_DELIVERY'
'DELIVERY_ATTEMPTED'
'RETURNED_TO_SENDER'
'EXCEPTION'
'DELIVERED'
Built With
Acknowledgements