actions on google not working but they does in dialogflow












1














I have a problem testing my Skill on actions on google and in my mobile. It works fine with dialogflow but when I arrive to the Intent defined by the function questions_ready on the assistent of google or in the actions google web page to test it, I have the error "'final_response' must be set.". But it works on Dialogflow, so I dont know where it is the error. I leave here my code hoping some of you can help me! Thank you!



'use strict';

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const {WebhookClient} = require('dialogflow-fulfillment');

process.env.DEBUG = 'dialogflow:*'; // enables lib debugging statements
admin.initializeApp(functions.config().firebase);
const db = admin.firestore();

// Variables
var procedure;
var procedure;
var finish = "Ok, thank you. We have finished the questions";
var status_questions = [
{question: 'Ok, here is your first question. Please, could you tell me how do you feel on a scale from 1 to 10 ? Where 1 is very bad and 10 is very good'},
{question: 'Your workload is very high, high, normal, low or very low?'},
{question: 'Tell me what is your level of monotony on a scale from 1 to 10. Where 1 is very bad and 10 is very good'}];

var currentIndex = 0;
var currentQuestion = "";
var flag = 0;

var list_answers = ;
var list_index = ;
var list_timestamps = ;
var list_questions = ;
const dialogflowAgentRef = db.collection('dialogflow').doc();
//

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });

function welcome(agent) {
agent.add(`Welcome to my agent!`);
}

function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}

function manual(agent) {
const problem = agent.parameters.manual_problems;
if (problem == "DDoS problem"){
procedure = `Ok! Let's see how to solve your `+ problem + `. Specify here the procedure to resolve DDoS problem`;
}
else {
procedure = `Sorry, we don't have a manual to resolve that problem`;
}

agent.add((procedure));
}

function user_name(agent){
const user = agent.parameters.names;
return db.runTransaction(t => {
t.set(dialogflowAgentRef, {name: user});
return Promise.resolve('Write complete');
}).then(doc => {
agent.add(`Ok ${user}, are you ready?`);
}).catch(err => {
console.log(`Error writing to Firestore: ${err}`);
agent.add(`Failed to write "${user}" to the Firestore database.`);
});
}

//WHEN IT IS CALLING THIS FUNCTION I GOT THE ERROR

function questions_ready(agent) {
if(currentIndex === 0){
list_index=;
list_answers=;
list_questions=;
list_timestamps=;
list_index.push(currentIndex);
currentQuestion = status_questions[currentIndex++].question;
}
else if(currentIndex >=1 && currentIndex <= 10){
list_index.push(currentIndex);
currentQuestion = status_questions[currentIndex++].question;
flag = 1;
const answParam = agent.parameters.answers;
const ans = answParam;
list_answers.push(ans);

}
else {
currentIndex = 0;
currentQuestion = finish;
flag=0;
const answParam = agent.parameters.answers;
const ans = answParam;
list_answers.push(ans);

agent.add(currentQuestion);

return db.runTransaction(t => {
t.update(dialogflowAgentRef, {time: list_timestamps});
t.update(dialogflowAgentRef, {index: list_index});
t.update(dialogflowAgentRef, {question: list_questions});
t.update(dialogflowAgentRef, {answer: list_answers});
return Promise.resolve('Write complete');
});
}

const ques = currentQuestion;
list_questions.push(ques);

var timestamp = Date.now();
list_timestamps.push(timestamp);

let ctx = {'name': 'projects/prueba-firebase-v1/agent/sessions/545ec712-8f69-6999-a50b-4127d38bce82/contexts/questions_ready', 'lifespan': 14,
'parameters': {'timestamp': list_timestamps, 'list_index': list_index, 'list_questions': list_questions, 'list_answers': list_answers}}; //, 'list_index': list_index
agent.setContext(ctx);

agent.add(currentQuestion);

}

// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set(enter code here'Manual', manual);
intentMap.set('User_Name', user_name);
intentMap.set('Questions_Ready', questions_ready);

agent.handleRequest(intentMap);
});


The messages I obtain on Actions on Google are:



-On Simulator Display:
Prueba application isn't responding right now. Try again soon.



-Errors:
MalformedResponse
'final_response' must be set.



-Debug:



