आशा है कि आप लोगों को अच्छा कर रहे हैं!
मैं अपने चैट बॉट को api.ai फेसबुक हिंडोला पाने के लिए एक मदद की ज़रूरत है। मैं NodeJS का उपयोग कर कई कार्ड प्राप्त करने के लिए json सरणी पर पुनरावृति करने में असमर्थ हूँ। आप कृपया मार्गदर्शन कर सके मुझे इसे यहाँ किया जाना कोड का टुकड़ा है।
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
});
मैं cardResponses से अधिक पुनरावृति करने के लिए कई मूल्य प्राप्त करने की जरूरत है। वर्तमान में cardResponses सरणी 10 मान हैं।
मुझे इस पर मदद करते हैं।
अग्रिम में धन्यवाद।













