Image from DialogFlow
This is a simple Node+Express Webhook to test DialogFlow V2 APIs and mock a fulfillment webhook locally while meeting the requirements. It uses an npm version of ngrok to get a secure public url which is a core requirement for registering a webhook to DialogFlow. Depending on how the program is started, the requests or responses will be stored locally in a json file.
- Clone the repository and install the npm dependencies
git clone https://github.com/thinkty/dialogflow-tester.git
npm install
-
After downloading the dependencies, start the application with either
npm run request
to test requests from DialogFlow ornpm run response
to test sending responses from this application to DialogFlow. -
After successfully launching the application, in the terminal, there should be a secured (https) public url from
ngrok
. -
Copy the url and paste it in to the DialogFlow console. Go to
DialogFlow console > Fulfillment > Webhook
and paste the ngrok url in the url input field and click save. -
Click on
Save
and type into theTry it now
input field to test your webhook. Make sure to enable webhook in the Fulfillment section of the intent.
You can also modify the generateResponse
function to add your own payloads to the response back to DialogFlow.
MIT