{
"response": "Prueba application isn't responding right now. Try again soon.",
"expectUserResponse": false,
"conversationToken": "GidzaW11bG...",
"audioResponse": "//NExAASWK...",
"debugInfo": {
"assistantToAgentDebug": {
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=6094e3dbd9e242679d0dcc603568b120&versionId=3' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6ImQxZTg2OWU3YmY0MGRkYzNkM2RlMDgwNDI1OThiYTgzNTA5NzBmMGEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdWQiOiJjeWJlcm9wcy1maXJlYmFzZS12MSIsIm5iZiI6MTU0MjcxMTY5MCwiaWF0IjoxNTQyNzExOTkwLCJleHAiOjE1NDI3MTIxMTAsImp0aSI6Ijc5NWYyZTViZGRjNzk5ZDAxMTY2MDZhZmEyZjJiMDRlYjU3MDk4ZGQifQ.XNBl3DcL2Zhw9bXHvPG52U21ATIb52snsQ5YF9T57cf9HrEeau6XTPfbtALdkiTEqhRfcihQTwLu7wAMdvmqTeeDaRW3F8C2xDCitT2bjPryeDJ3eyoJvI2cTy5Vhf1oN3WwsHdlM0D59JYyNtTH1NE-B60bnLCPQNe7Mv23aUnipdo-LsAytF_d9Bpz93SR_WZITqP6-FpqHSSuUHL3qi8idqGNQrtFF6RQ5-AGKkLkqE-V_Sa2iLmpqDsi4fP3RYW0bajuSFrn74JvrziQKQR4ZaFc4ITjPtJlhboCTgJusOqpFvOYV_-LF5FqgswaiMqUtaX8YBW_EKLLMLoS2A' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{"user":{"userId":"ABwppHFD2VxLtzrmnMXp4XsxyE13Xc7mxOhaf7cbxMUQg7OEe_I1qRVlcDck8Rl-bESCZBPi3cHvESEbHYfvecHr59o","locale":"en-US","lastSeen":"2018-11-20T10:51:47Z"},"conversation":{"conversationId":"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU","type":"ACTIVE","conversationToken":""},"inputs":[{"intent":"actions.intent.TEXT","rawInputs":[{"inputType":"KEYBOARD","query":"yes"}],"arguments":[{"name":"text","rawText":"yes","textValue":"yes"}]}],"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]}],"requestType":"SIMULATOR"}'",
"assistantToAgentJson": "{"user":{"userId":"ABwppHFD2VxLtzrmnMXp4XsxyE13Xc7mxOhaf7cbxMUQg7OEe_I1qRVlcDck8Rl-bESCZBPi3cHvESEbHYfvecHr59o","locale":"en-US","lastSeen":"2018-11-20T10:51:47Z"},"conversation":{"conversationId":"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU","type":"ACTIVE","conversationToken":""},"inputs":[{"intent":"actions.intent.TEXT","rawInputs":[{"inputType":"KEYBOARD","query":"yes"}],"arguments":[{"name":"text","rawText":"yes","textValue":"yes"}]}],"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]}],"requestType":"SIMULATOR"}"
},
"agentToAssistantDebug": {
"agentToAssistantJson": "{n "responseMetadata": {n "status": {n "code": 10,n "message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",n "details": [{n "@type": "type.googleapis.com/google.protobuf.Value",n "value": "{\"id\":\"95a80a4d-4a98-461f-b183-88a358d87ebc\",\"timestamp\":\"2018-11-20T11:06:30.765Z\",\"lang\":\"en-us\",\"result\":{},\"alternateResult\":{},\"status\":{\"code\":206,\"errorType\":\"partial_content\",\"errorDetails\":\"Webhook call failed. Error: Webhook response was empty.\"},\"sessionId\":\"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU\"}"n }]n }n }n}"
},
"sharedDebugInfoList": [
{
"name": "ResponseValidation",
"debugInfo": "",
"subDebugEntryList": [
{
"name": "MalformedResponse",
"debugInfo": "'final_response' must be set.",
"subDebugEntryList":
}
]
}
]
},
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "Prueba application isn't responding right now. Try again soon."
}
}
],
"suggestionsList": ,
"agentLogoUrl": ""
},
"clientError": 0,
"is3pResponse": 1,
"clientOperationList":
}


Here there are the images I have on my Questions_Ready Intent and the Dialog established by Dialogflow where all work perfectly. The problem is when I try to test the skill on Actions on Google



Questions_Ready Intent (I)



Questions_Ready Intent (II)



Answers Entities



Dialogflow dialog (I)



Dialogflow dialog (II)



Result obtained on Actions on Google










share|improve this question
























  • Can you include a screen shot of the entire "questoins_ready" Intent in the Dialogflow screen? You also indicated this worked in the Dialogflow simulator - can you also include the response it is giving?
    – Prisoner
    Nov 20 '18 at 12:16










  • I have updated my answer with the images!
    – Marta Romero
    Nov 20 '18 at 12:39










  • Please don't add answers unless they are actually answers - this isn't a forum. Stack Overflow lets you update your question by clicking on the edit link for exactly this reason. Please do so and then delete that answer.
    – Prisoner
    Nov 20 '18 at 12:43










  • Sorry, new publishing on Stack Overflow
    – Marta Romero
    Nov 20 '18 at 12:53










  • Not a problem - thats why I explained the normal procedure here.
    – Prisoner
    Nov 20 '18 at 15:35
















1














I have a problem testing my Skill on actions on google and in my mobile. It works fine with dialogflow but when I arrive to the Intent defined by the function questions_ready on the assistent of google or in the actions google web page to test it, I have the error "'final_response' must be set.". But it works on Dialogflow, so I dont know where it is the error. I leave here my code hoping some of you can help me! Thank you!



'use strict';

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const {WebhookClient} = require('dialogflow-fulfillment');

process.env.DEBUG = 'dialogflow:*'; // enables lib debugging statements
admin.initializeApp(functions.config().firebase);
const db = admin.firestore();

// Variables
var procedure;
var procedure;
var finish = "Ok, thank you. We have finished the questions";
var status_questions = [
{question: 'Ok, here is your first question. Please, could you tell me how do you feel on a scale from 1 to 10 ? Where 1 is very bad and 10 is very good'},
{question: 'Your workload is very high, high, normal, low or very low?'},
{question: 'Tell me what is your level of monotony on a scale from 1 to 10. Where 1 is very bad and 10 is very good'}];

var currentIndex = 0;
var currentQuestion = "";
var flag = 0;

var list_answers = ;
var list_index = ;
var list_timestamps = ;
var list_questions = ;
const dialogflowAgentRef = db.collection('dialogflow').doc();
//

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });

function welcome(agent) {
agent.add(`Welcome to my agent!`);
}

function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}

function manual(agent) {
const problem = agent.parameters.manual_problems;
if (problem == "DDoS problem"){
procedure = `Ok! Let's see how to solve your `+ problem + `. Specify here the procedure to resolve DDoS problem`;
}
else {
procedure = `Sorry, we don't have a manual to resolve that problem`;
}

agent.add((procedure));
}

