1

I currently have an app running on actions on google using API.AI. I have modified all the response members to be camelCase as suggested and got it working. Now I am trying to return a basic card, but I can not figure out how to properly return it.

Does anyone have the most basic JSON response, returning a basic card to the Google assistant?

currently, the most basic v2 API response I can have is the following:

{
    speech: "",
    displayText: "",
    data: {
        google: {
            expectUserResponse: true,
            isSsml: true,
            permissionsRequest: null
        }
    },
    contextOut: [ ],
    source: "webhook"
}
NiteLordz
  • 597
  • 2
  • 18
  • What error message are you getting when you try to return a basic card? Can you show the JSON you were using to return the card? – Prisoner May 26 '17 at 04:16

3 Answers3

3

I have some Gists showing the JSON responses here.

Right now, it includes Lists, Basic Card and Carousel, but I will add Transactions hopefully soon. Hope it might help somehow

Nico Strebel
  • 137
  • 1
  • 6
  • Hi, Any idea on how to parse responses from JSON file instead of writing actual `nodejs` code? – Hamid Bazargani May 29 '17 at 05:55
  • Hi, I'm no C# developer (doing the stuff in Java using Jackson), so I can't really tell you what the best practice for C# is, but maybe checkout https://stackoverflow.com/questions/6620165/how-can-i-parse-json-with-c – Nico Strebel May 29 '17 at 08:22
  • Thanks. I am aware of parsing JSON. I thought there should be a native (built-in) method for creating RichResponses from JSON. – Hamid Bazargani May 29 '17 at 14:47
2

This is what I use for Voice Tic Tac Toe

"google": {
      "expect_user_response": true,
      "rich_response": {
        "items": [
          {
           "simple_response": {
              "text_to_speech": "Your move was top. I moved left"
            }
          },
          {
            "basic_card": {
              "image": {
                "url": "https://server/010200000.png",
                "accessibility_text": "Tic Tac Toe game board"
              }
            }
          }
        ]
      }
    }

I ran the facts about google action and looked at the fulfillment JSON output to learn how to do this.

https://github.com/actions-on-google/apiai-facts-about-google-nodejs

SysCoder
  • 715
  • 7
  • 18
1

Note that all responses must include at least one, and no more than two, simple_response items.

Prisoner
  • 49,922
  • 7
  • 53
  • 105