Facebook 通过api.ai向fb messenger发送按钮响应
我已经开始使用diaglofFlow a.k.a api.ai和fb messenger集成 我定义了一个intent,current返回3个响应。2个文本响应和1个自定义负载 这两个文本响应很好,但假设返回按钮的自定义负载却不是 自定义负载看起来像Facebook 通过api.ai向fb messenger发送按钮响应,facebook,facebook-messenger,dialogflow-es,Facebook,Facebook Messenger,Dialogflow Es,我已经开始使用diaglofFlow a.k.a api.ai和fb messenger集成 我定义了一个intent,current返回3个响应。2个文本响应和1个自定义负载 这两个文本响应很好,但假设返回按钮的自定义负载却不是 自定义负载看起来像 { "recipient": { "id": "1234" }, "message": { "attachment": { "type": "template", "payload": {
{
"recipient": {
"id": "1234"
},
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "What do you want to do next?",
"buttons": [
{
"type": "web_url",
"url": "https://www.messenger.com",
"title": "Visit Messenger"
}
]
}
}
}
}
另外,请注意,收件人id是我不确定如何提供的。fb文件上说应该是收件人的号码。我不知道我将如何得到它?
recipient.id
是用户的页面范围id。当用户发起对话时,您将在webhook事件的sender.id
道具中收到它
recipient.id
是用户的页面范围id。当用户发起对话时,您将在webhook事件的sender.id
道具中接收该id
实际上这是可行的
{
"facebook": {
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "What do you want to do next?",
"buttons": [
{
"type": "web_url",
"url": "https://www.messenger.com",
"title": "Visit Messenger"
}
]
}
}
}
}
实际上,这是有效的
{
"facebook": {
"attachment": {
"type": "template",
"payload": {
"template_type": "button",
"text": "What do you want to do next?",
"buttons": [
{
"type": "web_url",
"url": "https://www.messenger.com",
"title": "Visit Messenger"
}
]
}
}
}
}
当用户向您的页面发送消息时,您将获得(收件人)id…当用户向您的页面发送消息时,您将获得(收件人)id…感谢您的回复。然而,在我的例子中,当用户键入消息时,它会通过webhook进入对话流。现在假设对话框流使用psid进行响应。但是当我作为自定义响应响应时,我看不到在对话框流中应该在哪里访问它?谢谢您的响应。然而,在我的例子中,当用户键入消息时,它会通过webhook进入对话流。现在假设对话框流使用psid进行响应。但是,当作为自定义响应响应响应时,我看不到应该在对话框流中从何处访问它?