function user_name(agent){
const user = agent.parameters.names;
return db.runTransaction(t => {
t.set(dialogflowAgentRef, {name: user});
return Promise.resolve('Write complete');
}).then(doc => {
agent.add(`Ok ${user}, are you ready?`);
}).catch(err => {
console.log(`Error writing to Firestore: ${err}`);
agent.add(`Failed to write "${user}" to the Firestore database.`);
});
}

//WHEN IT IS CALLING THIS FUNCTION I GOT THE ERROR

function questions_ready(agent) {
if(currentIndex === 0){
list_index=;
list_answers=;
list_questions=;
list_timestamps=;
list_index.push(currentIndex);
currentQuestion = status_questions[currentIndex++].question;
}
else if(currentIndex >=1 && currentIndex <= 10){
list_index.push(currentIndex);
currentQuestion = status_questions[currentIndex++].question;
flag = 1;
const answParam = agent.parameters.answers;
const ans = answParam;
list_answers.push(ans);

}
else {
currentIndex = 0;
currentQuestion = finish;
flag=0;
const answParam = agent.parameters.answers;
const ans = answParam;
list_answers.push(ans);

agent.add(currentQuestion);

return db.runTransaction(t => {
t.update(dialogflowAgentRef, {time: list_timestamps});
t.update(dialogflowAgentRef, {index: list_index});
t.update(dialogflowAgentRef, {question: list_questions});
t.update(dialogflowAgentRef, {answer: list_answers});
return Promise.resolve('Write complete');
});
}

const ques = currentQuestion;
list_questions.push(ques);

var timestamp = Date.now();
list_timestamps.push(timestamp);

let ctx = {'name': 'projects/prueba-firebase-v1/agent/sessions/545ec712-8f69-6999-a50b-4127d38bce82/contexts/questions_ready', 'lifespan': 14,
'parameters': {'timestamp': list_timestamps, 'list_index': list_index, 'list_questions': list_questions, 'list_answers': list_answers}}; //, 'list_index': list_index
agent.setContext(ctx);

agent.add(currentQuestion);

}

// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set(enter code here'Manual', manual);
intentMap.set('User_Name', user_name);
intentMap.set('Questions_Ready', questions_ready);

agent.handleRequest(intentMap);
});


The messages I obtain on Actions on Google are:



-On Simulator Display:
Prueba application isn't responding right now. Try again soon.



-Errors:
MalformedResponse
'final_response' must be set.



-Debug:



{
"response": "Prueba application isn't responding right now. Try again soon.",
"expectUserResponse": false,
"conversationToken": "GidzaW11bG...",
"audioResponse": "//NExAASWK...",
"debugInfo": {
"assistantToAgentDebug": {
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=6094e3dbd9e242679d0dcc603568b120&versionId=3' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6ImQxZTg2OWU3YmY0MGRkYzNkM2RlMDgwNDI1OThiYTgzNTA5NzBmMGEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdWQiOiJjeWJlcm9wcy1maXJlYmFzZS12MSIsIm5iZiI6MTU0MjcxMTY5MCwiaWF0IjoxNTQyNzExOTkwLCJleHAiOjE1NDI3MTIxMTAsImp0aSI6Ijc5NWYyZTViZGRjNzk5ZDAxMTY2MDZhZmEyZjJiMDRlYjU3MDk4ZGQifQ.XNBl3DcL2Zhw9bXHvPG52U21ATIb52snsQ5YF9T57cf9HrEeau6XTPfbtALdkiTEqhRfcihQTwLu7wAMdvmqTeeDaRW3F8C2xDCitT2bjPryeDJ3eyoJvI2cTy5Vhf1oN3WwsHdlM0D59JYyNtTH1NE-B60bnLCPQNe7Mv23aUnipdo-LsAytF_d9Bpz93SR_WZITqP6-FpqHSSuUHL3qi8idqGNQrtFF6RQ5-AGKkLkqE-V_Sa2iLmpqDsi4fP3RYW0bajuSFrn74JvrziQKQR4ZaFc4ITjPtJlhboCTgJusOqpFvOYV_-LF5FqgswaiMqUtaX8YBW_EKLLMLoS2A' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{"user":{"userId":"ABwppHFD2VxLtzrmnMXp4XsxyE13Xc7mxOhaf7cbxMUQg7OEe_I1qRVlcDck8Rl-bESCZBPi3cHvESEbHYfvecHr59o","locale":"en-US","lastSeen":"2018-11-20T10:51:47Z"},"conversation":{"conversationId":"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU","type":"ACTIVE","conversationToken":""},"inputs":[{"intent":"actions.intent.TEXT","rawInputs":[{"inputType":"KEYBOARD","query":"yes"}],"arguments":[{"name":"text","rawText":"yes","textValue":"yes"}]}],"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]}],"requestType":"SIMULATOR"}'",
"assistantToAgentJson": "{"user":{"userId":"ABwppHFD2VxLtzrmnMXp4XsxyE13Xc7mxOhaf7cbxMUQg7OEe_I1qRVlcDck8Rl-bESCZBPi3cHvESEbHYfvecHr59o","locale":"en-US","lastSeen":"2018-11-20T10:51:47Z"},"conversation":{"conversationId":"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU","type":"ACTIVE","conversationToken":""},"inputs":[{"intent":"actions.intent.TEXT","rawInputs":[{"inputType":"KEYBOARD","query":"yes"}],"arguments":[{"name":"text","rawText":"yes","textValue":"yes"}]}],"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]}],"requestType":"SIMULATOR"}"
},
"agentToAssistantDebug": {
"agentToAssistantJson": "{n "responseMetadata": {n "status": {n "code": 10,n "message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",n "details": [{n "@type": "type.googleapis.com/google.protobuf.Value",n "value": "{\"id\":\"95a80a4d-4a98-461f-b183-88a358d87ebc\",\"timestamp\":\"2018-11-20T11:06:30.765Z\",\"lang\":\"en-us\",\"result\":{},\"alternateResult\":{},\"status\":{\"code\":206,\"errorType\":\"partial_content\",\"errorDetails\":\"Webhook call failed. Error: Webhook response was empty.\"},\"sessionId\":\"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU\"}"n }]n }n }n}"
},
"sharedDebugInfoList": [
{
"name": "ResponseValidation",
"debugInfo": "",
"subDebugEntryList": [
{
"name": "MalformedResponse",
"debugInfo": "'final_response' must be set.",
"subDebugEntryList":
}
]
}
]
},
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "Prueba application isn't responding right now. Try again soon."
}
}
],
"suggestionsList": ,
"agentLogoUrl": ""
},
"clientError": 0,
"is3pResponse": 1,
"clientOperationList":
}


