Is their any way to send multiple simple response in dialogflow
Asked Answered
D

2

5

I need to send (more than 2 responses) simple responses back to user during the invocation for particular intent. But it is restricted to 2 simple response as mentioned in actions on google documentation.

Is there any other way to send multiple responses?

Disherison answered 30/7, 2018 at 6:9 Comment(2)
Why do you think you need to send more than two simple responses?Behan
its a requirement to send collective of information for example like events which need to be send back to user so..Disherison
B
10

The short answer is no, you can't send back more than one SimpleResponse at a time.

There are, however, ways to work with this depending on your needs and making sure you are respecting good Visual UI design.

  1. You can concatenate many of the items you're sending back into a single spoken paragraph.

    So if you have list items like:

    • Red
    • Green
    • Blue

    You can concatenate them into a single string and might send back a single SimpleResponse with "The colors I have selected for you are red, green, and blue."

    But be careful if you have a very long list. So if you have a list of 20 or so colors, you would not want to say "The colors I have selected are red, green, blue, yellow, brown, black, white, purple, lavender, peach, mauve, scarlet, gold, ruby, silver, teal, grey, orange, bronze, and pearl." In cases like this...

  2. With lots of items, and particularly where you are expecting the user to be on a visual display device, you can say just a few of the items (say, the 3 most likely) and show a text blurb with even fewer and then use a List or Carousel to display a more complete set. This might look something like

    conv.ask(new SimpleResponse({
      speech: 'The colors I have selected for you include red, green, blue, and 17 more',
      text: 'Here are the colors I have selected for you.'
    });
    conv.ask(new List({
      items:{
        red: {title: "red"},
        green: {title: "green"},
        blue: {title: "blue"},
        // You get the idea
        pearl: {title: "pearl"}
      }
    };
    
  3. If you are using just voice, consider ways to narrow that list down further. For example, you might report "I have 20 colors for you. Are you looking for something more reddish or more bluish?" and continuing to narrow it down.

  4. As a final alternative, you might want to read just a short list of what is available, but indicate how many other choices they have and let them "audibly scroll" through the list. This isn't great, since it requires a lot of additional work on your part and your user, but it is a good option in some cases.

Behan answered 30/7, 2018 at 13:11 Comment(3)
Thanks a lot PrisonerDisherison
If the answer helps you, upvoting and/or accepting it is always appreciated.Behan
Just as an update: from april the 3rd I found that only the first simple response is read and the second is displayed as text on the phone but not read. This can be an issue since when the agent starts 2 messages are given to be played ("Sure. Getting the test version of <agent name>" + the welcome message) but the welcome message never gets read.Cloe
N
1

I think you can pass multiple responses from your webhook in this way. basically once your webhook get a request from the dialogflow you will do the process and pass the fulfillmentText back as the response. so there you can convert your json object to string and pass it back. from the frontend application you can convert it back to json or what ever format you want and use it however you want.

A simple example form nodejs (webhook). the approach should be same for all languages

router.post('/web-hook', function(req, res, next) {
    //do your process here
    res.json({
        'fulfillmentText': JSON.stringify([{response:"response 1"},{response:"response 2"},{response:"response 3"}])
    });
})
Noise answered 30/7, 2018 at 11:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.