Is there a way to simply follow a URL in the Caroussel Selector?

怎甘沉沦 提交于 2019-12-24 06:07:53

问题


I am trying to figure out how I can embed Google Actions responses, such as the cards carousel, in a webhook response for DialogFlow.

According to the documentation, the structure looks as following:

"carouselSelect": {
    "items": [
    {
        "optionInfo": {
            "key": "MATH_AND_PRIME",
            "synonyms": [
                "math",
                "math and prime",
                "prime numbers",
                "prime"
            ]
        },
        "title": "Math & prime numbers",
        "description": "42 is an abundant number because the sum of its proper divisors 54 is greater...",
        "image": {
            "url": "http://example.com/math_and_prime.jpg",
            "accessibilityText": "Math & prime numbers"
        }
    }

Is there a way to let the device simply follow a link when a certain card is clicked?

In the documentation, there is a paragraph Handling selected item, but this does not really answer my question. In my case, I am showing the cards from a DialogFlow conversation as explained in How can I integrate the Google Actions responses in a webhook response in Dialogflow?, so I am not following the Google Actions SDK flow as explained in these docs.

Also as a side note, if I am understanding this paragraph correctly, the backend service is called with a certain selected item. In my scenario, I don't need this information in the backend, I would rather want the device to just follow the URL.


回答1:


In short - not directly, no. (Update: Yes. See below.)

You're mixing terminology, which may be causing some confusion. The Actions on Google defines a few different GUI components which have different capabilities:

  • Options to advance the conversation can be presented as List or Carousel items. Both of these allow an image and some text (think around a sentence or two). The selection option is sent back to your Action with the intention that the user will select one to continue the conversation. It is not meant to be the result of the conversation.

  • You can also show a single Card which also contains an image and some text. Unlike the Options, however, you can only display a single card, and it can contain a URL that links elsewhere. Cards are intended to be the result of a conversation.

  • There are also Suggestion Chips which are a word or two and are intended to supplement the above options to change the direction of the conversation.

  • Finally, there is a Link-out Chip which is a chip with a URL.

The best you can do at this point is to present the user with the options available and, once they reply, present a card with a link out directly on the card, or prompt them if this is what they wanted and offer a suggestion chip saying "no" that goes back into the conversation or a link out chip to the destination that the card represents.

Update: Google has just added the ability to create a Browsing Carousel, which allows you to create something that looks like a carousel, but only has links. The Browsing Carousel is defined differently (it is part of a RichResponse rather than a possible Intent), but the two look very similar.



来源:https://stackoverflow.com/questions/49113480/is-there-a-way-to-simply-follow-a-url-in-the-caroussel-selector

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!