Chatfuel does not parse the entire json string that the JSON-API returns. Any help is welcome.
While the JSON returned from the API looks like this (in postman):
{
"messages": [
{
"text": "i think you should study"
},
{
"text": "Mikrobiologi"
}
]
}
the messenger bot only sends the first text.
my code for the app:
router.get('/ask/:question', function(req, res){
var output = [];
var keywords = req.params.question.split(' ');
var answer = qHandler.search(keywords);
answer.then(function(books){
output.push({text: 'i think you should study'})
for (var i = books.length; i > 0; i--){
output.push({text: books[i-1].title});
if (i-1 > 0){
output.push({text: ' and '});
}
};
res.send({messages: output});
});
});
I have tried changing the order, adding more hardcoded text both before and after the string(s) returned.
In postman everything looks like it should, but chatfuel does not seem to parse text objects with book-titles inserted.