0

I am calling a third-party API to fetch data. In a situation when the API returns error I can't continue my user flow on the Google Assitant

Error I see in Google Cloud Console is as follows:

"MalformedResponse: ErrorId: c316c2bc-be3b-4c8f-8d9b-2b45434a0325. Failed to parse Dialogflow response into AppResponse because of invalid platform response. : Could not find a RichResponse or SystemIntent in the platform response for agentId: 0bc4ed97-dfec-4936-b90d-28f047eb7b34 and intentId: 3dcf4b35-00e0-4c75-815c-d1a76494e08e"

Here is my intent code.

app.intent('askPin', (conv, params) => {

  conv.user.storage.pin_prompt_count = conv.user.storage.pin_prompt_count + 1;

  var member = services.getMemberDetails(memberId, params.account_pin);

  return member.then(function (result) {

    if (result) {
      conv.user.storage.pin_prompt_count = 0; //reset prompt count once verified
      conv.user.storage.account_pin = params.account_pin;
      conv.contexts.delete('account-pin-context');//delete context to pin intent will not be invoked again.

      return handleService(conv);
    }
  }).catch(function (err) {
    console.log("Paresh Varde 1");
    conv.ask("Invalid Pin. Please try again");
  })
});

Here is the Response I see being generated from the log

{
  "status": 200,
  "headers": {
    "content-type": "application/json;charset=utf-8"
  },
  "body": {
    "payload": {
      "google": {
        "expectUserResponse": true,
        "richResponse": {
          "items": [
            {
              "simpleResponse": {
                "textToSpeech": "Invalid Pin. Please try again"
              }
            }
          ]
        }
      }
    }
  }
}

I don't see any error in the firebase console (where the function is deployed). However I see an error in Google Cloud console as follows:

MalformedResponse: ErrorId: c316c2bc-be3b-4c8f-8d9b-2b45434a0325. Failed to parse Dialogflow response into AppResponse because of invalid platform response. : Could not find a RichResponse or SystemIntent in the platform response for agentId: 0bc4ed97-dfec-4936-b90d-28f047eb7b34 and intentId: 3dcf4b35-00e0-4c75-815c-d1a76494e08e

I see a message on my simulator as "App isn't responding right now. Try again soon." and it leaves the conversation.

Please advise.

Paresh Varde
  • 1,084
  • 3
  • 16
  • 39

1 Answers1

0

The problem was that my webhook call was taking more than 5 seconds to complete. Webhook must complete it's execution in less than 5 seconds to work properly and make the conversation smooth.

For now, I need to work out my REST interface so that API I am calling respond quickly to achieve this timeout limit.

Paresh Varde
  • 1,084
  • 3
  • 16
  • 39