Receive TradingView Webhooks Locally

Use Python (Flask) to create a simple HTTP server that listens for POST requests.
Then, use Ngrok to expose your local server to the internet through a secure tunnel.

When you run Ngrok, it will provide a public HTTPS URL like:
https://abc123.ngrok.iohttp://localhost:5000

Copy this URL and paste it into the Webhook URL field in TradingView. That’s it!
And the good thing is Kite Connect Personal APIs are free for placing orders.

@Matti , is there any security risk in exposing our local server to the internet using this method?

2 Likes

Yes, exposing your local Flask server with Ngrok is convenient for development or testing, but it does come with security risks.

Key concerns include:

  • Direct Internet Access: Ngrok creates a public tunnel that bypasses your firewall. Anyone with the link can reach your Flask server. If the webhook endpoint lacks validation, attackers could send malicious data.

  • URL Guessing & Scanning: Ngrok URLs may seem random, but attackers use bots to scan for live tunnels. If found, they could probe for vulnerabilities in your app.

  • Phishing & Abuse: Ngrok has been misused to host fake login pages or malware, which could affect your tunnel’s reputation or get it flagged.

  • Firewall Bypass: Because Ngrok opens an outbound tunnel, your network firewall can’t filter incoming requests like it usually would.

  • Shared IP Reputation: Free Ngrok tunnels share IPs. If someone else using that IP does something malicious, your tunnel might get blocked.

  1. Don’t Share Your Ngrok URL Publicly
  2. use HTTPS via Ngrok
  3. Add a Secret Key => Make TradingView to send a Secret Key in the payload
  4. Validate Payload Format
  5. Add Basic Auth => ngrok http -auth=“user:pass” 5000
  6. Add a Random Token to URL
  7. Use a Local Reverse Proxy (eg: NGINX)

use alternative like: cloudflared

@Matti and @nivas_k it’s still not secure?

This reduces exposure, but no setup is ever 100 % foolproof.

isn’t that good.

so @nivas_k what you proposed to make it 100 % foolproof.
Is there any other way to receive TradingView Webhooks locally?