manniru
7/15/2017 - 10:38 PM

Actions on Google Conversation API v2 - Sample Responses

Actions on Google Conversation API v2 - Sample Responses

{
  "items": [
    {
      "simpleResponse": {
          "textToSpeech":"This is the first simple response for a basic card"
      }
    },
    {
      "basicCard": {
        "title":"Title: this is a title",
        "formattedText":"This is a basic card.  Text in a\n      basic card can include \"quotes\" and most other unicode characters\n      including emoji 📱.  Basic cards also support some markdown\n      formatting like *emphasis* or _italics_, **strong** or __bold__,\n      and ***bold itallic*** or ___strong emphasis___ as well as other things\n      like line  \nbreaks",
        "subtitle":
        "This is a subtitle",
        "image": {
          "url":"https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
          "accessibilityText":"Image alternate text"
        },
        "buttons": [
          { 
            "title":"This is a button",
            "openUrlAction":{ 
              "url":"https://assistant.google.com/"
            }
          }
        ]
      }
    },
    {
      "simpleResponse": {
        "textToSpeech":"This is the 2nd simple response ",
        "displayText":"This is the 2nd simple response"
      }
    }
  ],
  "suggestions": 
  [
    {"title":"Basic Card"},
    {"title":"List"},
    {"title":"Carousel"},
    {"title":"Suggestions"}
  ]
}
{
  "speech":"This is a simple response for a carousel",
  "data": {
    "google":
    {
      "expectUserResponse":true,
      "richResponse":
      {
        "items":
        [
          {
            "simpleResponse":
            {
              "textToSpeech":"This is a simple response for a carousel"
            }
          }
        ],
        "suggestions":
        [
          {
            "title":"Basic Card"
          },
          {
            "title":"List"
          },
          {
            "title":"Carousel"
          },
          {
            "title":"Suggestions"
          }
        ]
      },
      "systemIntent":
      {
        "intent":"actions.intent.OPTION",
        "data":
        {
          "@type":"type.googleapis.com/google.actions.v2.OptionValueSpec",
          "carouselSelect":
          {
            "items":
            [
              {
                "optionInfo":
                {
                  "key":"title",
                  "synonyms":
                  [
                    "synonym of title 1",
                    "synonym of title 2",
                    "synonym of title 3"
                  ]
                },
                "title":"Title of First List Item",
                "description":"This is a description of a carousel item",
                "image":
                {
                  "url":"https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
                  "accessibilityText":"Image alternate text"
                }
              },
              {
                "optionInfo":
                {
                  "key":"googleHome",
                  "synonyms":
                  [
                    "Google Home Assistant",
                    "Assistant on the Google Home"
                  ]
                },
                "title":"Google Home",
                "description":"Google Home is a voice-activated speaker powered by the Google Assistant.",
                "image":
                {
                  "url":"https://lh3.googleusercontent.com/Nu3a6F80WfixUqf_ec_vgXy_c0-0r4VLJRXjVFF_X_CIilEu8B9fT35qyTEj_PEsKw",
                  "accessibilityText":"Google Home"
                }
              },
              {
                "optionInfo":
                {
                  "key":"googlePixel",
                  "synonyms":
                  [
                    "Google Pixel XL",
                    "Pixel",
                    "Pixel XL"
                  ]
                },
                "title":"Google Pixel",
                "description":"Pixel. Phone by Google.",
                "image":
                {
                  "url":"https://storage.googleapis.com/madebygoog/v1/Pixel/Pixel_ColorPicker/Pixel_Device_Angled_Black-720w.png",
                  "accessibilityText":"Google Pixel"
                }
              },
              {
                "optionInfo":
                {
                  "key":"googleAllo",
                  "synonyms":
                  [
                    "Allo"
                  ]
                },
                "title":"Google Allo",
                "description":"Introducing Google Allo, a smart messaging app that helps you say more and do more.",
                "image":
                {
                  "url":"https://allo.google.com/images/allo-logo.png",
                  "accessibilityText":"Google Allo Logo"
                }
              }
            ]
          }
        }
      }
    }
  }
}
{
  "speech":"PLACEHOLDER_FOR_TXN_DECISION",
  "contextOut":[
    {
      "name":"_actions_on_google_",
      "lifespan":100,
      "parameters":{

      }
    }
  ],
  "data":{
    "google":{
      "expectUserResponse":true,
      "isSsml":false,
      "noInputPrompts":[

      ],
      "systemIntent":{
        "intent":"actions.intent.TRANSACTION_DECISION",
        "data":{
          "@type":"type.googleapis.com/google.actions.v2.TransactionDecisionValueSpec",
          "proposedOrder":{
            "id":"<UNIQUE_ORDER_ID>",
            "cart":{
              "merchant":{
                "id":"book_store_1",
                "name":"Book Store"
              },
              "notes":"The Memoir collection",
              "lineItems":[
                {
                  "id":"memoirs_1",
                  "name":"My Memoirs",
                  "price":{
                    "type":"ACTUAL",
                    "amount":{
                      "currencyCode":"USD",
                      "units":3,
                      "nanos":990000000
                    }
                  },
                  "quantity":1
                },
                {
                  "id":"memoirs_2",
                  "name":"Memoirs of a person",
                  "price":{
                    "type":"ACTUAL",
                    "amount":{
                      "currencyCode":"USD",
                      "units":5,
                      "nanos":990000000
                    }
                  },
                  "quantity":1
                },
                {
                  "id":"memoirs_3",
                  "name":"Their memoirs",
                  "price":{
                    "type":"ACTUAL",
                    "amount":{
                      "currencyCode":"USD",
                      "units":15,
                      "nanos":750000000
                    }
                  },
                  "quantity":1
                },
                {
                  "id":"memoirs_4",
                  "name":"Our memoirs",
                  "price":{
                    "type":"ACTUAL",
                    "amount":{
                      "currencyCode":"USD",
                      "units":6,
                      "nanos":490000000
                    }
                  },
                  "quantity":1
                }
              ],
              "otherItems":[

              ]
            },
            "otherItems":[
              {
                "id":"subtotal",
					"name":"Subtotal",
                "price":{
                  "type":"ESTIMATE",
                  "amount":{
                    "currencyCode":"USD",
                    "units":32,
                    "nanos":220000000
                  }
                },
                "type":"SUBTOTAL",
                "quantity":1
              },
              {
                "id":"tax",
                "name":"Tax",
                "price":{
                  "type":"ESTIMATE",
                  "amount":{
                    "currencyCode":"USD",
                    "units":2,
                    "nanos":780000000
                  }
                },
                "type":"TAX",
                "quantity":1
              }
            ],
            "totalPrice":{
              "type":"ESTIMATE",
              "amount":{
                "currencyCode":"USD",
                "units":35,
                "nanos":0
              }
            }
          }
        }
      }
    }
  }
}
{
  "speech":"Transaction completed! You're all set!",
  "contextOut":[

  ],
  "data":{
    "google":{
      "expectUserResponse":false,
      "richResponse":{
        "items":[
          {
            "simpleResponse":{
              "textToSpeech":"Transaction completed! You're all set!"
            }
          },
          {
            "structuredResponse":{
              "orderUpdate":{
                "googleOrderId":"1897312792",
                "orderState":{
                  "state":"CREATED",
                  "label":"Order created"
                },
                "lineItemUpdates":{

                },
                "orderManagementActions":[

                ]
              }
            }
          }
        ],
        "suggestions":[

        ]
      }
    }
  }
}
{
	"speech":"This is a simple response for a list",
	"contextOut":[
		{
			"name":"_actions_on_google_",
			"lifespan":100,
			"parameters":{}
		}
	],
	"data":{
		"google": {
		"expectUserResponse":true,
		"richResponse": {
			"items": [
				{
					"simpleResponse": {
						"textToSpeech":"This is a simple response for a list"
					}
				}
			],
			"suggestions": [
				{
					"title":"List"
				},
				{
					"title":"Carousel"
				},
				{
					"title":"Suggestions"
				}
			]
		},
		"systemIntent": {
			"intent":"actions.intent.OPTION",
			"data": {
				"@type" : "type.googleapis.com/google.actions.v2.OptionValueSpec",
				"listSelect": {
					"title":"List Title","items": [
						{
							"optionInfo": {
								"key":"title",
								"synonyms": [
								"synonym of title 1",
								"synonym of title 2",
								"synonym of title 3"
							]
						},
						"title":"Title of First ListItem",
						"description":"This is a description of a list item",
						"image": {
							"url":"https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png",
							"accessibilityText":"Image alternate text"}
						},
						{
							"optionInfo": {
								"key":"googleHome",
								"synonyms": [
									"Google Home Assistant","Assistant on the Google Home"
								]
							},
							"title":"Google Home",
							"description":"Google Home is a voice-activated speaker powered by the Google Assistant.",
							"image": {
								"url":"https://lh3.googleusercontent.com/Nu3a6F80WfixUqf_ec_vgXy_c0-0r4VLJRXjVFF_X_CIilEu8B9fT35qyTEj_PEsKw",
								"accessibilityText":"Google Home"
							}
						},
						{
							"optionInfo": {
								"key":"googlePixel",
								"synonyms": [
									"Google Pixel XL",
									"Pixel","Pixel XL"
								]
							},
							"title":"Google Pixel",
							"description":"Pixel. Phone by Google.",
							"image": {
								"url":"https://storage.googleapis.com/madebygoog/v1/Pixel/Pixel_ColorPicker/Pixel_Device_Angled_Black-720w.png",
								"accessibilityText":"Google Pixel"
							}
						},
						{
							"optionInfo": {
								"key":"googleAllo",
								"synonyms": [
									"Allo"
								]
							},
							"title":"Google Allo",
							"description":"Introducing Google Allo, a smart messaging app that helps you say more and do more.",
							"image": {
								"url":"https://allo.google.com/images/allo-logo.png",
								"accessibilityText":"Google Allo Logo"
							}
						}
					]
				}
			}
		}
	}
}