将自定义有效负载按钮链接到意图
我已经使用此自定义负载来生成按钮,但是如果用户单击“是”跟进默认意图“是” 响应等,我如何将特定意图链接到按钮,如下例所示。
{
"richContent": [
[
{
"text": "Yes",
"link": "https://example.com",
"type": "button",
"icon": {
"color": "#FF9800",
"type": "chevron_right"
},
"event": {
"languageCode": "en",
"name": "DefaultWelcomeIntent.DefaultWelcomeIntent-yes",
"parameters": {}
}
},
{
"event": {
"parameters": {},
"name": "DefaultWelcomeIntent.DefaultWelcomeIntent-no",
"languageCode": "en"
},
"type": "button",
"link": "https://example.com",
"text": "No",
"icon": {
"type": "chevron_right",
"color": "#FF9800"
}
}
]
]
}
I am Already using this custom payload to generate buttons but how can I link specific intent to the buttons like in the example below if user clicks yes follow up default intent yes response and so on.
{
"richContent": [
[
{
"text": "Yes",
"link": "https://example.com",
"type": "button",
"icon": {
"color": "#FF9800",
"type": "chevron_right"
},
"event": {
"languageCode": "en",
"name": "DefaultWelcomeIntent.DefaultWelcomeIntent-yes",
"parameters": {}
}
},
{
"event": {
"parameters": {},
"name": "DefaultWelcomeIntent.DefaultWelcomeIntent-no",
"languageCode": "en"
},
"type": "button",
"link": "https://example.com",
"text": "No",
"icon": {
"type": "chevron_right",
"color": "#FF9800"
}
}
]
]
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用建议芯片响应类型方法在您的自定义负载中,您将能够拥有所需的“是”和“否”按钮。单击所需按钮后,它将在 Dialogflow Messenger 上以文本响应形式返回,并且您将被重定向到与基于文本响应的后续意图相匹配关于后续意图的训练短语(例如“是”、“否”等)。
您可以尝试下面的示例自定义负载,并且必须能够将您重定向到
后续意图 - 是
或后续意图 - 否
,具体取决于您单击的按钮。更新:
对于您的用例,还有另一种方法,它使用当前的自定义负载脚本。请参阅下面更新的自定义负载脚本。
如您所见,我更改了两个按钮的事件名称的值。
click_yes
表示按钮是,click_no
表示按钮否。下一步是转到默认欢迎意图 - yes,然后在事件下输入
click_yes
。通过这样做,意图将由与您的 Yes 按钮相关的click_yes
事件触发。 (使用事件名称click_no
对默认欢迎意图 - no 执行相同的步骤。)You may use the Suggestion Chip Response Type approach in your custom payload in which you will be able to have your desired "Yes" and "No" button. Once you click on your desired button, it will return as a text response on the Dialogflow Messenger and you will be redirected to your follow-up intent that matches the text response based on the training phrases of the follow-up intent (eg. "Yes", "No", etc).
You may try below sample custom payload and must be able to redirect you to either
follow-up intent - yes
orfollow-up intent - no
depending on the button you click.UPDATE:
There is another approach for your use case that uses your current custom payload script. Please see below updated custom payload script.
As you can see, I changed the value of the event name for both buttons.
click_yes
for button Yes andclick_no
for button No.Next step is to go to your Default Welcome Intent - yes and under Events, input
click_yes
. By doing this, the intent will be triggered by theclick_yes
event that is tied up to your Yes button. (Do the same step for Default Welcome Intent - no by using the event nameclick_no
.)当您的按钮触发intent2事件时,您的流程将继续在intent2上
now when your button triggered intent2 event your flow will continue on the intent2