[英]How to trigger intent after clicking on carousel item?
This is something that is confusing me.这是让我困惑的事情。 So, I have the following carousel with three items:
所以,我有以下三个项目的轮播:
//This is my test Carousel function googleAssistantOther1(agent){ let conv = agent.conv(); conv.ask('Please choose an item'); conv.ask(new Carousel({ title: `All Items`, items: { 'WorksWithGoogleAssistantItemKey1':{ title: `My Message`, description: `No description required`, image:{ url: 'https://i.imgur.com/sdUL0T7.png', accessibilityText: `item1`, }, }, 'GoogleHomeItemKey1': { title: `Test1`, description: `blah blah`, image: { url: 'https://i.imgur.com/sdUL0T7.png', accessibilityText: `item2`, }, }, 'SomeRandomKey1':{ title: `Test2`, description: `blah blah blah`, image: { url: 'https://i.imgur.com/sdUL0T7.png', accessibilityText: `item3`, }, }, }, })); // Add Actions on Goole responses to your agent's response agent.add(conv); }
When a list carousel card(or item) is tapped, it generates an event that will hit your webhook, unlike the simple text message.与简单的文本消息不同,当点击列表轮播卡片(或项目)时,它会生成一个将点击您的 webhook 的事件。
1st way (if your webhook handling the response)第一种方式(如果您的 webhook 处理响应)
So you need to handle it in your code.所以你需要在你的代码中处理它。
Generally, it should have intent
as actions_intent_OPTION
.通常,它的
intent
应该是actions_intent_OPTION
。 from there you need to segregate it.从那里你需要隔离它。
2nd way (if your code is not handling the response)第二种方式(如果您的代码未处理响应)
In this way, your intent must be able to handle actions_intent_OPTION
event generated by the carousel(or list).这样,您的意图必须能够处理由轮播(或列表)生成的
actions_intent_OPTION
事件。
for that, your intent need to add the event as shown in below image (Basically it tells the dialogflow that whenever the actions_intent_OPTION
events triggered, this intent is capable to handle it, but currently in your case, no intent matches the description and it's going to Default Fallback Intent)为此,您的意图需要添加如下图所示的事件(基本上它告诉对话流,每当触发
actions_intent_OPTION
事件时,该意图都能够处理它,但目前在您的情况下,没有意图与描述相匹配,它将继续默认回退意图)
So whenever the list item tapped it can handle the flow.因此,无论何时点击列表项,它都可以处理流程。
For more refer this documentation.有关更多信息,请参阅此文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.