Actually, I try to send multiple message with template on Facebook messenger by agent.add(new Payload) on library "dialogflow-fulfillment": "^0.6.1" like this :
Message with multiple template
When i do this on the dialogflow console, i have no problem, it works :
custom payload on the dialogflow
But I can't do it on my function nodejs, I can just send only one payload and no more. I had try this, but i have no result (except the message : "Test !") :
function test_intent(agent) {
var payloadFacebook = {
"messages": [
{
"facebook": {
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "Can I ask you a few questions?",
"buttons": [
{
"title": "Yes",
"payload": "Yes",
"type": "postback"
},
{
"payload": "No",
"title": "No",
"type": "postback"
}
]
}
}
}
},
{
"facebook": {
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "Can I ask you a few questions?",
"buttons": [
{
"type": "phone_number",
"title": "Yes",
"payload": "0606060606"
}
]
}
}
}
},
{
"facebook": {
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "Take that 3",
"buttons": [
{
"type": "web_url",
"title": " (Théorie)",
"url": "https://google.fr/"
}
]
}
}
}
}
],
"source": "facebook",
"speech": ""
};
agent.add("Test !");
agent.add(new Payload(agent.FACEBOOK, payloadFacebook, { sendAsMessage: true, rawPayload: true }));
}
Do you have a solution to send multiple payload custom on nodejs same on the dialogflow console please ?
Thank you