Here there are the images I have on my Questions_Ready Intent and the Dialog established by Dialogflow where all work perfectly. The problem is when I try to test the skill on Actions on Google



Questions_Ready Intent (I)



Questions_Ready Intent (II)



Answers Entities



Dialogflow dialog (I)



Dialogflow dialog (II)



Result obtained on Actions on Google










share|improve this question
























  • Can you include a screen shot of the entire "questoins_ready" Intent in the Dialogflow screen? You also indicated this worked in the Dialogflow simulator - can you also include the response it is giving?
    – Prisoner
    Nov 20 '18 at 12:16










  • I have updated my answer with the images!
    – Marta Romero
    Nov 20 '18 at 12:39










  • Please don't add answers unless they are actually answers - this isn't a forum. Stack Overflow lets you update your question by clicking on the edit link for exactly this reason. Please do so and then delete that answer.
    – Prisoner
    Nov 20 '18 at 12:43










  • Sorry, new publishing on Stack Overflow
    – Marta Romero
    Nov 20 '18 at 12:53










  • Not a problem - thats why I explained the normal procedure here.
    – Prisoner
    Nov 20 '18 at 15:35














1












1








1







I have a problem testing my Skill on actions on google and in my mobile. It works fine with dialogflow but when I arrive to the Intent defined by the function questions_ready on the assistent of google or in the actions google web page to test it, I have the error "'final_response' must be set.". But it works on Dialogflow, so I dont know where it is the error. I leave here my code hoping some of you can help me! Thank you!



'use strict';

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const {WebhookClient} = require('dialogflow-fulfillment');

process.env.DEBUG = 'dialogflow:*'; // enables lib debugging statements
admin.initializeApp(functions.config().firebase);
const db = admin.firestore();

// Variables
var procedure;
var procedure;
var finish = "Ok, thank you. We have finished the questions";
var status_questions = [
{question: 'Ok, here is your first question. Please, could you tell me how do you feel on a scale from 1 to 10 ? Where 1 is very bad and 10 is very good'},
{question: 'Your workload is very high, high, normal, low or very low?'},
{question: 'Tell me what is your level of monotony on a scale from 1 to 10. Where 1 is very bad and 10 is very good'}];

var currentIndex = 0;
var currentQuestion = "";
var flag = 0;

var list_answers = ;
var list_index = ;
var list_timestamps = ;
var list_questions = ;
const dialogflowAgentRef = db.collection('dialogflow').doc();
//

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });

function welcome(agent) {
agent.add(`Welcome to my agent!`);
}

function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}

function manual(agent) {
const problem = agent.parameters.manual_problems;
if (problem == "DDoS problem"){
procedure = `Ok! Let's see how to solve your `+ problem + `. Specify here the procedure to resolve DDoS problem`;
}
else {
procedure = `Sorry, we don't have a manual to resolve that problem`;
}

agent.add((procedure));
}

function user_name(agent){
const user = agent.parameters.names;
return db.runTransaction(t => {
t.set(dialogflowAgentRef, {name: user});
return Promise.resolve('Write complete');
}).then(doc => {
agent.add(`Ok ${user}, are you ready?`);
}).catch(err => {
console.log(`Error writing to Firestore: ${err}`);
agent.add(`Failed to write "${user}" to the Firestore database.`);
});
}

//WHEN IT IS CALLING THIS FUNCTION I GOT THE ERROR

function questions_ready(agent) {
if(currentIndex === 0){
list_index=;
list_answers=;
list_questions=;
list_timestamps=;
list_index.push(currentIndex);
currentQuestion = status_questions[currentIndex++].question;
}
else if(currentIndex >=1 && currentIndex <= 10){
list_index.push(currentIndex);
currentQuestion = status_questions[currentIndex++].question;
flag = 1;
const answParam = agent.parameters.answers;
const ans = answParam;
list_answers.push(ans);

}
else {
currentIndex = 0;
currentQuestion = finish;
flag=0;
const answParam = agent.parameters.answers;
const ans = answParam;
list_answers.push(ans);

agent.add(currentQuestion);

return db.runTransaction(t => {
t.update(dialogflowAgentRef, {time: list_timestamps});
t.update(dialogflowAgentRef, {index: list_index});
t.update(dialogflowAgentRef, {question: list_questions});
t.update(dialogflowAgentRef, {answer: list_answers});
return Promise.resolve('Write complete');
});
}

const ques = currentQuestion;
list_questions.push(ques);

var timestamp = Date.now();
list_timestamps.push(timestamp);

let ctx = {'name': 'projects/prueba-firebase-v1/agent/sessions/545ec712-8f69-6999-a50b-4127d38bce82/contexts/questions_ready', 'lifespan': 14,
'parameters': {'timestamp': list_timestamps, 'list_index': list_index, 'list_questions': list_questions, 'list_answers': list_answers}}; //, 'list_index': list_index
agent.setContext(ctx);

agent.add(currentQuestion);

}

// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set(enter code here'Manual', manual);
intentMap.set('User_Name', user_name);
intentMap.set('Questions_Ready', questions_ready);

agent.handleRequest(intentMap);
});


The messages I obtain on Actions on Google are:



-On Simulator Display:
Prueba application isn't responding right now. Try again soon.



-Errors:
MalformedResponse
'final_response' must be set.



-Debug:



{
"response": "Prueba application isn't responding right now. Try again soon.",
"expectUserResponse": false,
"conversationToken": "GidzaW11bG...",
"audioResponse": "//NExAASWK...",
"debugInfo": {
"assistantToAgentDebug": {
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=6094e3dbd9e242679d0dcc603568b120&versionId=3' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6ImQxZTg2OWU3YmY0MGRkYzNkM2RlMDgwNDI1OThiYTgzNTA5NzBmMGEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdWQiOiJjeWJlcm9wcy1maXJlYmFzZS12MSIsIm5iZiI6MTU0MjcxMTY5MCwiaWF0IjoxNTQyNzExOTkwLCJleHAiOjE1NDI3MTIxMTAsImp0aSI6Ijc5NWYyZTViZGRjNzk5ZDAxMTY2MDZhZmEyZjJiMDRlYjU3MDk4ZGQifQ.XNBl3DcL2Zhw9bXHvPG52U21ATIb52snsQ5YF9T57cf9HrEeau6XTPfbtALdkiTEqhRfcihQTwLu7wAMdvmqTeeDaRW3F8C2xDCitT2bjPryeDJ3eyoJvI2cTy5Vhf1oN3WwsHdlM0D59JYyNtTH1NE-B60bnLCPQNe7Mv23aUnipdo-LsAytF_d9Bpz93SR_WZITqP6-FpqHSSuUHL3qi8idqGNQrtFF6RQ5-AGKkLkqE-V_Sa2iLmpqDsi4fP3RYW0bajuSFrn74JvrziQKQR4ZaFc4ITjPtJlhboCTgJusOqpFvOYV_-LF5FqgswaiMqUtaX8YBW_EKLLMLoS2A' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{"user":{"userId":"ABwppHFD2VxLtzrmnMXp4XsxyE13Xc7mxOhaf7cbxMUQg7OEe_I1qRVlcDck8Rl-bESCZBPi3cHvESEbHYfvecHr59o","locale":"en-US","lastSeen":"2018-11-20T10:51:47Z"},"conversation":{"conversationId":"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU","type":"ACTIVE","conversationToken":""},"inputs":[{"intent":"actions.intent.TEXT","rawInputs":[{"inputType":"KEYBOARD","query":"yes"}],"arguments":[{"name":"text","rawText":"yes","textValue":"yes"}]}],"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]}],"requestType":"SIMULATOR"}'",
"assistantToAgentJson": "{"user":{"userId":"ABwppHFD2VxLtzrmnMXp4XsxyE13Xc7mxOhaf7cbxMUQg7OEe_I1qRVlcDck8Rl-bESCZBPi3cHvESEbHYfvecHr59o","locale":"en-US","lastSeen":"2018-11-20T10:51:47Z"},"conversation":{"conversationId":"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU","type":"ACTIVE","conversationToken":""},"inputs":[{"intent":"actions.intent.TEXT","rawInputs":[{"inputType":"KEYBOARD","query":"yes"}],"arguments":[{"name":"text","rawText":"yes","textValue":"yes"}]}],"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]}],"requestType":"SIMULATOR"}"
},
"agentToAssistantDebug": {
"agentToAssistantJson": "{n "responseMetadata": {n "status": {n "code": 10,n "message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",n "details": [{n "@type": "type.googleapis.com/google.protobuf.Value",n "value": "{\"id\":\"95a80a4d-4a98-461f-b183-88a358d87ebc\",\"timestamp\":\"2018-11-20T11:06:30.765Z\",\"lang\":\"en-us\",\"result\":{},\"alternateResult\":{},\"status\":{\"code\":206,\"errorType\":\"partial_content\",\"errorDetails\":\"Webhook call failed. Error: Webhook response was empty.\"},\"sessionId\":\"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU\"}"n }]n }n }n}"
},
"sharedDebugInfoList": [
{
"name": "ResponseValidation",
"debugInfo": "",
"subDebugEntryList": [
{
"name": "MalformedResponse",
"debugInfo": "'final_response' must be set.",
"subDebugEntryList":
}
]
}
]
},
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "Prueba application isn't responding right now. Try again soon."
}
}
],
"suggestionsList": ,
"agentLogoUrl": ""
},
"clientError": 0,
"is3pResponse": 1,
"clientOperationList":
}


Here there are the images I have on my Questions_Ready Intent and the Dialog established by Dialogflow where all work perfectly. The problem is when I try to test the skill on Actions on Google



Questions_Ready Intent (I)



Questions_Ready Intent (II)



Answers Entities



Dialogflow dialog (I)



Dialogflow dialog (II)



Result obtained on Actions on Google










share|improve this question















I have a problem testing my Skill on actions on google and in my mobile. It works fine with dialogflow but when I arrive to the Intent defined by the function questions_ready on the assistent of google or in the actions google web page to test it, I have the error "'final_response' must be set.". But it works on Dialogflow, so I dont know where it is the error. I leave here my code hoping some of you can help me! Thank you!



'use strict';

const functions = require('firebase-functions');
const admin = require('firebase-admin');
const {WebhookClient} = require('dialogflow-fulfillment');

process.env.DEBUG = 'dialogflow:*'; // enables lib debugging statements
admin.initializeApp(functions.config().firebase);
const db = admin.firestore();

// Variables
var procedure;
var procedure;
var finish = "Ok, thank you. We have finished the questions";
var status_questions = [
{question: 'Ok, here is your first question. Please, could you tell me how do you feel on a scale from 1 to 10 ? Where 1 is very bad and 10 is very good'},
{question: 'Your workload is very high, high, normal, low or very low?'},
{question: 'Tell me what is your level of monotony on a scale from 1 to 10. Where 1 is very bad and 10 is very good'}];

var currentIndex = 0;
var currentQuestion = "";
var flag = 0;

var list_answers = ;
var list_index = ;
var list_timestamps = ;
var list_questions = ;
const dialogflowAgentRef = db.collection('dialogflow').doc();
//

exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });

function welcome(agent) {
agent.add(`Welcome to my agent!`);
}

function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}

function manual(agent) {
const problem = agent.parameters.manual_problems;
if (problem == "DDoS problem"){
procedure = `Ok! Let's see how to solve your `+ problem + `. Specify here the procedure to resolve DDoS problem`;
}
else {
procedure = `Sorry, we don't have a manual to resolve that problem`;
}

agent.add((procedure));
}

function user_name(agent){
const user = agent.parameters.names;
return db.runTransaction(t => {
t.set(dialogflowAgentRef, {name: user});
return Promise.resolve('Write complete');
}).then(doc => {
agent.add(`Ok ${user}, are you ready?`);
}).catch(err => {
console.log(`Error writing to Firestore: ${err}`);
agent.add(`Failed to write "${user}" to the Firestore database.`);
});
}

//WHEN IT IS CALLING THIS FUNCTION I GOT THE ERROR

function questions_ready(agent) {
if(currentIndex === 0){
list_index=;
list_answers=;
list_questions=;
list_timestamps=;
list_index.push(currentIndex);
currentQuestion = status_questions[currentIndex++].question;
}
else if(currentIndex >=1 && currentIndex <= 10){
list_index.push(currentIndex);
currentQuestion = status_questions[currentIndex++].question;
flag = 1;
const answParam = agent.parameters.answers;
const ans = answParam;
list_answers.push(ans);

}
else {
currentIndex = 0;
currentQuestion = finish;
flag=0;
const answParam = agent.parameters.answers;
const ans = answParam;
list_answers.push(ans);

agent.add(currentQuestion);

return db.runTransaction(t => {
t.update(dialogflowAgentRef, {time: list_timestamps});
t.update(dialogflowAgentRef, {index: list_index});
t.update(dialogflowAgentRef, {question: list_questions});
t.update(dialogflowAgentRef, {answer: list_answers});
return Promise.resolve('Write complete');
});
}

const ques = currentQuestion;
list_questions.push(ques);

var timestamp = Date.now();
list_timestamps.push(timestamp);

let ctx = {'name': 'projects/prueba-firebase-v1/agent/sessions/545ec712-8f69-6999-a50b-4127d38bce82/contexts/questions_ready', 'lifespan': 14,
'parameters': {'timestamp': list_timestamps, 'list_index': list_index, 'list_questions': list_questions, 'list_answers': list_answers}}; //, 'list_index': list_index
agent.setContext(ctx);

agent.add(currentQuestion);

}

// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set(enter code here'Manual', manual);
intentMap.set('User_Name', user_name);
intentMap.set('Questions_Ready', questions_ready);

agent.handleRequest(intentMap);
});


The messages I obtain on Actions on Google are:



-On Simulator Display:
Prueba application isn't responding right now. Try again soon.



-Errors:
MalformedResponse
'final_response' must be set.



-Debug:



