actions on google - Implementing Conversation Webhook as Azure Function App


Question: 

I have an azure function app that I am using as a webhook for my google assistant action. I've tried to follow the documentation for the proper response but I continually get the following error in the simulator when testing my webhook. Is there anything in my response message that looks wrong?

Failed to parse SDKResponse from http_response:

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 451
Content-Type: application/json; charset=utf-8
Content-Encoding: gzip
Expires: -1
Vary: Accept-Encoding
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Sun, 28 May 2017 19:00:13 GMT

{"conversationToken":"cee44ab4-97dd-4e18-99c7-2b8613eb7584","expectUserResponse":true,"expectedInputs":[{"inputPrompt":{"richInitialPrompt":{"items":[{"simpleResponse":{"textToSpeech":"So, you want to become a great swordsman? First, you must learn the proper technique of insult sword fighting. The current difficulty level is Easy. Say 'Tutorial' for some quick instructions. Say 'Start Game' to start the game. Say 'Options' for more options. "}}]}}}]}

Here is the json formatted for readability:

{
  "conversationToken": "cee44ab4-97dd-4e18-99c7-2b8613eb7584",
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "So, you want to become a great swordsman? ... "
              }
            }
          ]
        }
      }
    }
  ]
}

With my latest test, I tried sending the exact example response given on the Fulfillment page instructions and it still fails: https://developers.google.com/actions/components/fulfillment

 {
  "conversationToken": "{\"state\":null,\"data\":{}}",
  "expectUserResponse": true,
  "expectedInputs": [
    {
      "inputPrompt": {
        "richInitialPrompt": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "Howdy! I can tell you fun facts about almost any number, like 42. What do you have in mind?",
                "displayText": "Howdy! I can tell you fun facts about almost any number. What do you have in mind?"
              }
            }
          ],
          "suggestions": []
        }
      },
      "possibleIntents": [ { "intent": "actions.intent.TEXT" } ]
    }
  ]
}



1 Answer: 

It looks like you have a slightly invalid entry for your items. The Item object is defined as a union field, indicating that one of the three attributes (simpleResponse, basicCard, or structuredResponse) and its respective value must be set.

So the textToSpeech attribute should not be under the richInitialPrompt.item directly, instead you should have a simpleResponse attribute and, under this, a textToSpeech attribute (or one of the other attributes that make sense for a SimpleResponse object. You must have at least one SimpleResponse (and it must be first), and you may have no more than two.

But the text attached to your second response doesn't make sense in this context. Both responses will be said/shown - not one in case there is a delay in user action.

The v1 protocol had a way to support details of the re-prompt, but I don't see the same thing in v2.

So the JSON should probably look more like:

{
    "conversationToken": "fa3bfc17-de0a-4df8-900d-44dbb17b86c6",
    "expectUserResponse": true,
    "expectedInputs": [
        {
            "inputPrompt": {
                "richInitialPrompt": {
                    "items": [
                        "simpleResponse": {
                            "textToSpeech": "Text for my response"  
                        } 
                    ]
                }
            }
        }
    ]
}
 

More Articles


facebook - Unable to publish an action

I'm attempting to create a Facebook Open Graph App similar to the Washington Post Social Reader, which will announce in a person's news feed when they read an article on my website, www.zeitlife.co.uk.I have followed the Open Graph tutorial closely, identifying an action and an object, and creating

javascript - Sending HTTP Requests Through Azure

I am trying to interact with Urbanairship via their broadcast API to send notifications to android devices on an INSERT into a Azure table.My JavaScript INSERT code on Azure is as follows: function insert(item, user, request) { request.execute({ success: function() {

Azure DNS hostname or IP reference in web.config?

When connecting to Azure services in my applications, is it preferable to use the DNS hostname or the IP?For example, I have a SQL Server hosted in a virtual machine. Should I configure my web.config with 168.63.xxx.xxx or with mysqlserver001.cloudapp.net?Thanks


asp.net mvc - Payment Gateway returns Error HTTP Status - 400

I’m trying to redirect my MVC project to pay migs payment Gateway.Here’s the URL generated by my code. (For security reasons i have changed the value with the word “value” )https://migs.mastercard.com.au/vpcpay?vpc_AccessCode=value&vpc_Amount=100&vpc_Command=pay&vpc_Locale=en&vpc_Me

WebSocket closing immediately using Watson Speech-to-text JS SDK

Trying to use this code from a provided demo, using the latest watson-speech.js from https://github.com/watson-developer-cloud/speech-javascript-sdk:document.querySelector('#button').onclick = function () { fetch('myserverurl/api/token') .then(function(response) { return response.text(); }).

java - Paypal expressCheckout integration (DoExpressCheckout) error

I have a ExpressCheckout integration setup in java google app engine and it working up to GetExpresschekout .but in finall call(DoExpressCheckout) I am unable to Authorize payment .it returnsan errorRESULT=1000&PNREF=E24P1FBB8FA4&RESPMSG=Generic processor error: 13116-The transaction is in p


c# - Set time limit for items in container in CosmosDB using Microsoft.Bot.Builder.Azure (bot framework v4)

I want to set the time to live for the items in a container in cosmosDB, but I am not sure how to do so using the config of cosmosdb storage in bot framework v4. I would appreciate some help on this matter.I have read about setting time to live using DocumentClient() as documented here. However I se

c# - How to connect with bot from another app?

I have created a core bot with basic workflow to collect information from end-users, which is hosted on http://localhost:3978, and exposes an endpoint to send message http://localhost:3978/api/messages (POST) I can start and chat with bot via Bot Framework Emulator, but I dont know how to interact w

c# - Microsoft Bot Framework works locally, but fails remotely

I have this bot that is fairly complicated, but it works locally. But as soon as I publish it, it fails with the error: Sorry, my bot code is having an issue.I have tried using Application Insights, but it isn't showing the error details.The error always happens at the same point:/// <summary>

java - How to integrate KNET payment gateway with php

How can I integrate the KNET payment gateway with PHP? The gateway id only works with Java and .NET.