I am using python to create webhook for Assistat app. I am able to ask user for location permission, but as soon as user gives consent, I receive following error

UnparseableJsonResponse
API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: ": Cannot find field.".

I have checked my webhook server and no request comes to it. This looks like some issue at API.ai side.
Below is the Debug response from Actions console when using Python client

{
  "assistantToAgentDebug": {
    "curlCommand": "curl -v '<URL>'{\"user\":{\"userId\":\"<USED_ID>\",\"locale\":\"en-US\"},\"conversation\":{\"conversationId\":\"1504592665563\",\"type\":\"ACTIVE\",\"conversationToken\":\"[\\\"defaultwelcomeintent-followup\\\"]\"},\"inputs\":[{\"intent\":\"actions.intent.PERMISSION\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"yes\"}],\"arguments\":[{\"name\":\"PERMISSION\",\"textValue\":\"true\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"},{\"name\":\"actions.capability.SCREEN_OUTPUT\"}]},\"device\":{\"location\":{\"coordinates\":{\"latitude\":37.4219806,\"longitude\":-122.0841979}}},\"isInSandbox\":true}'",
    "assistantToAgentJson": {
      "user": {
        "userId": "<USED_ID>",
        "locale": "en-US"
      },
      "conversation": {
        "conversationId": "1504592665563",
        "type": "ACTIVE",
        "conversationToken": "[\"defaultwelcomeintent-followup\"]"
      },
      "inputs": [
        {
          "intent": "actions.intent.PERMISSION",
          "rawInputs": [
            {
              "inputType": "VOICE",
              "query": "yes"
            }
          ],
          "arguments": [
            {
              "name": "PERMISSION",
              "textValue": "true"
            }
          ]
        }
      ],
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          },
          {
            "name": "actions.capability.SCREEN_OUTPUT"
          }
        ]
      },
      "device": {
        "location": {
          "coordinates": {
            "latitude": 37.4219806,
            "longitude": -122.0841979
          }
        }
      },
      "isInSandbox": true
    }
  },
  "agentToAssistantDebug": {
    "agentToAssistantJson": {
      "message": "Unexpected apiai response format: Empty speech response",
      "apiResponse": {
        "id": "<ID>",
        "timestamp": "2017-09-05T06:24:41.711Z",
        "lang": "en",
        "result": {},
        "status": {
          "code": 200,
          "errorType": "success"
        },
        "sessionId": "1504592665563"
      }
    }
  },
  "sharedDebugInfo": [
    {
      "name": "GOOGLE_SYSTEM_ACTION",
      "debugInfo": "Your query was handled by Actions on Google."
    },
    {
      "name": "GOOGLE_SYSTEM_ACTION",
      "debugInfo": "Your query was handled by Actions on Google."
    },
    {
      "name": "ResponseValidation",
      "subDebugEntry": [
        {
          "name": "UnparseableJsonResponse",
          "debugInfo": "API Version 2: Failed to parse JSON response string with 'INVALID_ARGUMENT' error: \": Cannot find field.\"."
        }
      ]
    }
  ]
}

Using Python library Flask-Assistant

How can I resolve this issue?

UPDATE Node JS client works... what is the issue with Python client?

Action Console Debug response

{
  "assistantToAgentDebug": {
    "curlCommand": "curl -v '<URL>'{\"user\":{\"userId\":\"<USER_ID>\",\"locale\":\"en-US\"},\"conversation\":{\"conversationId\":\"<ID>\",\"type\":\"ACTIVE\",\"conversationToken\":\"[\\\"_actions_on_google_\\\",\\\"defaultwelcomeintent-followup\\\"]\"},\"inputs\":[{\"intent\":\"actions.intent.PERMISSION\",\"rawInputs\":[{\"inputType\":\"VOICE\",\"query\":\"yes\"}],\"arguments\":[{\"name\":\"PERMISSION\",\"textValue\":\"true\"}]}],\"surface\":{\"capabilities\":[{\"name\":\"actions.capability.AUDIO_OUTPUT\"}]},\"device\":{\"location\":{\"coordinates\":{\"latitude\":37.4219806,\"longitude\":-122.0841979},\"formattedAddress\":\"Googleplex, Mountain View, CA 94043, United States\",\"zipCode\":\"94043\",\"city\":\"Mountain View\"}},\"isInSandbox\":true}'",
    "assistantToAgentJson": {
      "user": {
        "userId": "<USER_ID>",
        "locale": "en-US"
      },
      "conversation": {
        "conversationId": "<ID>",
        "type": "ACTIVE",
        "conversationToken": "[\"_actions_on_google_\",\"defaultwelcomeintent-followup\"]"
      },
      "inputs": [
        {
          "intent": "actions.intent.PERMISSION",
          "rawInputs": [
            {
              "inputType": "VOICE",
              "query": "yes"
            }
          ],
          "arguments": [
            {
              "name": "PERMISSION",
              "textValue": "true"
            }
          ]
        }
      ],
      "surface": {
        "capabilities": [
          {
            "name": "actions.capability.AUDIO_OUTPUT"
          }
        ]
      },
      "device": {
        "location": {
          "coordinates": {
            "latitude": 37.4219806,
            "longitude": -122.0841979
          },
          "formattedAddress": "Googleplex, Mountain View, CA 94043, United States",
          "zipCode": "94043",
          "city": "Mountain View"
        }
      },
      "isInSandbox": true
    }
  },
  "agentToAssistantDebug": {
    "agentToAssistantJson": {
      "conversationToken": "[\"_actions_on_google_\",\"defaultwelcomeintent-followup\"]",
      "expectUserResponse": true,
      "expectedInputs": [
        {
          "inputPrompt": {
            "richInitialPrompt": {
              "items": [
                {
                  "simpleResponse": {
                    "textToSpeech": "Given permission"
                  }
                }
              ]
            }
          },
          "possibleIntents": [
            {
              "intent": "assistant.intent.action.TEXT"
            }
          ]
        }
      ],
      "responseMetadata": {
        "status": {
          "code": 14
        },
        "queryMatchInfo": {
          "queryMatched": true,
          "intent": "Default Welcome Intent - fallback"
        }
      }
    }
  }
}

Request from Actions server to my Node JS webhook server

{ originalRequest: 
   { source: 'google',
     version: '2',
     data: 
      { isInSandbox: true,
        surface: [Object],
        inputs: [Array],
        user: [Object],
        device: [Object],
        conversation: [Object] } },
  id: '<ID>',
  timestamp: '2017-09-06T05:43:21.342Z',
  lang: 'en',
  result: 
   { source: 'agent',
     resolvedQuery: 'actions_intent_PERMISSION',
     speech: '',
     action: 'DefaultWelcomeIntent.DefaultWelcomeIntent-fallback',
     actionIncomplete: false,
     parameters: {},
     contexts: [ [Object], [Object], [Object], [Object], [Object] ],
     metadata: 
      { intentId: '<ID>',
        webhookUsed: 'true',
        webhookForSlotFillingUsed: 'false',
        nluResponseTime: 2,
        intentName: 'Default Welcome Intent - fallback' },
     fulfillment: { speech: 'Given permission', messages: [Array] },
     score: 1 },
  status: { code: 200, errorType: 'success' },
  sessionId: '<SID>' 
  }

API.ai Intent settings
Fallback Intent for Welcome Intent Fallback Intent details

1

There are 1 best solutions below

3
On

The most likely reason you're not getting any hits on your webhook is that you don't have an intent registered to get the reply.

You can do this by creating an Intent with the Event set to actions_intent_PERMISSION.

See also the following answers on SO: