I am trying to call my Rest webhook from dialog flow console. I know it is feasible with deployment to any public ip.
But how to test the same without hosting the webhook to any public IP, and test it via localhost:8080/webhook?
I am trying to call my Rest webhook from dialog flow console. I know it is feasible with deployment to any public ip.
But how to test the same without hosting the webhook to any public IP, and test it via localhost:8080/webhook?
You can't do this - Dialogflow needs a public HTTPS server to access.
Fortunately, you can use a tool such as ngrok, which will create a tunnel between your machine and a public host name/address. You run ngrok on your localhost and tell it what local port your server is on. It will display a hostname that you can plug into Dialogflow. As long as you keep ngrok running locally, you'll have that address.
Run your local host server as you do.
Then download the following utility.
Then unzip it and you will get a ngrok binary.
Then run, ngrok http portnu
here port number is the one where your local webserver is listening.
On running the above command, ngrok will provide a http as well as a https public url. Use that public url as your fulfillment logic on dialog flow console. And now you have a local webhook running.
You can use Webhook Relay (https://webhookrelay.com) to create webhook forwarding tunnels:
$ relay forward -b webhook-demo http://localhost:8080/webhook
Forwarding:
https://my.webhookrelay.com/v1/webhooks/5e722a5e-f3d2-4hqec-9e9f-79f1158e4b10 -> http://localhost:8080/webhook
starting webhook relay agent..
Endpoints are permanent (until you delete them) and it is also possible to inspect webhook body, retry them or fan-out webhooks to more than one destination.