Error: No responses defined for platform: DIALOGFLOW_CONSOLE
See original GitHub issueHi All,
I am trying to read data from an API in Dialogflow. Below is the code but I am getting the following error and it looks like I have defined my responses in agent.add but still getting the following error. I am not a java expert but trying to learn and maybe I am doing some syntax error. I am not sure but I would appreciate your time and help. Following are errors i am getting:
Error: No responses defined for platform: DIALOGFLOW_CONSOLE
at WebhookClient.send_ (/workspace/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:488:13)
at promise.then (/workspace/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:306:38)
at process._tickCallback (internal/process/next_tick.js:68:7)
textPayload: "Error: No responses defined for platform: DIALOGFLOW_CONSOLE
at WebhookClient.send_ (/workspace/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:488:13)
at promise.then (/workspace/node_modules/dialogflow-fulfillment/src/dialogflow-fulfillment.js:306:38)
at process._tickCallback (internal/process/next_tick.js:68:7)"
insertId: "000000-1fd08a04-56f8-4c82-b000-360724f95c3a"
resource: {2}
timestamp: "2020-10-21T19:07:49.495Z"
severity: "ERROR"
labels: {1}
logName: "projects/testbigquery-edjv/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
trace: "projects/testbigquery-edjv/traces/e8c0d32bfe9e582267667f01e30c1141"
receiveTimestamp: "2020-10-21T19:07:49.683046180Z"
Function execution took 1294 ms, finished with status: 'crash'
textPayload: "Function execution took 1294 ms, finished with status: 'crash'"
insertId: "000000-0840e9bd-0a4b-4ee3-bf4d-9a1e451a2c0f"
resource: {2}
timestamp: "2020-10-21T19:07:49.497111804Z"
severity: "DEBUG"
labels: {1}
logName: "projects/testbigquery-edjv/logs/cloudfunctions.googleapis.com%2Fcloud-functions"
trace: "projects/testbigquery-edjv/traces/e8c0d32bfe9e582267667f01e30c1141"
receiveTimestamp: "2020-10-21T19:07:49.683046180Z"
My code is below: // See https://github.com/dialogflow/dialogflow-fulfillment-nodejs // for Dialogflow fulfillment library docs, samples, and to report issues ‘use strict’;
const functions = require(‘firebase-functions’); const {WebhookClient} = require(‘dialogflow-fulfillment’); const {Card, Suggestion} = require(‘dialogflow-fulfillment’); const axios = require(‘axios’);
process.env.DEBUG = ‘dialogflow:debug’; // enables lib debugging statements
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { const agent = new WebhookClient({ request, response }); console.log('Dialogflow Request headers: ’ + JSON.stringify(request.headers)); console.log('Dialogflow Request body: ’ + JSON.stringify(request.body));
function getSpreadsheetData(){ return axios.get(‘https://sheetdb.io/api/v1/y79vpk8pj29cv’); }
function welcome(agent) {
const city =agent.parameters.city;
return getSpreadsheetData().then(res => {
res.data.map(person => {
if(person.City === city)
agent.add(Here are the details for ${"city"}.CollectionC: ${person.CollectionC}, Address: ${person.Address}, Phone: ${person.Phone}
);
});
});
}
function fallback(agent) {
agent.add(I didn't understand
);
agent.add(I'm sorry, can you try again?
);
}
// // Uncomment and edit to make your own intent handler
// // uncomment intentMap.set('your intent name here', yourFunctionHandler);
// // below to get this function to be run when a Dialogflow intent is matched
// function yourFunctionHandler(agent) {
// agent.add(This message is from Dialogflow's Cloud Functions for Firebase editor!
);
// agent.add(new Card({
// title: Title: this is a card title
,
// imageUrl: ‘https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png’,
// text: This is the body text of a card. You can even use line\n breaks and emoji! 💁
,
// buttonText: ‘This is a button’,
// buttonUrl: ‘https://assistant.google.com/’
// })
// );
// agent.add(new Suggestion(Quick Reply
));
// agent.add(new Suggestion(Suggestion
));
// agent.setContext({ name: ‘weather’, lifespan: 2, parameters: { city: ‘Rome’ }});
// }
// // Uncomment and edit to make your own Google Assistant intent handler
// // uncomment intentMap.set('your intent name here', googleAssistantHandler);
// // below to get this function to be run when a Dialogflow intent is matched
// function googleAssistantHandler(agent) {
// let conv = agent.conv(); // Get Actions on Google library conv instance
// conv.ask(‘Hello from the Actions on Google client library!’) // Use Actions on Google library
// agent.add(conv); // Add Actions on Google library responses to your agent’s response
// }
// // See https://github.com/dialogflow/fulfillment-actions-library-nodejs
// // for a complete Dialogflow fulfillment library Actions on Google client library v2 integration sample
// 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(‘your intent name here’, yourFunctionHandler); // intentMap.set(‘your intent name here’, googleAssistantHandler); agent.handleRequest(intentMap); });
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
I was struggling with this error for hours, only to find out I needed to change these 2 little things:
Pay attention to the code here (`` symbol is very important): axios.post(
https://sheetdb.io/api/v1/htvjf0t8az3f8?sheet=Entries
, {“data”: { “EntryType”:agent.parameters.entrytype, “Date”:agent.parameters.date, “Amount”:agent.parameters.amount } });