Socket
Socket
Sign inDemoInstall

consignment-tracker

Package Overview
Dependencies
68
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    consignment-tracker

A unified consignment tracker


Version published
Weekly downloads
10
increased by233.33%
Maintainers
1
Install size
12.5 MB
Created
Weekly downloads
 

Readme

Source

This is a NodeJS module to simplify the process of tracking consignments. Tracking numbers are magically resolved, and results will always be in a uniform format. Currently supports UPS, Yodel & Truline in the United Kingdom.

Install

npm i consignment-tracker

Example

const config = {
    ups: { // UPS config (required for UPS tracking only)
        user: "xxxx",  // UPS username
        pass: "xxxx",  // UPS password
        access: "xxxx" // UPS Access License Number
    },
    truline: { // Truline config (require for Truline tracking only)
        account: "00000"
    }
};
const track = require('consignment-tracker')(config);

let result = await track('XXXXXXXXXXXXXXXX');

let results = await track([
    '1111111111111',
    '2222222222222',
    '3333333333333'
]);

Usage

Track a single consignment

let result = await track(reference);

Track a batch of consignments

let results = await track([ref1, ref2, ref3]);

Track a single consignment and request full tracking history.

let result = await track(reference, {history: true});

Notes

  • In the case of tracking a single reference, track() will throw an error if there is a failure performing the tracking.
  • If you provide an array to track(), it will not throw. Instead, each individual error in the batch will be returned in the results along with the corresponding tracking reference.
  • If performing many lookups, it is always preferable to track an array of references, rather than individually. The tracking has appropriate built-in rate limiting (independent for each courier), and can sometimes eliminate some requests altogether.
  • The result from a batch-track will not be returned in the same order as requested.

Result schema

Status codes

  • D : Delivered
  • I : In Transit
  • X : Exception (failure in the delivery process, e.g. address not found)
  • M : Manifested (parcel not yet handed to the courier)

Result object

{
	courier: {type:"string"},
	service: {type:"string"},
	tracking_ref: {type:"string"},
	consignment_ref: {type:"string"},
	parcel_ref: {type:"string"},
	po_number: {type:"string"},
	dest_postal_code: {type:"string"},
	dest_country_code: {type:"string"},
	status_code: {type:"string", enum:["D", "I", "X", "M"]},
	description: {type:"string"},
	location: {type:"string"},
	pod_signatory: {type:"string"},
	pod_image_url: {type:"string"},
	date: {type:"date"},
	comments:  {type:"string"},
	history: [
		{
			status_code: {type:"string", enum:["D", "I", "X", "M"]},
			description: {type:"string"},
			location: {type:"string"},
			pod_signatory: {type:"string"},
			pod_image_url: {type:"string"},
			date: {type:"date"},
			comments: {type:"string"}
		}
	]
}

FAQs

Last updated on 15 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc