Mircea Baicu
Mircea Baicu

Reputation: 141

Webhook response: Show suggestion chips with followupEventInput

The google assistant does not show the suggestion chips sent into the webhook response.

{
"fulfillmentText": "Some text",
"payload": {
    "google": {
        "expectUserResponse": true,
        "richResponse": {
            "items": [
                {
                    "simpleResponse": {
                        "textToSpeech": "What number ?"
                    }
                }
            ],
            "suggestions": [
                {
                    "title": "One"
                },
                {
                    "title": "Two"
                }
            ]
        }
    }
},
"followupEventInput": {
    "name": "numbers",
    "parameters": {
        "param1": "this is it"
    }
}}

The interesting thing is that if I remove the "followupEventInput" field, the suggestion chips are displayed.

Can someone give me a hint on this behaviour ?

Upvotes: 2

Views: 1071

Answers (1)

Prisoner
Prisoner

Reputation: 50711

The JSON you're sending back doesn't do what you likely want it to do.

The followupEventInput means that the Intent is triggered immediately, rather than sending back the rest of the reply (including the suggestions). Instead, the reply from the followup event is sent back.

It sounds like you want to send back a reply and then, no matter what the user says or selects, their message is sent to a specific action. Keep in mind that Dialogflow Intents are triggered based on the user's actions and shaped based on the contexts that might be set.

In this case, it sounds like you may want to set an outputContext to influence which Intents will be examined when collecting the user's response. You can then have an Intent that takes this as an input Context and matches the possible phrases. If you truly want to get whatever the user says in the reply, you can use a Fallback Intent with the input Context set appropriately.

While you can redirect to another Intent to send output, usually this is unnecessary. Remember that Intents best represent the user's input rather than your agent's output. Particularly if you're using your webhook to generate and send a reply - just send the reply.

Upvotes: 1

Related Questions