Facebook DialogFlow MongoDb Node.js Pizza Ordering Bot:
Documentation:Facebook DialogFlow MongoDb NodeV2.docx
Reference: 1. https://blog.pusher.com/facebook-chatbot-dialogflow/ 2. https://girliemac.com/blog/2017/01/06/facebook-apiai-bot-nodejs/
Follow reference 1.
1.Expose your server to the web in a separate terminal.
./ngrok http 5000
- Set up a Facebook application
create a variables.env file in the root of your project directory. You should add this file to your .gitignore so that you do not commit it to your repository by accident. Here’s how your variables.env file should look like:
FACEBOOK_ACCESS_TOKEN=EAAghLzgZCMfEBAJntS...
DIALOGFLOW_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n<KEY>\n-----END PRIVATE KEY-----\n"
DIALOGFLOW_CLIENT_EMAIL=foo@<PROJECT_ID>.iam.gserviceaccount.com
3.Set up Dialogflow integration
4.Create your own chatbot intents
5.Save the data to database MongoDB.
6.Run your application with command node src/index.js after installing all dependencies listed in the package.json file.
7.Error: listen EADDRINUSE: address already in use :::5000 then type the following command: sudo killall -s KILL node