forked from Koredotcom/BotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrderAPizza_sync.js
31 lines (28 loc) · 906 Bytes
/
OrderAPizza_sync.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
var botId = "st-c25b022b-c979-5d63-95b1-0045ee45b0ba";
var botName = "OrderPizza";
var sdk = require("./lib/sdk");
/*
* This is the Sync version of OrderAPizza.js.
*
* The webhook to PlaceOrder is responding syncronously.
*/
module.exports = {
botId : botId,
botName : botName,
on_user_message : function(requestId, data, callback) {
sdk.sendBotMessage(data, callback);
},
on_bot_message : function(requestId, data, callback) {
sdk.sendUserMessage(data, callback);
},
on_webhook : function(requestId, data, componentName, callback) {
if (componentName === 'PlaceOrder') {
sdk.saveData(requestId, data)
.then(function() {
//Place the order.
data.success = 'true';
callback(null, data);
});
}
}
};