{
"response": "Prueba application isn't responding right now. Try again soon.",
"expectUserResponse": false,
"conversationToken": "GidzaW11bG...",
"audioResponse": "//NExAASWK...",
"debugInfo": {
"assistantToAgentDebug": {
"curlCommand": "curl -v 'https://api.api.ai/api/integrations/google?token=6094e3dbd9e242679d0dcc603568b120&versionId=3' -H 'Content-Type: application/json;charset=UTF-8' -H 'Google-Actions-API-Version: 2' -H 'Authorization: eyJhbGciOiJSUzI1NiIsImtpZCI6ImQxZTg2OWU3YmY0MGRkYzNkM2RlMDgwNDI1OThiYTgzNTA5NzBmMGEiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhdWQiOiJjeWJlcm9wcy1maXJlYmFzZS12MSIsIm5iZiI6MTU0MjcxMTY5MCwiaWF0IjoxNTQyNzExOTkwLCJleHAiOjE1NDI3MTIxMTAsImp0aSI6Ijc5NWYyZTViZGRjNzk5ZDAxMTY2MDZhZmEyZjJiMDRlYjU3MDk4ZGQifQ.XNBl3DcL2Zhw9bXHvPG52U21ATIb52snsQ5YF9T57cf9HrEeau6XTPfbtALdkiTEqhRfcihQTwLu7wAMdvmqTeeDaRW3F8C2xDCitT2bjPryeDJ3eyoJvI2cTy5Vhf1oN3WwsHdlM0D59JYyNtTH1NE-B60bnLCPQNe7Mv23aUnipdo-LsAytF_d9Bpz93SR_WZITqP6-FpqHSSuUHL3qi8idqGNQrtFF6RQ5-AGKkLkqE-V_Sa2iLmpqDsi4fP3RYW0bajuSFrn74JvrziQKQR4ZaFc4ITjPtJlhboCTgJusOqpFvOYV_-LF5FqgswaiMqUtaX8YBW_EKLLMLoS2A' -A 'Mozilla/5.0 (compatible; Google-Cloud-Functions/2.1; +http://www.google.com/bot.html)' -X POST -d '{"user":{"userId":"ABwppHFD2VxLtzrmnMXp4XsxyE13Xc7mxOhaf7cbxMUQg7OEe_I1qRVlcDck8Rl-bESCZBPi3cHvESEbHYfvecHr59o","locale":"en-US","lastSeen":"2018-11-20T10:51:47Z"},"conversation":{"conversationId":"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU","type":"ACTIVE","conversationToken":""},"inputs":[{"intent":"actions.intent.TEXT","rawInputs":[{"inputType":"KEYBOARD","query":"yes"}],"arguments":[{"name":"text","rawText":"yes","textValue":"yes"}]}],"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]}],"requestType":"SIMULATOR"}'",
"assistantToAgentJson": "{"user":{"userId":"ABwppHFD2VxLtzrmnMXp4XsxyE13Xc7mxOhaf7cbxMUQg7OEe_I1qRVlcDck8Rl-bESCZBPi3cHvESEbHYfvecHr59o","locale":"en-US","lastSeen":"2018-11-20T10:51:47Z"},"conversation":{"conversationId":"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU","type":"ACTIVE","conversationToken":""},"inputs":[{"intent":"actions.intent.TEXT","rawInputs":[{"inputType":"KEYBOARD","query":"yes"}],"arguments":[{"name":"text","rawText":"yes","textValue":"yes"}]}],"surface":{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.MEDIA_RESPONSE_AUDIO"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]},"isInSandbox":true,"availableSurfaces":[{"capabilities":[{"name":"actions.capability.AUDIO_OUTPUT"},{"name":"actions.capability.WEB_BROWSER"},{"name":"actions.capability.SCREEN_OUTPUT"}]}],"requestType":"SIMULATOR"}"
},
"agentToAssistantDebug": {
"agentToAssistantJson": "{n "responseMetadata": {n "status": {n "code": 10,n "message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",n "details": [{n "@type": "type.googleapis.com/google.protobuf.Value",n "value": "{\"id\":\"95a80a4d-4a98-461f-b183-88a358d87ebc\",\"timestamp\":\"2018-11-20T11:06:30.765Z\",\"lang\":\"en-us\",\"result\":{},\"alternateResult\":{},\"status\":{\"code\":206,\"errorType\":\"partial_content\",\"errorDetails\":\"Webhook call failed. Error: Webhook response was empty.\"},\"sessionId\":\"ABwppHH7q6m-4okbTf3aKCU-dgpEAoOmeCLle2AZjocfLI6i8BS1Lhqcx4InD3QBKboVr4yyTPcaOhAOMgQsaHIgHRU\"}"n }]n }n }n}"
},
"sharedDebugInfoList": [
{
"name": "ResponseValidation",
"debugInfo": "",
"subDebugEntryList": [
{
"name": "MalformedResponse",
"debugInfo": "'final_response' must be set.",
"subDebugEntryList":
}
]
}
]
},
"visualResponse": {
"visualElementsList": [
{
"displayText": {
"content": "Prueba application isn't responding right now. Try again soon."
}
}
],
"suggestionsList": ,
"agentLogoUrl": ""
},
"clientError": 0,
"is3pResponse": 1,
"clientOperationList":
}


Here there are the images I have on my Questions_Ready Intent and the Dialog established by Dialogflow where all work perfectly. The problem is when I try to test the skill on Actions on Google



Questions_Ready Intent (I)



Questions_Ready Intent (II)



Answers Entities



Dialogflow dialog (I)



Dialogflow dialog (II)



Result obtained on Actions on Google







node.js dialogflow actions-on-google simulator






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 8:55

























asked Nov 20 '18 at 12:09









Marta Romero

63




63












  • Can you include a screen shot of the entire "questoins_ready" Intent in the Dialogflow screen? You also indicated this worked in the Dialogflow simulator - can you also include the response it is giving?
    – Prisoner
    Nov 20 '18 at 12:16










  • I have updated my answer with the images!
    – Marta Romero
    Nov 20 '18 at 12:39










  • Please don't add answers unless they are actually answers - this isn't a forum. Stack Overflow lets you update your question by clicking on the edit link for exactly this reason. Please do so and then delete that answer.
    – Prisoner
    Nov 20 '18 at 12:43










  • Sorry, new publishing on Stack Overflow
    – Marta Romero
    Nov 20 '18 at 12:53










  • Not a problem - thats why I explained the normal procedure here.
    – Prisoner
    Nov 20 '18 at 15:35


















  • Can you include a screen shot of the entire "questoins_ready" Intent in the Dialogflow screen? You also indicated this worked in the Dialogflow simulator - can you also include the response it is giving?
    – Prisoner
    Nov 20 '18 at 12:16










  • I have updated my answer with the images!
    – Marta Romero
    Nov 20 '18 at 12:39










  • Please don't add answers unless they are actually answers - this isn't a forum. Stack Overflow lets you update your question by clicking on the edit link for exactly this reason. Please do so and then delete that answer.
    – Prisoner
    Nov 20 '18 at 12:43










  • Sorry, new publishing on Stack Overflow
    – Marta Romero
    Nov 20 '18 at 12:53










  • Not a problem - thats why I explained the normal procedure here.
    – Prisoner
    Nov 20 '18 at 15:35
















