I would like to store an entire sentence an user said and store it.
This his how I did but I can't get the sentence from A to Z an an whole entity, just few parts knows as "number", "location", ....
merge(request) {
return new Promise(function(resolve, reject) {
var entities = request.entities;
var context = request.context;
var message = request.message;
var sessionId = request.sessionId;
var intent = firstEntityValue(entities, 'intent');
if (intent == "write_free_text") {
context.free_text = request["text"];
}
if (intent == "choose_city") {
var city = firstEntityValue(entities, 'location');
context.city = city;
}
return resolve(context);
});
}
How can I do that and store the whole sentence with merge function ? Thank you
If you want the whole sentence, maybe you don't needs a entity, just get the message sent:
// Merge action
function merge(request) {
context.freetext = request["text"];
return context;
}
Bot: https://wit.ai/Godoy/bottest/stories/4da2840f-513e-42ed-a494-c5516c07242e
Fiddle with code: https://wit-ai.github.io/witty-fiddle/?id=e4c16a624c87d37f9c0c29d8299ca5fc