How to run ngrok in background?

as described previously you can run ngrok in background with

./ngrok http 8080 > /dev/null &

next you can use curl and for example jq a command-line JSON processor.

export WEBHOOK_URL="$(curl http://localhost:4040/api/tunnels | jq ".tunnels[0].public_url")"

your URL will be accessible from $WEBHOOK_URL env variable and you can use it anywhere.

Leave a Comment