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
Courier API credentials are stored using dotenv. If you do not have dotenv installed:
$ npm install dotenv
Add the following credentials to your .env
file:
FEDEX_KEY=
FEDEX_PASSWORD=
FEDEX_ACCOUNT_NUMBER=
FEDEX_METER_NUMBER=
UPS_ACCESS_LICENSE_NUMBER=
USPS_USER_ID=
Example input:
import { track, trackByCourierCode, trackFedex } from 'ts-shipment-tracking';
(async () => {
const exampleOne = await track('<fedex_or_ups_or_usps_tracking_number>');
console.log(exampleOne);
const exampleTwo = await trackByCourierCode('ups', '<ups_tracking_number>');
console.log(exampleTwo);
const exampleThree = await trackFedex('<fedex_tracking_number>');
console.log(exampleThree);
})();
Example 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