Can you include a screen shot of the entire "questoins_ready" Intent in the Dialogflow screen? You also indicated this worked in the Dialogflow simulator - can you also include the response it is giving?
– Prisoner
Nov 20 '18 at 12:16




Can you include a screen shot of the entire "questoins_ready" Intent in the Dialogflow screen? You also indicated this worked in the Dialogflow simulator - can you also include the response it is giving?
– Prisoner
Nov 20 '18 at 12:16












I have updated my answer with the images!
– Marta Romero
Nov 20 '18 at 12:39




I have updated my answer with the images!
– Marta Romero
Nov 20 '18 at 12:39












Please don't add answers unless they are actually answers - this isn't a forum. Stack Overflow lets you update your question by clicking on the edit link for exactly this reason. Please do so and then delete that answer.
– Prisoner
Nov 20 '18 at 12:43




Please don't add answers unless they are actually answers - this isn't a forum. Stack Overflow lets you update your question by clicking on the edit link for exactly this reason. Please do so and then delete that answer.
– Prisoner
Nov 20 '18 at 12:43












Sorry, new publishing on Stack Overflow
– Marta Romero
Nov 20 '18 at 12:53




Sorry, new publishing on Stack Overflow
– Marta Romero
Nov 20 '18 at 12:53












Not a problem - thats why I explained the normal procedure here.
– Prisoner
Nov 20 '18 at 15:35




Not a problem - thats why I explained the normal procedure here.
– Prisoner
Nov 20 '18 at 15:35












1 Answer
1






active

oldest

votes


















0














On the Debug json:




debugInfo.agentToAssistantDebug.agentToAssistantJson: "Failed to parse Dialogflow response into AppResponse because of empty speech response"




We can see that Dialogflow is not returning any response that Actions on Google understands. Example response for AoG



So, my thoughts are that the webhook is not returning the correct format for Actions on Google, which is different from Dialogflow.



Here you have a repository for examples of the responses for Actions on Google: https://github.com/dialogflow/fulfillment-webhook-json/tree/master/responses/v2/ActionsOnGoogle/RichResponses



I'm sorry I can't help further with the node.js code, I implemented the webhooks in another language, but the json response is the same for all of them.






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392719%2factions-on-google-not-working-but-they-does-in-dialogflow%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    On the Debug json:




    debugInfo.agentToAssistantDebug.agentToAssistantJson: "Failed to parse Dialogflow response into AppResponse because of empty speech response"




    We can see that Dialogflow is not returning any response that Actions on Google understands. Example response for AoG



    So, my thoughts are that the webhook is not returning the correct format for Actions on Google, which is different from Dialogflow.



    Here you have a repository for examples of the responses for Actions on Google: https://github.com/dialogflow/fulfillment-webhook-json/tree/master/responses/v2/ActionsOnGoogle/RichResponses



    I'm sorry I can't help further with the node.js code, I implemented the webhooks in another language, but the json response is the same for all of them.






    share|improve this answer


























      0














      On the Debug json:




      debugInfo.agentToAssistantDebug.agentToAssistantJson: "Failed to parse Dialogflow response into AppResponse because of empty speech response"




      We can see that Dialogflow is not returning any response that Actions on Google understands. Example response for AoG



      So, my thoughts are that the webhook is not returning the correct format for Actions on Google, which is different from Dialogflow.



      Here you have a repository for examples of the responses for Actions on Google: https://github.com/dialogflow/fulfillment-webhook-json/tree/master/responses/v2/ActionsOnGoogle/RichResponses



      I'm sorry I can't help further with the node.js code, I implemented the webhooks in another language, but the json response is the same for all of them.






      share|improve this answer
























        0












        0








        0






        On the Debug json:




        debugInfo.agentToAssistantDebug.agentToAssistantJson: "Failed to parse Dialogflow response into AppResponse because of empty speech response"




        We can see that Dialogflow is not returning any response that Actions on Google understands. Example response for AoG



        So, my thoughts are that the webhook is not returning the correct format for Actions on Google, which is different from Dialogflow.



        Here you have a repository for examples of the responses for Actions on Google: https://github.com/dialogflow/fulfillment-webhook-json/tree/master/responses/v2/ActionsOnGoogle/RichResponses



        I'm sorry I can't help further with the node.js code, I implemented the webhooks in another language, but the json response is the same for all of them.






        share|improve this answer












        On the Debug json:




        debugInfo.agentToAssistantDebug.agentToAssistantJson: "Failed to parse Dialogflow response into AppResponse because of empty speech response"




        We can see that Dialogflow is not returning any response that Actions on Google understands. Example response for AoG



        So, my thoughts are that the webhook is not returning the correct format for Actions on Google, which is different from Dialogflow.



        Here you have a repository for examples of the responses for Actions on Google: https://github.com/dialogflow/fulfillment-webhook-json/tree/master/responses/v2/ActionsOnGoogle/RichResponses



        I'm sorry I can't help further with the node.js code, I implemented the webhooks in another language, but the json response is the same for all of them.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 20 '18 at 18:33









        German Casares

        726




        726






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53392719%2factions-on-google-not-working-but-they-does-in-dialogflow%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            If I really need a card on my start hand, how many mulligans make sense? [duplicate]

            Alcedinidae

            Can an atomic nucleus contain both particles and antiparticles? [duplicate]