I'm unable to fetch and display the date from "http://worldtimeapi.org/api/timezone/Etc/GMT+7" but i'm able to display the date and time using the inbuilt function but i want to display it using the api.
function MessageHandler(context, event) {
if (event.message == "date2") {
context.simplehttp.makeGet('http://worldtimeapi.org/api/timezone/Etc/GMT+7', null, parser);
}
}
function parser(context, event) {
var dateJson = JSON.parse(event.getresp);
var date = dateJson.date;
context.sendResponse("Today's date is : " + date);
}
function MessageHandler(context, event) {
if (event.message == "date") {
context.sendResponse("Today's date is :" + Date());
}
}
function EventHandler(context, event) {
context.simpledb.roomleveldata = {};
MessageHandler(context, event);
}
I'm using gupshup IDE, whenever I give the input date2 I'm getting these lines in bot log
2407: [2019-03-08T09:00:33.249] [INFO] default-Setting Up Bot Event For Bot=> /devnode/Displayinhthedate
2408:[2019-03-08T09:00:33.250] [INFO] default - Setting Up Bot Context For Bot =>/devnode/Displayinhthedate
2409:[2019-03-08T09:00:33.252] [INFO] default-Successfully connected to: /devnode/Displayinhthedate/temp_db
2410:[2019-03-08T09:00:33.285] [INFO] default-Successfully Fetched Data For Key=>bot:global
2411:[2019-03-08T09:00:33.291] [INFO] default-Successfully Fetched Data For Key =>room:1234