Get package delivery tracking informations from Chronopost
In your application root directory, enter this command to install the connector:
npm install chronopost-tracking --save
This installs the module from npm and adds it as a dependency to the application's package.json
file.
Returns everything in one object
const tracking = require('chronopost-tracking');
// Using Promise
tracking.getTracking('XV297889338KL').then(tracking => {
console.log(tracking);
});
// Using async/await
console.log(await tracking.getTracking('XV297889338KL'));
/*
{
trackingId: 'XV297889338KL',
currentStatus: "Livraison effectuée",
duration: 4,
isComplete: true,
lastDate: "2022-06-03T16:23:00.000Z",
startDate: "2022-05-31T03:08:00.000Z",
history: [{
datetime: "2022-05-31T03:08:00.000Z",
text: "Colis en cours de préparation chez l'expéditeur",
location: undefined
}, {
datetime: "2022-06-03T09:45:00.000Z",
text: 'Prise en charge de votre colis sur notre site logistique de HUB LYON.',
location: 'HUB LYON'
}, {
datetime: "2022-06-03T05:05:00.000Z",
text: "Tri effectué dans l'agence de distribution",
location: undefined
}, {
datetime: "2022-06-03T09:42:00.000Z",
text: 'Colis en cours de livraison au point de retrait',
location: undefined
}, {
datetime: "2022-06-03T16:23:00.000Z",
text: "Livraison effectuée",
location: 'DIJON'
}]
}
*/