I'm newbie in coding and Watson Conversation and I'm trying to do a chatbot that schedule appointments from Monday to Saturday. I used @sys-date entity and it worked fine, but I don't know how to exclude sunday.For exemple:
watson: What is the best date for you?
user: sunday
watson: On this day the establishment is closed
I tried in the workspace: (condition) if: action=='sunday' like this: workspace
And coded like this in nodejs
// Send the input to the conversation service
conversation.message(payload, function (err, data) {
if (err) {
return res.status(err.code || 500).json(err)
}else if(data.output.action==='sunday'){
var date = new Date();
if(!(date.getDay() % 6)){
return res.json(payload,data.output.text["On this day the establishment is closed"]);
}}else{
return res.json(updateMessage(payload, data));
}});});
And it still gives me the sunday date(ex. 23/04/2017). I know that everything is wrong, but I really tried.. can somebody help me, please? I'd appreciate if you could put the code to help me..
(payload, data.output.text["Sunday"])
is using the comma operator, and in this case that just ends up the same asdata.output.text["Sunday"]
. So what did you want to do here? – trincotdata.output.text["On this day the establishment is closed"]
looks wrong. You probably needdata.output.text = "On this day the establishment is closed";
as a separate statement, and then dores.json(updateMessage(payload, data));
. – trincot