Open DMani009 opened 4 years ago
In my case I had to return an agent. if(person.City === city) return agent.add(Here are the details for ${"city"}.CollectionC: ${person.CollectionC}, Address: ${person.Address}, Phone: ${person.Phone});
Also make sure your Google Development account is activated with billing information. In trial mode remote call's are not allowed. You can check the result in the Diagnostic info.
"webhookStatus": { "message": "Webhook execution successful" }
If an error is shown chances are your account is not acitvated. This took me a couple of days myself, billing information was defined but account was still in trial model, once activated the error No responses defined for platform: DIALOGFLOW_CONSOLE was gone!
I was struggling with this error for hours, only to find out I needed to change these 2 little things:
I was struggling with this error for hours, only to find out I needed to change these 2 little things:
- in package.json, change the version of "dialogflow-fulfillment" to "0.6.1" (instead of 0.5.0)
- make sure your intent has at least 1 default response in the bottom section of the intent configuration screen (Dialogflow ES)
Thanks A LOT!
Hi guys! I'm new to nodejs and dialogflow and am getting this exact same error when trying to integrate my GPT-J from banana with Dialogflow, below is my codes and I would really appreciate any help 🙏🙏
const express = require("express");
require("actions-on-google")
require('dotenv').config();
const axios = require('axios');
const { WebhookClient } = require("dialogflow-fulfillment");
const app = express();
const fetch = require('node-fetch');
const banana = require('@banana-dev/banana-dev');
app.get('/', (req,res) => {
res.send('Welcome to Dialogflow-GPTJ2 Application!!');
})
app.post("/dialogflow", express.json(), (req, res) => {
const agent = new WebhookClient({ request: req, response: res });
let intentMap = new Map();
intentMap.set("Default Welcome Intent", welcome);
intentMap.set("Default Fallback Intent", defaultFallback);
agent.handleRequest(intentMap);
function welcome(agent) {
agent.add('Hi, I am Debra! I am your virtual personal assistant from Orient Telecoms. How are you doing today?');
}
async function defaultFallback(agent) {
let query = agent.query;
console.log('querytext: ', query)
var modelKey = "gptj"
const modelParameters = {
"text":query,
"length":50,
"temperature":0.9,
"batchSize": 1
}
try {
let run = async (modelParameters) => {
var botResponse = await banana.run(process.env.apiKey, modelKey, modelParameters)
console.log('botResponse: ', botResponse)
agent.add(botResponse)
}
} catch (err) {
console.log('This is error:', err);
agent.add('Sorry. Something went wrong. Can you say that again?');
}
}
});
const port = 3000;
app.listen(port, () => console.log(`App listening on port ${port}!`))
When I tried to use Dialogflow to update google Sheets using Axios. I met the same error, but an expert helps me fix the issue via the following code: `'use strict';
const functions = require('firebase-functions'); const {WebhookClient} = require('dialogflow-fulfillment'); const {Card, Suggestion} = require('dialogflow-fulfillment'); const axios = require('axios'); // const qs = require('qs');
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 welcome(agent) {
agent.add(welcome
);
}
function fallback(agent) {
agent.add(I didn't understand
);
agent.add(I'm sorry, can you try again?
);
}
function bookkeepingHandler(agent) {
axios.post(https://sheetdb.io/api/v1/htvjf0t8az3f8?sheet=Entries
, {"data": {
"EntryType":agent.parameters.entrytype,
"Date":agent.parameters.date,
"Amount":agent.parameters.amount
}
});
agent.add(Thank you! Check the google sheet for the data recorded.
);
}
//data,{header: {'x-api-key': 'eRjwrg6ya88d1i@z#91cb01rz%u$6cxU5FOf#3LG#P%8$#JZwlj9aawgHhabpYGT'}}
// 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('bookkeepEntry', bookkeepingHandler);
//intentMap.set('bookNow', bookkeepingHandler);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});`
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
}
});
Hi 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:
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); });