NiteLordz
NiteLordz

Reputation: 607

Actions on Google API v2 using c# webhook

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"
}

Upvotes: 1

Views: 2087

Answers (3)

SysCoder
SysCoder

Reputation: 764

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

Upvotes: 2

Prisoner
Prisoner

Reputation: 50701

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

Upvotes: 1

Nico Strebel
Nico Strebel

Reputation: 137

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

Upvotes: 3

Related Questions