0
votes

I want to add suggestions for the user in my Google Assistant Bot. I am using API.ai for bot development and using fulfilment, I am communicating with my backend for data.
I am not able to send suggestions using suggestions chips to my bot.

I have followed as answered here Webhook response with "suggestion chips" as well as the document at https://developers.google.com/actions/assistant/responses#json. But still, I only see simple text response at my bot on device as well as on simulator.

I also checked at https://discuss.api.ai/t/google-assistant-rich-message-responses/5134/19. But didn't find any way to switch to V1 or V2. The sample format also didn't work!

Here are my 2 JSONs:
at API.ai

"fulfillment": {
  "speech": "want to proceed further?",
  "messages": [
    {
      "type": 0,
      "speech": "want to proceed further?"
    }
  ],
  "data": {
    "google": {
      "conversationToken": "[\"AS-PER-JSON-FROM-SIMULATOR\"]",
      "expectedInputs": [
        {
          "inputPrompt": {
            "richInitialPrompt": {
              "items": [
                {
                  "simpleResponse": {
                    "textToSpeech": "want to proceed further?",
                    "displayText": "want to proceed further?"
                  }
                }
              ],
              "suggestions": [
                {
                  "title": "Yes"
                },
                {
                  "title": "No"
                }
              ]
            }
          }
        }
      ]
    }
  }
},


at action on Google

"expectUserResponse": true,
    "expectedInputs": [
        {
            "inputPrompt": {
                "richInitialPrompt": {
                    "items": [
                        {
                            "simpleResponse": {
                                "textToSpeech": "want to proceed?"
                            }
                        }
                    ]
                },
                "noMatchPrompts": [],
                "noInputPrompts": []
            },
            "possibleIntents": [
                {
                    "intent": "assistant.intent.action.TEXT"
                }
            ],
            "speechBiasingHints": [
                "$subject",
                "$answer"
            ]
        }
    ]


python server

return = '{"speech":"want to proceed?", "data": {"google":{"expectedInputs":[{"inputPrompt":{"richInitialPrompt":{"items":[{"simpleResponse":{"textToSpeech":"want to proceed?","displayText":"want to proceed?"}}],"suggestions":[{"title":"Yes"},{"title":"No"}]}}}]}}}'
3

3 Answers

0
votes

Your JSON is wrong, remove the quotation mark before the data object:

"data" : { ... }

instead of

"data" : "{ ... }"

So basically, you're sending a string containing the object instead of a JSON object.

0
votes

Add 'expectUserResponse' into data -> google

'expectUserResponse': true,
'isSsml': false,