Debugging the webhook on a local machine - SilasBerger/coachbot-brain GitHub Wiki

To be integrated with Dialogflow, the webhook needs to be publicly available. However, debugging is significantly harder for an instance of an application that is running on e.g. Heroku. We can therefore use a connection tunneling service called ngrok. Create an account on ngrok.com, and follow the download, install, and usage instructions. With ngrok, we can tunnel public connections to our local machine. For example, we can setup a tunnel using ngrok http 3000. This will generate a public URL, which forwards HTTP connections on port 3000 to our local port 3000 (where for example our Node server might be running in debug mode). Note that ngrok is free, but will always generate a new throw-away URL when started. This URL needs to be adjusted in the Dialogflow Fulfillment section every time ngrok is started anew. When starting ngrok at the beginning of a development session and keeping it running until the end, that means this URL has to be adjusted once a day.