Dialogflow实现:如何发送多个有效载荷自定义Messenger?

问题描述

实际上,我尝试通过“ dialogflow-fulfillment”库上的agent.add(new Payload)在Facebook Messenger上发送带有模板的多个消息:“ ^ 0.6.1”像这样:

Message with multiple template

当我在dialogflow控制台上执行此操作时,我没有问题,它可以正常工作:

custom payload on the dialogflow

但是我无法在我的函数nodejs上执行此操作,我只能发送一个有效载荷,而不能发送更多。 我已经尝试过了,但是没有结果(消息“ 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","buttons": [
              {
                "type": "phone_number","title": "Yes","payload": "0606060606"
              }
            ]
          }
        }
      }
    },"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 }));

}

您是否有解决方案,请在对话框流控制台上在nodejs上发送多个自定义有效负载

谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)