John Hoerr
John Hoerr

Reputation: 8025

Validation errors when linking authentication with Dialogflow / Google Action

We are trying to get DialogFlow / Google Actions to link to an external OAuth account within a conversation. Upon following the examples we are consistently getting request validation errors that we don't know how to resolve. As far as I can tell we are doing everything by the book.

Our questions:

  1. Why won't DialogFlow kick off the authentication process?
  2. The documented webhook response for requesting the sign-in helper not have the same schema as a standard DialogFlow webhook response. Is the sign-in helper response supposed to be used for something else?...

Things we have tried:

Our intent code is as follows:

const { DialogflowApp } = require('actions-on-google'); 
const { ActionsSdkApp } = require('actions-on-google');

function processV2Request (request, response) {
  ...
  let app = new DialogflowApp({request: request, response: response});
  let sdkapp = new ActionsSdkApp({request: request, response: response});
  const actionHandlers = {
    'pto': () => {
        app.askForSignIn();
    }
    ...
  }
  ...
}

When we execute this intent, we receive the following debug error message about a speech field.

"agentToAssistantJson": {
  "message": "Unexpected apiai response format: Empty speech response",
  "apiResponse": {
    "id": "751e4716-a94d-4d11-908d-3ee193092d9c",
    "timestamp": "2017-12-05T19:52:01.962Z",
    "lang": "en-us",
    "result": {},
    "status": {
      "code": 206,
      "errorType": "partial_content",
      "errorDetails": "Webhook call failed. Error: Failed to parse webhook JSON response: Cannot find field: speech in message google.cloud.dialogflow.v2beta1.WebhookResponse."
    }
  }
}

If instead we try using the ActionsSdkApp, sdkapp.askForSignIn(), we get an error message about a conversation_token field.

"agentToAssistantJson": {
  "message": "Unexpected apiai response format: Empty speech response",
  "apiResponse": {
    "id": "7de79093-6db8-44ee-8717-16b0f317174c",
    "timestamp": "2017-12-05T19:54:29.709Z",
    "lang": "en-us",
    "result": {},
    "status": {
      "code": 206,
      "errorType": "partial_content",
      "errorDetails": "Webhook call failed. Error: Failed to parse webhook JSON response: Cannot find field: conversation_token in message google.cloud.dialogflow.v2beta1.WebhookResponse."
    },
  }
}

And if it's helpful, here's our package.json. It's the DialogFlow default as of recently, with a bumped up version of actions-on-google.

{
  "name": "dialogflowFirebaseFulfillment",
  "description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
  "version": "0.0.1",
  "private": true,
  "license": "Apache Version 2.0",
  "author": "Google Inc.",
  "engines": {
    "node": "~6.0"
  },
  "scripts": {
    "start": "firebase serve --only functions:dialogflowFirebaseFulfillment",
    "deploy": "firebase deploy --only functions:dialogflowFirebaseFulfillment"
  },
  "dependencies": {
    "actions-on-google": "^1.6.x",
    "firebase-admin": "^4.2.1",
    "firebase-functions": "^0.5.7",
    "apiai": "^4.0.3"
  }
}

Upvotes: 0

Views: 539

Answers (1)

John Hoerr
John Hoerr

Reputation: 8025

We determined that in addition to having Transactions enabled for the app, you must also change the Development Sandbox toggled to Active:

enter image description here

Upvotes: 1

Related Questions