Hi all. In this tutorials, we will work with webhook.
If you loss webhook define or any technical points then please check Part1 Part 2.
What need for build webhook?
+ Web server: local for testing
+ IDE tool: Visual Code (VS)
+ ngrok: for local testing
Let's go!
I. MAKE STRUCTURE FOR WEBHOOK
Step1. Setup NodeJS
You can skip this step if you have installed NodeJS berfore.
Follow steps for download and install NodeJS here
Step2. Create new project in VS and create package.json same below:
Open terminal on VS and typing: npm install
Step 3. Create app.js file with contains bellow:
Step 4. Run "node app.js" on terminal of VS and get result below.
II. CONNECT WEBHOOK TO DIALOGFLOW
Currently, your webhook is running on localhost. Dialogflow is online so we can not connect to local webhook.
What solution for this problem? ngrok
We will push local to online by using ngrok.
You can download and install ngrok here
Next step, open VS terminal and run "ngrok http 8080"
Forwarding http.... localhost:8080 is online URL for your local.
Copy https URL to clipboard.
Open dash board of Dialogflow project > Hit Fullfilment > Paste to Webhook URL* > Save
Typing anythings to "Try it now" of Dialogflow and you can see result on "Text response" session.
Now, I guest you can see:
"I didn't understand
I'm sorry, can you try again?"
That is done. We can connect your Dialogflow to webhook on your local machine.
In next post, we will build intent handle actions on webhook:
+ Find product
+ Order product
0 on: "Receptionist Bot (RB) using dialogflow - Part 3 (start with webhook)"