Remélem srácok csinálnak jó!
Kell egy segítség, hogy api.ai facebook körhinta, hogy én chat-bot. Nem tudok végighaladni a JSON, hogy a több kártya használatával Nodejs. Tudna vezessen, hogy intézd Itt látható a kódrészletet.
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
});
Meg kell végighaladni cardResponses, hogy a többszörös értéket. Jelenleg cardResponses Array tartalmaz 10 értékeket.
Segíts nekem.
Előre is köszönöm.













