Spero che tu ragazzi stanno facendo bene!
Ho bisogno di un aiuto per ottenere api.ai facebook carosello nella mia chat bot. Sono in grado di iterare l'array JSON per ottenere le più schede utilizzando Nodejs. La prego di guidarmi per farlo fare Ecco il pezzo di codice.
function(results){
var cardResponses = [];
for(var i=0;i<results.length;i++){
var richResponses = {
'facebook': {
'attachment': {
'type': 'template',
'payload': {
'template_type': 'generic',
'elements': [
{
'title': results[i].ItemAttributes.Title,
'image_url': results[i].MediumImage.URL,
'subtitle': INR 250,
'buttons': [
{
'type': 'web_url',
'url': results[i].DetailPageURL,
'title': 'Shop Now '
}
]
}
]
}
}
}
}
cardResponses.push(richResponses);
}
// need to get the response in object form to pass on data field of res.json
res.json({
speech : “hi this is response”,
displayText: “This is from API.AI”,
data: cardResponses
});
Ho bisogno di iterare cardResponses per ottenere il valore multiplo. Attualmente cardResponses array contiene 10 valori.
help me su questo.
Grazie in anticipo.













