Do you create any video or steps for connecting Hostinger DB to google dialog flow. I have followed the same steps but no luck getting Access denied issue.
Thank You for amazing video can you guide me why i am getting this error in GCP FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail
Thank you for this tutorial. I have one question: How if we want to execute multiple statments under one intent. i.e you want to confirm a custumer exists, fetch its id and then insert some record like an order, using one intent (fetch some data, if data feteched and compared, then execute the insert statement). Thanks in advance
Hi Benjamin, did you try to execute the codes? In my case, the BOT does not fetch the records in my MYSQL database hosted in a webhosting. Is there any configuration to do in the webhosting to allow the DATABASE to be access?
hi thanks for the video but i have a problem. i have my MySQL database at clevercloud and i did the same as you and my agent returned "webhook failed: not available". I think the problem is that clevercloud dont provide an IP to identificate the host, it gives me an url and maybe that makes the connection not working. So my question is: is it possible to connect dialogflow with a database at deployed at clevercloud? Thankss
@@AxleWebTechnologies i have been looking for that but i think is enabled as default because i didnt find anything like remote connections settings and it says to me that the database is 'running' so its weird.
It is the IP address of your hosting provider. I have added some details in the video, please have a look here: ua-cam.com/video/v7k5vckSzNo/v-deo.html
Hi I need to get some data from tow tables first table "cust_tbl" has (name, email, id ) and balance table Has the (id, cust_id, balance) so how i can show the customer name with the ambulance ? thanks
Thank you for this tutorial, very informative. However, there are some issues when using Google Cloud SQL (mysql)... and apparently I can't make it work. Do you have any thoughts on how can I fix this? Thank you
Few things to check 1. Make sure your billing account is enabled 2. Make sure that fulfillment option is enabled in the intent 3. Make sure remote access is allowed for the MySQL Database
@cyberpau were you able to solve using Google Cloud SQL (mysql)? Please let me know it would be very helpful been stuck there, not able to connect using dialogflow though my database accepts remote connections.
@@AxleWebTechnologies Hey Anshul all these have been enabled but still not able to connect using Google Cloud SQL (mysql), though i'm able to set up and use through firebase, can you please help :/ My COde: 'use strict';
Hi, can you help me, i'm getting this error "Webhook call failed. Error: DEADLINE_EXCEEDED." Also in logs in the google cloud console I received this Warning, "FIREBASE_CONFIG environment variable is missing. Initializing"
Deadline exceeded means your webhook code did not responded back within 5 seconds. Try to reduce the processing you are doing in your code/logic. Also if there is an external API call, please make sure your external api responds within 5 seconds. If you still face any issue, please send an email to dialogflow.team@axlewebtech.com with error logs and screenshot of errors you are facing. Someone from our team will help you.
You can create an API which is connected to your MSSQL database and then you can connect your Dialogflow agent to MSSQL using those APIs. We haven't tried connecting Dialogflow directly to MSSQL so not sure about that.
Hello Axle! i got undefined too. I dont know how to get the host name using phpmyadmin mysql service, there is a way that i can do that without hostgator? thanks in advance
Your server IP address should be your hostname, you can contact hostgator support to get these details. You can try connecting to MySQL from Workbench, Navicat or Sequel Pro before connecting through Dialogflow. One more thing, you need to enable remote access to your MySQL database to the remote IP. Please refer to this article: www.hostgator.com/help/article/how-to-connect-to-the-mysql-database-remotely
After implementing according to your tutorial getting following error: "handleRequest must contain a map of Dialogflow intent names to function handlers" Please help me I am fully stuck.
I have this error The deployment of your Cloud Function failed: Function failed on loading user code. Error message: Code in file index.js can't be loaded. Is there a syntax error in your code? Detailed stack trace: ReferenceError: agent is not defined at Object. (/srv/index.js:115:3) What can i do?
Hi. Your video is great. I follow step by step the video but after typing the email the default response "not available" and I get this error Webhook call failed. Error: UNAVAILABLE. Could you help me with that? Thankyou
Please join the slack channel using below link and post your queries in the channel: join.slack.com/t/dialogflow-awt/shared_invite/enQtOTUwMzAwOTI3Mjk2LWRiOGYwOGIyOGU4ZjNkNWI3NTJiMTgyMmMyNTM2OWE2YzZmZjkwNmEyMWZmOWIyZTRmNzY3MTY2ZDYzNWVhYzQ
Hi! I have followed your tutorial, but in minute 13:00, I don't have a message like you in Firebase Functions, and when I type MySQL, I don't get any result in Functions, any suggestion?
There could be couple of things that might cause the issue. Please check the following 1. Have you enabled the billing account 2. Have you enabled the fulfilment option in the intent 3. Have you added console.log in your code 4. Have you added mysql package in package.json? Try these and let me know if it still doesn't works.
what if I want to get all the rows that have the same namel so maybe 3 people with same name and that gives me 3 emails for 1 response how to achieve that?
some extra code/lines are used but not showing in your video. I have followed your videos step by step but still showing me like "results not defined". Here "results" is the variable used
Please refer to the code here and make sure there are no errors in your code. gist.github.com/Anshul0305/aace32e8eabcb2ef49835d0079091e00 Also if possible, share your code so that I can have a look.
Hi, first of all great tutorial and tnks, now i followed step explained in the video but facing some issue 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)
Hi, Can you help I am getting below error, have tried all and can't figure it out...I turned on SSH at my server Side but Still not working. "webhookStatus": { "code": 13, "message": "Webhook call failed. Error: 500 Internal Server Error."
@@AxleWebTechnologies I am using your code on Github the same way just query and Sever credentials changed. See error from the firebase console. Please let me know if I contact you directly. Please share your contact. TypeError: Cannot read property 'map' of undefined at queryDatabase.then.result (/srv/index.js:118:16) at at process._tickDomainCallback (internal/process/next_tick.js:229:7)
I am repeatedly getting this error along with unhandled rejection TypeError: Cannot read property 'map' of undefined at queryDatabase.then.result (/srv/index.js:72:17) at at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Maybe you need to enable remote access to your mysql database. Try login to your control panel and follow the steps as mentioned in the below tutorial. ua-cam.com/video/xXOq9U9fzOo/v-deo.html
Hi i have this error TypeError: Cannot read property 'map' of undefined at queryDatabase.then.result (/srv/index.js:55:16) at at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Why you don't use this query instead to save some code lines "select name, lastname from users where email='agent.parameters.email'? It's more efficient
@@AxleWebTechnologies oh I got it, thank you for explaining. I like your videos I really hope you can continue with some advanced querys for better user experience. Something like when the user says "I want to see the users created yesterday" or " I want to se the older user name", it's just a suggestion. Thanks in advance
@@shekanyasetijo5695 even i am facing this error and also this error { Error: connect ETIMEDOUT at Connection._handleConnectTimeout Please help me out if you will get the solution. Thanks in advance
Hi Anshul, Please help me out with this.. TypeError: Cannot read property '0' of undefined at queryDatabase.then.result (/srv/index.js:56:35) at at process._tickDomainCallback (internal/process/next_tick.js:229:7)
@@AxleWebTechnologies here it is.. // See github.com/dialogflow/dialogflow-fulfillment-nodejs // for Dialogflow fulfillment library docs, samples, and to report issues 'use strict';
what can this error be TypeError: Cannot read property 'map' of undefined at queryDatabase.then.result (/srv/index.js:54:16) at at process._tickDomainCallback (internal / process / next_tick.js: 229: 7)
Hi, I am getting this error while connecting my local Mysql. Can you help with this Error: { Error: connect ECONNREFUSED 127.0.0.1:3306 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14) -------------------- at Protocol._enqueue (/srv/node_modules/mysql/lib/protocol/Protocol.js:144:48) at Protocol.handshake (/srv/node_modules/mysql/lib/protocol/Protocol.js:51:23) at Connection.connect
You cannot connect you dialogflow with MySQL server running on localhost. There are couple of things you can do 1. host the SQL server on cloud such as AWS or Google cloud 2. tunnel your localhost using ngrok or similar tool
@@AxleWebTechnologies We are also using a SIP called Voximplant to call the voicebot from a cellphone to order pizza from a restaurant (college project)
hi anshul can you help me, i tried the tutorial you gave and got an error "unhandle rejection" and "Cannot read property 'map' of undefined at queryDatabase.then.result", can you check my code that will be sent via email thank you, sorry my english is bad
Hello Choirul, I have replied to your email. Looks like your database is not remotely accessible. Please check this link to enable remote access: www.hostgator.com/help/article/how-to-connect-to-the-mysql-database-remotely
{ Error: connect ETIMEDOUT at Connection._handleConnectTimeout I am facing this error please help me out sir and another error is undefined i don't know what it is?
Solution found: use socketPath instead of host like this socketPath : '/cloudsql/[instance-connection-name]' socketPath: '/cloudsql/charbot2-ivjagp:asia-south1:auction-instance', user : '', password : '', database : 'db'
@@AxleWebTechnologies hello, I am using your github code, I am using GCP Mysql, I have access from the Mysql Workbench client and still I get as an "undefined" answer in the firebase console and in dialogflow diagnostic info I get Webhook call failed. Error: DEADLINE_EXCEEDED. Can someone help me with the problem?
just set your billing account and you will receive a free trial for a year(with 300$ credits) and then 'buy' the Flame package in Firebase and it's OK!
@@AxleWebTechnologies hello, I am using your github code, I am using GCP Mysql, I have access from the Mysql Workbench client and still I get as an "undefined" answer in the firebase console .Can someone help me with the problem?
Make sure you have enabled remote access. Try following steps in the following video. Try using %.%.%.% for remote IP. ua-cam.com/video/xXOq9U9fzOo/v-deo.html
Hello Friends, our Udemy course is out now. Please check it out here: www.udemy.com/course/mastering-dialogflow-build-smart-chatbots-using-dialogflow/?referralCode=F2B97D95121392E3FFAE We just published this course and we will keep refreshing this course with the latest Dialogflow tutorials. Please subscribe to our Udemy course now.
Hello, your video is very good, it helps me, in this code there is an example of data validation in mysql. Example: ReadMySQL query, when it doesn't find the request. if(user_cpf === user.cpf){ agent.add(`First name: ${user.first_name}: Last name: ${user.last_name}`); } ELSE {USER NOT FINDER}
Solution found: use socketPath instead of host like this socketPath : '/cloudsql/[instance-connection-name]' socketPath: '/cloudsql/charbot2-ivjagp:asia-south1:auction-instance', user : '', password : '', database : 'db'
Make sure you have enabled fulfillment option in your intent, make sure you have billing account enabled and also make sure the IP address from which you are accessing the database is whitelisted in database hosting.
@@AnshulShrivastavaOnline Al ready checket it. when I comment out the lines 55, 56, 58 and 59 (Github). The agent respose again in the console. I can't find the problem. Sorry, my English isn't good.
Looks like something is wrong with Parameters. Please send an email to anshul.shrivastava@axlewebtech.com (or share your agent with this email address), I will have a look.
Hi!...i have this error log: dialogflowFirebaseFulfillment Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail I see that yo have a FireBase configuration but you don`t explain this part. Can you help me with that? Thanks!
I got this error when I deploy it "Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail". Can you help me?
This is not an error but just a warning. You can ignore this. Ideally this should work for you. If this is not working, there might be some other error.
Yessss :D make others video with php please, you are the Numbers 1! Numero 1 🇮🇹
This was very helpful! Thanks for sharing
Do you create any video or steps for connecting Hostinger DB to google dialog flow. I have followed the same steps but no luck getting Access denied issue.
Hi Anshul
Could u please tell is it possible to return multiple rows of data from db to dialogflow as response?
Thanks for uploading such useful content 🙂
Do i need to connect it first to Firebase?
Thank You for amazing video
can you guide me why i am getting this error in GCP
FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail
Thank you for this tutorial. I have one question: How if we want to execute multiple statments under one intent. i.e you want to confirm a custumer exists, fetch its id and then insert some record like an order, using one intent (fetch some data, if data feteched and compared, then execute the insert statement). Thanks in advance
Thanks for sharing. Is it possible to do the same work from SAS using dialogflow in stead of MySQL
Sorry no experience of using SAS but will try to explore that.
Nice tutorials, keep it up, good job :)
Hi Benjamin, did you try to execute the codes? In my case, the BOT does not fetch the records in my MYSQL database hosted in a webhosting. Is there any configuration to do in the webhosting to allow the DATABASE to be access?
@@geovilla821 you may need to whitelist the IP address from which you are trying to access the database.
Thankyou so much
hi thanks for the video but i have a problem. i have my MySQL database at clevercloud and i did the same as you and my agent returned "webhook failed: not available". I think the problem is that clevercloud dont provide an IP to identificate the host, it gives me an url and maybe that makes the connection not working. So my question is: is it possible to connect dialogflow with a database at deployed at clevercloud?
Thankss
Not sure about clevercloud but make sure to enable remote connection for your mySQL database.
@@AxleWebTechnologies i have been looking for that but i think is enabled as default because i didnt find anything like remote connections settings and it says to me that the database is 'running' so its weird.
Hey tysm long time video but really appreciate
To enable remote MYSQL on hostGator you need to specify the address of the server that will access the MySQL server. Which address did you use?
It is the IP address of your hosting provider. I have added some details in the video, please have a look here: ua-cam.com/video/v7k5vckSzNo/v-deo.html
@@AxleWebTechnologies
It refers to the IP side of the Dialogflow to allow queries. Please help us!
@@kennycolonia296 did you find a solution for this?
did you find solution for this?
@@AxleWebTechnologies please help on this matter
Great Tutorial, When are you releasing remaining Part of CRUD
We will release by next week. Please subscribe to our channel and press the bell icon to stay updated
@@AxleWebTechnologies That's really great. I will be waiting for fior this.
Hi I need to get some data from tow tables
first table "cust_tbl" has (name, email, id )
and balance table Has the (id, cust_id, balance)
so how i can show the customer name with the ambulance ?
thanks
just need the query
Select * from cust_tbl,bulnce_tbl ****?
Thanks
is it free price for develop with external database like mysql from hosting??
There might be some charge depending on where are you hosting MySQL
Thank you for this tutorial, very informative. However, there are some issues when using Google Cloud SQL (mysql)... and apparently I can't make it work. Do you have any thoughts on how can I fix this? Thank you
Few things to check
1. Make sure your billing account is enabled
2. Make sure that fulfillment option is enabled in the intent
3. Make sure remote access is allowed for the MySQL Database
@cyberpau were you able to solve using Google Cloud SQL (mysql)? Please let me know it would be very helpful been stuck there, not able to connect using dialogflow though my database accepts remote connections.
@@AxleWebTechnologies Hey Anshul all these have been enabled but still not able to connect using Google Cloud SQL (mysql), though i'm able to set up and use through firebase, can you please help :/
My COde:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
const {mysql}= require('mysql');
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 to my agent!`);
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
function connectToDatabase(){
const connection = mysql.createConnection({
host : 'xx.xx.xxx.xxx',
user : 'user',
password : 'pwd',
database : 'db'
});
return new Promise((resolve,reject) => {
connection.connect();
resolve(connection);
});
}
function queryDatabase(connection){
return new Promise((resolve, reject) => {
connection.query('select *from user', (error, results, fields) => {
resolve(results);
console.log("connections success");
});
});
}
function handleReadFromMySQL(agent){
const user_email = agent.parameters.email;
return connectToDatabase()
.then(connection => {
return queryDatabase(connection)
.then(result => {
console.log(result);
result.map(user => {
if(user_email === user.email){
agent.add(`First Name: ${user.firstname} and Last Name: ${user.lastname}`);
}
});
connection.end();
});
});
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('getDataFromMySQL', handleReadFromMySQL);
// intentMap.set('your intent name here', yourFunctionHandler);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});
Error :
"webhookStatus": {
"code": 14,
"message": "Webhook call failed. Error: UNAVAILABLE."
}
Hi, can you help me, i'm getting this error "Webhook call failed. Error: DEADLINE_EXCEEDED." Also in logs in the google cloud console I received this Warning, "FIREBASE_CONFIG environment variable is missing. Initializing"
Deadline exceeded means your webhook code did not responded back within 5 seconds. Try to reduce the processing you are doing in your code/logic. Also if there is an external API call, please make sure your external api responds within 5 seconds.
If you still face any issue, please send an email to dialogflow.team@axlewebtech.com with error logs and screenshot of errors you are facing. Someone from our team will help you.
it seems like it is not working on a shared server. I tried using 31.31.196.194:2082 but didn't work for me.
Could this work for querying information from a mySQL DB that is not part of a predefined/ system entity
Yes absolutely, You can fetch any information from mySQL. There is no correlation between system entities and mySQL database information.
Hi, i did everything you said, but i get this error
TypeError: result is not a function
at queryDatabase.then.result
result should be declared in callback function.
Hi Anshul,
Can we do the same with mssql connection?
You can create an API which is connected to your MSSQL database and then you can connect your Dialogflow agent to MSSQL using those APIs. We haven't tried connecting Dialogflow directly to MSSQL so not sure about that.
@@AxleWebTechnologies thats good too. Thank you for your guidance.
Hello Axle! i got undefined too. I dont know how to get the host name using phpmyadmin mysql service, there is a way that i can do that without hostgator? thanks in advance
Your server IP address should be your hostname, you can contact hostgator support to get these details. You can try connecting to MySQL from Workbench, Navicat or Sequel Pro before connecting through Dialogflow. One more thing, you need to enable remote access to your MySQL database to the remote IP. Please refer to this article: www.hostgator.com/help/article/how-to-connect-to-the-mysql-database-remotely
After implementing according to your tutorial getting following error:
"handleRequest must contain a map of Dialogflow intent names to function handlers"
Please help me I am fully stuck.
make sure you put correct intent name in the intent handler function.
I have this error
The deployment of your Cloud Function failed:
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: ReferenceError: agent is not defined
at Object. (/srv/index.js:115:3)
What can i do?
Looks like something messed up. Try creating a new Dialogflow agent and do the steps again.
i have use xampp for phpmyadmin what to do?
Hi. Your video is great. I follow step by step the video but after typing the email the default response "not available" and I get this error Webhook call failed. Error: UNAVAILABLE. Could you help me with that? Thankyou
There could be several reasons for this error. Please share the console logs. You can join our Slack Channel for quick discussion.
@@AxleWebTechnologies Yes, how can I join the slack channel?
Please join the slack channel using below link and post your queries in the channel:
join.slack.com/t/dialogflow-awt/shared_invite/enQtOTUwMzAwOTI3Mjk2LWRiOGYwOGIyOGU4ZjNkNWI3NTJiMTgyMmMyNTM2OWE2YzZmZjkwNmEyMWZmOWIyZTRmNzY3MTY2ZDYzNWVhYzQ
Hi sir. Thank you for nice tutorials. I followed step explained in the video but facing some issue
Error is: ECONNREFUSE error
Looks like your MySQL database is refusing to connect. You have to enable remote access to your MySQL database.
Hi! I have followed your tutorial, but in minute 13:00, I don't have a message like you in Firebase Functions, and when I type MySQL, I don't get any result in Functions, any suggestion?
and in fulfillment status is : Webhook call failed. Error: UNKNOWN.
There could be couple of things that might cause the issue. Please check the following
1. Have you enabled the billing account
2. Have you enabled the fulfilment option in the intent
3. Have you added console.log in your code
4. Have you added mysql package in package.json?
Try these and let me know if it still doesn't works.
@@AxleWebTechnologies I have to do all the things, still cannot connect, can you see it?
@@AxleWebTechnologies I don't get any RowDataPacket in 13:14
@@agung4834 I have the same problem ,can you help me to solve
what if I want to get all the rows that have the same namel
so maybe 3 people with same name
and that gives me 3 emails for 1 response how to achieve that?
You can loop through responses and add agent.add for each response
May I ask you .log file that show dialogflowFirebaseFulfillment undefined. how can I sovle it.
Update Error: Cannot enqueue Handshake after already enqueuing a Handshake.
@@SuTtIk0rN look for my previous comment
some extra code/lines are used but not showing in your video. I have followed your videos step by step but still showing me like "results not defined". Here "results" is the variable used
Please refer to the code here and make sure there are no errors in your code. gist.github.com/Anshul0305/aace32e8eabcb2ef49835d0079091e00
Also if possible, share your code so that I can have a look.
Hi, first of all great tutorial and tnks, now i followed step explained in the video but facing some issue 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)
Please share the source code for index.js file with anshul.shrivastava@axlewebtech.com, I will have a look ~ Anshul
i need have the Enterprise Edition
Essentials plan activate?
You just need to enable the billing account.
Hi, Can you help I am getting below error, have tried all and can't figure it out...I turned on SSH at my server Side but Still not working.
"webhookStatus": {
"code": 13,
"message": "Webhook call failed. Error: 500 Internal Server Error."
Looks like some problem in your code. Please check firebase console logs. That might help.
@@AxleWebTechnologies I am using your code on Github the same way just query and Sever credentials changed. See error from the firebase console. Please let me know if I contact you directly. Please share your contact.
TypeError: Cannot read property 'map' of undefined
at queryDatabase.then.result (/srv/index.js:118:16)
at
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
I want to query my database to see if certain data is there or not and if it isn't I want a response to be given how do I do that please help
I tried an if statement but it still didn't work
Please try asking your query on stackoverflow with the full code and paste the link to your question here. Need to see your code in order to help you.
I am repeatedly getting this error along with unhandled rejection
TypeError: Cannot read property 'map' of undefined
at queryDatabase.then.result (/srv/index.js:72:17)
at
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Maybe you need to enable remote access to your mysql database. Try login to your control panel and follow the steps as mentioned in the below tutorial.
ua-cam.com/video/xXOq9U9fzOo/v-deo.html
@@AxleWebTechnologies Even enabling remote access it's with same error sir.
Hi i have this error
TypeError: Cannot read property 'map' of undefined
at queryDatabase.then.result (/srv/index.js:55:16)
at
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Looks like you are not getting the data back from mysql, please try adding console logs and try to log the results of queryDatabase function.
@@AxleWebTechnologies dialogflowFirebaseFulfillment
p7ea7wnqhj41
Connection { domain: Domain { domain: null, _events: { error: [Function] }, _eventsCount: 1, _maxListeners: undefined, members: [ [Object] ] }, _events: {}, _eventsCount: 0, _maxListeners: undefined, config: ConnectionConfig { host: '162.241.2.113', port: 3306, localAddress: undefined, socketPath: undefined, user: 'tendenc6_trackin', password: 'tracking100', database: 'tendenc6_tracking', connectTimeout: 10000, insecureAuth: false, supportBigNumbers: false, bigNumberStrings: false, dateStrings: false, debug: undefined, trace: true, stringifyObjects: false, timezone: 'local', flags: '', queryFormat: undefined, pool: undefined, ssl: false, localInfile: true, multipleStatements: false, typeCast: true, maxPacketSize: 0, charsetNumber: 33, clientFlags: 455631 }, _socket: Socket { connecting: true, _hadError: false, _handle: TCP { reading: false, owner: [Circular], onread: [Function: onread], onconnection: null, writeQueueSize: 0 }, _parent: null, _host: null, _readableState: ReadableState { objectMode: false, highWaterMark: 16384, buffer: [Object], length: 0, pipes: null, pipesCount: 0, flowing: true, ended: false, endEmitted: false, reading: true, sync: false, needReadable: true, emittedReadable: false, readableListening: false, resumeScheduled: false, destroyed: false, defaultEncoding: 'utf8', awaitDrain: 0, readingMore: false, decoder: null, encoding: null }, readable: false, domain: Domain { domain: null, _events: [Object], _eventsCount: 1, _maxListeners: undefined, members: [Array] }, _events: { end: [Array], _socketEnd: [Function: onSocketEnd], data: [Function], error: [Function: bound ], connect: [Array], timeout: [Object] }, _eventsCount: 6, _maxListeners: undefined, _writableState: WritableState { objectMode: false, highWaterMark: 16384, finalCalled: false, needDrain: false, ending: false, ended: false, finished: false, destroyed: false, decodeStrings: false, defaultEncoding: 'utf8', length: 0, writing: false, corked: 0, sync: true, bufferProcessing: false, onwrite: [Function: bound onwrite], writecb: null, writelen: 0, bufferedRequest: null, lastBufferedRequest: null, pendingcb: 0, prefinished: false, errorEmitted: false, bufferedRequestCount: 0, corkedRequestsFree: [Object] }, writable: true, allowHalfOpen: false, _bytesDispatched: 0, _sockname: null, _pendingData: null, _pendingEncoding: '', server: null, _server: null, _idleTimeout: 10000, _idleNext: TimersList { _idleNext: [Circular], _idlePrev: [Circular], _timer: [Object], _unrefed: true, msecs: 10000, nextTick: false }, _idlePrev: TimersList { _idleNext: [Circular], _idlePrev: [Circular], _timer: [Object], _unrefed: true, msecs: 10000, nextTick: false }, _idleStart: 65789, _destroyed: false, [Symbol(asyncId)]: 87, [Symbol(bytesRead)]: 0, [Symbol(asyncId)]: 91, [Symbol(triggerAsyncId)]: 81 }, _protocol: Protocol { domain: Domain { domain: null, _events: [Object], _eventsCount: 1, _maxListeners: undefined, members: [Array] }, _events: { data: [Function], end: [Array], handshake: [Function: bound _handleProtocolHandshake], initialize: [Function: bound _handleProtocolInitialize], unhandledError: [Function: bound ], drain: [Function: bound ], enqueue: [Function: bound _handleProtocolEnqueue] }, _eventsCount: 7, _maxListeners: undefined, readable: true, writable: true, _config: ConnectionConfig { host: '162.241.2.113', port: 3306, localAddress: undefined, socketPath: undefined, user: 'tendenc6_trackin', password: 'tracking100', database: 'tendenc6_tracking', connectTimeout: 10000, insecureAuth: false, supportBigNumbers: false, bigNumberStrings: false, dateStrings: false, debug: undefined, trace: true, stringifyObjects: false, timezone: 'local', flags: '', queryFormat: undefined, pool: undefined, ssl: false,
@@AxleWebTechnologies this is the logs for the connection
Awesome
Permission denied (HTTP 403): Cloud Functions API has not been used in project 647263654951 before or it is disabled
Try enabling cloud functions API. You can do a google search to know how to do that.
Why you don't use this query instead to save some code lines "select name, lastname from users where email='agent.parameters.email'? It's more efficient
Yes definitely you can do the refactoring like that. My main purpose was to make it easier to understand so that even beginners can understand.
@@AxleWebTechnologies oh I got it, thank you for explaining. I like your videos I really hope you can continue with some advanced querys for better user experience. Something like when the user says "I want to see the users created yesterday" or " I want to se the older user name", it's just a suggestion. Thanks in advance
Hi can you help..
This error keeps popping up
dialogflowFirebaseFulfillment
Function execution took 60003 ms, finished with status: 'timeout'
nvm I found the answer.. please check your code before you run it guys..
anyway.. new problem.. the results is undefined.. help please
@@shekanyasetijo5695 what is the solution?
@@shekanyasetijo5695 even i am facing this error and also this error { Error: connect ETIMEDOUT at Connection._handleConnectTimeout
Please help me out if you will get the solution. Thanks in advance
Can I do that with php webhook?
Yes, you can do
Hi Anshul, Please help me out with this..
TypeError: Cannot read property '0' of undefined
at queryDatabase.then.result (/srv/index.js:56:35)
at
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
Can you please share the code of index.js file
@@AxleWebTechnologies
here it is..
// See 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 mysql=require('mysql');
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 to my agent!`);
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
function connectToDatabase(){
const connection=mysql.createConnection({
host:'185.27.134.162',
user:'epiz_26025202',
password:'YerusJbltT7N34',
database:'epiz_26025202_Botdata'
});
return new Promise((resolve,reject) =>{
connection.connect();
resolve(connection);
});
}
function queryDatabase(connection){
return new Promise((resolve,reject) =>{
connection.query('SELECT * from demo',(error,results,fields) => {
resolve(results);
});
});
}
function handlereadfromMysql(agent) {
return connectToDatabase()
.then(connection => {
return queryDatabase(connection)
.then(result => {
console.log(result);
agent.add(`Fname: ${result[0].fname}`);
connection.end();
});
});
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('getDataMysql', handlereadfromMysql);
// intentMap.set('your intent name here', yourFunctionHandler);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});
Did you enabled remote access for your MySQL database?
@@AxleWebTechnologies will it be possible with infinityfree.net/ ?
i am using it for learning and testing
Not sure about that please check with their customer service team
what can this error be
TypeError: Cannot read property 'map' of undefined
at queryDatabase.then.result (/srv/index.js:54:16)
at
at process._tickDomainCallback (internal / process / next_tick.js: 229: 7)
Check line number 54. Array on which you are calling .map is null or undefined.
hi, i have project can help me
Hi, I am getting this error while connecting my local Mysql. Can you help with this
Error: { Error: connect ECONNREFUSED 127.0.0.1:3306 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14) -------------------- at Protocol._enqueue (/srv/node_modules/mysql/lib/protocol/Protocol.js:144:48) at Protocol.handshake (/srv/node_modules/mysql/lib/protocol/Protocol.js:51:23) at Connection.connect
You cannot connect you dialogflow with MySQL server running on localhost. There are couple of things you can do
1. host the SQL server on cloud such as AWS or Google cloud
2. tunnel your localhost using ngrok or similar tool
@@AxleWebTechnologies Thank you for the help
Would that also work with voicebot?
Yes, it will work. Which voicebot, are you referring to?
@@AxleWebTechnologies dialogflow voicebot that's what we settled on during brainstorm
@@AxleWebTechnologies We are also using a SIP called Voximplant to call the voicebot from a cellphone to order pizza from a restaurant (college project)
@@jonaszprzybycien6545 Please watch our another video on how to integrate Dialogflow with Voximplant.
i am unable to open the control panel in hostgater .please help me
Please contact hostgator support for that.
hi anshul can you help me, i tried the tutorial you gave and got an error "unhandle rejection" and "Cannot read property 'map' of undefined at queryDatabase.then.result", can you check my code that will be sent via email thank you, sorry my english is bad
hey anshul (@axle) I have sent you an email, please check it. Thank you
Hello Choirul, I have replied to your email. Looks like your database is not remotely accessible. Please check this link to enable remote access: www.hostgator.com/help/article/how-to-connect-to-the-mysql-database-remotely
{ Error: connect ETIMEDOUT at Connection._handleConnectTimeout I am facing this error please help me out sir
and another error is undefined i don't know what it is?
Solution found:
use socketPath instead of host like this
socketPath : '/cloudsql/[instance-connection-name]'
socketPath: '/cloudsql/charbot2-ivjagp:asia-south1:auction-instance',
user : '',
password : '',
database : 'db'
Note : solution for google cloud mysql users only
Glad you found a solution.
@@AxleWebTechnologies but for hostinger mysql database ,how to solve that problem
@@AxleWebTechnologies
hello, I am using your github code, I am using GCP Mysql, I have access from the Mysql Workbench client and still I get as an "undefined" answer in the firebase console and in dialogflow diagnostic info I get Webhook call failed. Error: DEADLINE_EXCEEDED.
Can someone help me with the problem?
Hello bro, I need Google Cloud with Billing? I have my SQL but no billing in google cloud
just set your billing account and you will receive a free trial for a year(with 300$ credits) and then 'buy' the Flame package in Firebase and it's OK!
@@arnedevroede4311 Yeah bro but i dont have a card, i just have a prepaid and google cloud dont accept it:(
Check with your bank, some bank provides virtual cards with some prepaid balance. Hopefully you can use such virtual card.
@@AxleWebTechnologies but google cloud is not accepting virtual cards
hi,
I have the impression that my database does not communicate with dialogflow
Yes may need to enable remote access to your mysql database.
@@AxleWebTechnologies
already, I added my public ip address but still nothing
Hi IAM getting error " webhook call failed : DEADLINE_EXCEEDED
You get this error when either API call in your webhook fails for some reason or if API call takes more than 5 seconds to respond
I am getting this error : Webhook call failed. Error: DEADLINE_EXCEEDED.
This error means something went wrong in your webhook code
@@AxleWebTechnologies hello, I am using your github code, I am using GCP Mysql, I have access from the Mysql Workbench client and still I get as an "undefined" answer in the firebase console .Can someone help me with the problem?
@@devantryxdev569 Can you please share some code, need to have a look at the code to understand what might be the issue.
I keep getting undefined as a response in my execution logs
me too
did you find a solution to this?
Shekanya Setijo I had to host my database on a free hosting site
Make sure you have enabled remote access. Try following steps in the following video. Try using %.%.%.% for remote IP.
ua-cam.com/video/xXOq9U9fzOo/v-deo.html
hello, my problem was not resolute
Please drop an email to anshul.shrivastava@axlewebtech.com, we will have a look.
@@AxleWebTechnologies the mail don't pass
Hello Friends, our Udemy course is out now. Please check it out here:
www.udemy.com/course/mastering-dialogflow-build-smart-chatbots-using-dialogflow/?referralCode=F2B97D95121392E3FFAE
We just published this course and we will keep refreshing this course with the latest Dialogflow tutorials. Please subscribe to our Udemy course now.
Sir connecting to mongo DB will be better ... this was good but you know how NO-SQL is famous.
We have a video on Dynamo DB and Firebase Database. Please watch that on our channel.
Hello, your video is very good, it helps me, in this code there is an example of data validation in mysql.
Example: ReadMySQL query, when it doesn't find the request.
if(user_cpf === user.cpf){
agent.add(`First name: ${user.first_name}: Last name: ${user.last_name}`);
}
ELSE {USER NOT FINDER}
Connection TimeOut Error { Error: connect ETIMEDOUT
at Connection._handleConnectTimeout
I am also facing this error, please help me out if you will get the solution
Solution found:
use socketPath instead of host like this
socketPath : '/cloudsql/[instance-connection-name]'
socketPath: '/cloudsql/charbot2-ivjagp:asia-south1:auction-instance',
user : '',
password : '',
database : 'db'
Note : Solution is only for google cloud mysql users only
please help me
starting this moment 16:15 my agent just response "Not available". I have the exactly same code that you have on github.
Make sure you have enabled fulfillment option in your intent, make sure you have billing account enabled and also make sure the IP address from which you are accessing the database is whitelisted in database hosting.
@@AnshulShrivastavaOnline Al ready checket it. when I comment out the lines 55, 56, 58 and 59 (Github). The agent respose again in the console. I can't find the problem. Sorry, my English isn't good.
Looks like something is wrong with Parameters. Please send an email to anshul.shrivastava@axlewebtech.com (or share your agent with this email address), I will have a look.
@@AxleWebTechnologies I already shared it! I Thank you
@@RDBC379 I fixed it please check now.
Up
Hi!...i have this error log:
dialogflowFirebaseFulfillment
Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail
I see that yo have a FireBase configuration but you don`t explain this part. Can you help me with that? Thanks!
This is a common warning. You can ignore it.
I got this error when I deploy it "Warning, estimating Firebase Config based on GCLOUD_PROJECT. Initializing firebase-admin may fail". Can you help me?
This is not an error but just a warning. You can ignore this. Ideally this should work for you. If this is not working, there might be some other error.
@@AxleWebTechnologies I love your channel! Thanks a lot