कार्ड और Carousel के लिए Api.ai Facebook मैसेंजर एकता

वोट
1

आशा है कि आप लोगों को अच्छा कर रहे हैं!

मैं अपने चैट बॉट को 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 मान हैं।

मुझे इस पर मदद करते हैं।

अग्रिम में धन्यवाद।

09/09/2017 को 16:13
का स्रोत उपयोगकर्ता
अन्य भाषाओं में...                            


1 जवाब

कार्ड और Carousel के लिए Api.ai Facebook मैसेंजर एकता

वोट
1

आशा है कि आप लोगों को अच्छा कर रहे हैं!

मैं अपने चैट बॉट को 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 मान हैं।

मुझे इस पर मदद करते हैं।

अग्रिम में धन्यवाद।

09/09/2017 को 16:13
का स्रोत उपयोगकर्ता

Cookies help us deliver our services. By using our services, you agree to our use of cookies. Learn more