-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tracking.js
37 lines (32 loc) · 1003 Bytes
/
Tracking.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* Created by Shubham Jaiswal on 7/14/2017.
*/
var builder=require('botbuilder');
var tracking = require('dhl');
//var shippo = require('shippo')('shippo_live_213aa0409f0c52d0f0070cd8b0ed7a');
module.exports=[
function(session,result,next) {
builder.Prompts.text(session, "Please enter the tracking ID");
next();
}
,function(session,result,next) {
session.send("Wait a sec looking for the status of %s ", result.response);
session.dialogData.trackingid=result.response;
next();
},
// searching from DHL package
function(session,result){
var packet = {
"service": "dhl",
"id": session.dialogData.trackingid
};
tracking.track(packet, function (tracking) {
if (tracking.data.arrived === true) {
session.send("arrived.........");
session.endDialog('BYEEE!');
} else {
session.send("Oops!! not arrived yet :( .........");
session.endDialog('BYEEE!');
}
})}
]