问题
I'm trying to start working on Google Actions v2 API together with Dialgoflow v2 API.
I have the following example (so far in Dialogflow -> Fulfillment Webhook) taken from official Google Actions Migration Guide , but unfortunately I keep getting MalformedResponse 'final_response' must be set error.
'use strict';
const functions = require('firebase-functions');
const { dialogflow } = require('actions-on-google');
const app = dialogflow();
app.intent('Default Welcome Intent', conv => {
conv.ask('How are you?');
});
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
And response is:
{
"responseMetadata": {
"status": {
"code": 13,
"message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
"details": [
{
"@type": "type.googleapis.com/google.protobuf.Value",
"value": "{\"id\":\"542fe4a8-6017-429f-81c3-61ba568e3659\",\"timestamp\":\"2018-04-19T20:16:25.606Z\",\"lang\":\"en-us\",\"result\":{},\"status\":{\"code\":200,\"errorType\":\"success\"},\"sessionId\":\"1524168985362\"}"
}
]
}
}
}
Please any idea why this can be happening?
回答1:
Change this line:
conv.ask('How are you?');
to this:
conv.close('How are you?');
the close
method configures the required final_response
field for you
来源:https://stackoverflow.com/questions/49929656/dialogflow-v2-api-actions-v2-api-malformedresponse-final-response-must-be-s