User-selected select favorite Webhook user-selected

I am new to API.AI and Google Actions. I have a list of items that are generated by executing. I want to select an option selected by the user. I tried reading the documentation but I don't seem to get it.

https://developers.google.com/actions/assistant/responses#handling_a_selected_item

I've also tried setting up follow-up intents, but that doesn't work. It always ends up giving back reactions.

I am trying to search for a product or whatever and the result is displayed in list format. I want to get the selected option. This is the intent of search_product and I have a subsequent intent of select_product

enter image description here

enter image description here

enter image description here

+3


source to share


4 answers


You have two options to get information about the event selection event in Google / Carousel app in API.AI:

  • Use API.AI event actions_intent_OPTION

As the prisoner already mentioned, you can create an intent with actions_intent_OPTION

. This intent will match queries that involve list / carousel selection as described here .

  1. Use web host


API.AI will pass the list / carousel to your web hockey, which can be obtained by either:

A) with Google Action in Google Node.js client library using app.getContextArgument () method .

B) Use originalRequest

JSON attirbute in the body of your webcheck requests to receive list / carousel select events. The webcam request structure of the list / carousel selection event will look something like this:

{
  "originalRequest": {
    "data": {
      "inputs": [
        {
          "rawInputs": [
            {
              "query": "Today Word",
              "inputType": "VOICE"
            }
          ],
          "arguments": [
            {
              "textValue": "Today Word",
              "name": "OPTION"
            }
          ],
          "intent": "actions.intent.OPTION"
        }
      ],
    ...

      

+2


source


This answer your question aside, but if you are new to actions, you may not understand the best approaches for designing your own actions.

Instead of focusing on more complex types of responses (like lists), instead focus on the conversation you want to have with your user. Don't try to limit your answers - expand what you think you can accept. Focus on the main dialog elements and your main dialog responses.



Once you've implemented a good conversation, you can go back and add elements that help with that conversation. The list should suggest what the user can do, not a limit on what they should do.

With dialog interfaces, we have to think outside of the dialog.

+1


source


Include "actions_intent_OPTION" in the event section of the intent you are trying to call when an item is selected from the list / carousel (both work). Then use this code in the function that you activate in your website, not getContextArguments () or getItemSelected ():

const param = assistant.getArgument('OPTION');

      

OR app.getArgument ('OPTION');

depending on what you called your ApiAiApp (i.e.):

let Assistant = require('actions-on-google').ApiAiAssistant;

const assistant = new Assistant({request: req, response: response});

      

Then move on to how the rest of the example is done in the documentation for list / carousel helpers. I don't know exactly why this works, but this method appears to retrieve the actions_intent_OPTION parameter from the JSON request.

+1


source


I think the problem is that responses that are generated when clicking on the list (as opposed to conversations) end with an event actions_intent_OPTION

, so API.AI requires you to do one of two things:

  • Alternatively, create an intent with this event (and other contexts, if you like, to determine which list is processed) like this:

enter image description here

  1. Or create a Fallback Intent with the specific Context you want (i.e. not your Default Backback Intent).

The latter seems to be the best approach as it will also respond to voice responses.

(Or both, I think.)

-1


source







All Articles