我试图通过php中的webhook连接到我的后端来了解DialogFlow工具 . 我可以做到这一点 . 当我尝试同时通过json发送多个响应时,我遇到了问题 . Dialogflow向我显示webhook的执行对我的所有响应都是正确的,但实际上只执行我发送的两个响应中的一个 . 我想要做的就是从我的php后端显示Facebook Messenger卡上的图像,然后让我的客户输入一个数字 . 但我只能出示该卡,或要求输入该号码,而不是同时进行 . 下面我粘贴我的代码 . 如果您通过DialogFlow中的webhook运行相同的操作,则只请求输入值,但不会在Facebook Messenger中显示该图像 . 如果我删除了followupEventInput的一部分,它会显示图像,但不会请求用户输入数字 . 提前致谢...
$data = '{
"fulfillmentMessages":[
{
"card":{
"title":"card title",
"subtitle":"card text",
"imageUri":"https://www.google.com/images/branding/product/1x/google_my_business_512dp.png",
"buttons":[
{
"text":"button text",
"postback":"https://assistant.google.com/"
}
]
}
},
{
"card":{
"title":"card title 2",
"subtitle":"card text",
"imageUri":"https://www.gstatic.com/images/branding/product/2x/photos_96dp.png",
"buttons":[
{
"text":"button text",
"postback":"https://assistant.google.com/"
}
]
}
},
{
"payload":{
"google":{
"expectUserResponse":true,
"richResponse":{
"items":[
{
"simpleResponse":{
"textToSpeech":"Buena elección!"
}
}
]
}
},
"facebook":{
"text":"Buena elección!"
}
}
}
],
"followupEventInput":{
"name":"disparo",
"languageCode":"es",
"parameters":{
"param":"$cantidad"
}
}
}';
$response = $data;
echo $response;