Tutorial

TradingView Webhook Tutorial: Set Up Webhook Alerts Step by Step

TradeAlert.Pro Team
11 min read

A TradingView webhook lets an alert do something outside TradingView: ring your phone, post to a Telegram or Discord channel, or hand a signal to a trading bot. This tutorial covers the whole setup, from the URL field to the message format, testing, and the limits that make webhooks fail when nobody tells you.

The examples use TradeAlert.Pro, which turns a webhook into a phone call, but every TradingView step is the same whatever service receives the alert.

What is a TradingView webhook?

A webhook is a URL that TradingView sends an HTTP POST request to the moment your alert triggers. The body of that request is your alert message.

  • If the message is valid JSON, TradingView sends it with the application/json content type.
  • Anything else is sent as text/plain.

TradingView fires alerts from its own servers, so a webhook goes out even when your browser, the TradingView app and your computer are all closed. What happens next is up to the service at the other end of the URL.

What you need

  • TradingView Essential or higher, with 2FA. Webhooks are not available on the free Basic plan, and TradingView only allows webhook alerts once 2-factor authentication is on.
  • A URL that receives the alert. This could be a phone call service, a Discord webhook, a Telegram bot, or your own server.
  • About ten minutes.

Step 1: Get a webhook URL

Where the URL comes from depends on what you want the alert to do:

You wantWhere the URL comes from
A phone callA phone call service such as TradeAlert.Pro gives you a personal URL
A Telegram messageYour own Telegram bot's sendMessage address
A Discord messageA webhook created in your Discord server's settings
A trading bot or scriptThe bot's documentation, or your own server

Not sure which to pick? Telegram vs Discord vs phone call for TradingView alerts compares setup, reliability, speed and cost.

For a phone call with TradeAlert.Pro:

  1. Sign up with your phone number, then take the test call at the top of the dashboard: answer it and press 1 to verify the number.
  2. In the dashboard, find Your Webhook URL and click Copy.

The URL looks like this:

https://www.tradealert.pro/hook/YOUR_USERNAME/YOUR_API_KEY

Keep the www: TradingView does not follow redirects, and the address without it redirects, so alerts sent there are lost.

The last part is a secret API key, so treat the whole URL like a password.

Step 2: Turn on 2FA in TradingView

If 2-factor authentication is already on, skip ahead.

  1. Log in to TradingView and open your profile settings.
  2. Go to the Security section.
  3. Turn on two-factor authentication and scan the QR code with an authenticator app.
  4. Enter the 6-digit code to confirm, and keep the backup codes somewhere safe.

Step 3: Create the alert and paste the URL

  1. Open the chart you want to watch and click the Alert button (the clock icon), or press Alt + A.
  2. Set the condition: a price level, an indicator, a drawing, or a Pine Script alert.
  3. Choose the trigger frequency:
    • Only once fires one time and then the alert stops.
    • Once per bar fires the first time the condition is true inside a bar, even if the bar later closes the other way.
    • Once per bar close waits for the bar to close, so it fires less often and ignores wicks that reverse.
    • Once per minute caps a fast condition at one trigger a minute.
  4. Check the expiration. A standard alert lives at most two months; Premium and Ultimate plans also offer an open-ended option.
  5. Open the Notifications tab, tick Webhook URL, and paste your URL into that field. The URL goes in the URL field, not in the message.
  6. Write the message (next step) and click Create.

One alert can send to one webhook URL. To reach two services, create two alerts with the same condition.

Step 4: Write the alert message

The message is the webhook body, so its format depends on what the receiver expects.

Placeholders

TradingView replaces placeholders in double curly braces with live values when the alert fires:

PlaceholderBecomes
{{ticker}}The symbol, such as BTCUSD
{{exchange}}The exchange, such as BINANCE
{{close}}The bar's close (the current price on an open bar)
{{open}}, {{high}}, {{low}}The bar's open, high and low
{{volume}}The bar's volume
{{interval}}The chart timeframe
{{time}}The bar's open time
{{timenow}}The time the alert fired
{{strategy.order.action}}"buy" or "sell" (strategy alerts only)

Plain text or JSON?

Plain text is enough for a phone call or a simple notification:

{{ticker}} crossed {{close}} on the {{interval}} chart

JSON is for receivers that read named fields. Discord expects a content field, Telegram's bot API expects chat_id and text, and trading bots each have their own format.

Two rules keep JSON valid after the placeholders are filled in:

  • Put quotes around text placeholders: "ticker": "{{ticker}}".
  • Test the message once. If one quote is missing, the body is no longer JSON, TradingView sends it as plain text, and a receiver that needs JSON usually rejects it.

How TradeAlert.Pro reads the message

TradeAlert.Pro accepts both formats:

  • Plain text is read out as written. BTCUSD crossed 68450 becomes "TradingView alert: BTCUSD crossed 68450."
  • JSON with a ticker and a text (or action) field is read as an alert for that ticker. Add strategy.order_action set to buy or sell and the call says which:
{
  "ticker": "{{ticker}}",
  "strategy": { "order_action": "{{strategy.order.action}}" },
  "text": "Breakout strategy filled at {{close}}"
}

That message is spoken as "You have a buy signal for BTCUSD. Breakout strategy filled at 68450."

Tips for a message you will hear rather than read:

  • Keep it to one short sentence: the ticker, the level, what happened.
  • Leave out symbols such as |, # and @, which sound odd in text-to-speech.
  • Write numbers plainly. {{close}} is fine; long strings of codes are not.

Step 5: Test it before you rely on it

  1. Test the receiver. In the TradeAlert.Pro dashboard, the test-call button rings your phone through the same path a real alert uses. Your first test call is free; each one after that uses 1 credit.
  2. Test TradingView. Create an alert that will trigger right away, such as a price crossing a level just above or below the current price on an active market.
  3. Read TradingView's alert log. The log lists every trigger, and its Webhook status column shows whether TradingView reached your URL.
  4. Read the receiver's log. TradeAlert.Pro's dashboard keeps a call history of every alert it placed a call for.
  5. Delete the test alert.

If the call or message never arrives, work through TradingView alerts not working: causes and fixes, which goes through each failure point in order.

Limits that quietly break webhooks

These come from TradingView's own help pages and from TradeAlert.Pro's settings. None of them shows a warning when you create the alert.

LimitWhat happens
15 triggers in 3 minutesTradingView stops an alert that triggers more often than this
3-second response timeTradingView cancels the request if the receiving server takes longer
Ports 80 and 443 onlyURLs on any other port are rejected
IPv4 onlyTradingView does not support IPv6 for webhooks
Two-month alert lifetimeStandard alerts expire; open-ended alerts need Premium or Ultimate
One webhook URL per alertUse a second alert to reach a second service
10 webhooks a minute per TradeAlert.Pro accountExtra requests in the same minute are refused and do not ring

TradingView also says plainly that webhooks may occasionally fail to reach the URL. For an alert you cannot afford to miss, keep a second notification method on it, such as the TradingView app notification, alongside the webhook.

If you run your own server and want to accept only TradingView's traffic, TradingView publishes the addresses its webhooks come from: 52.89.214.238, 34.212.75.30, 54.218.53.128 and 52.32.178.7.

Webhooks from Pine Script

Pine Script alerts use the same webhook field. The difference is where the message comes from:

  • alertcondition() adds a condition you pick in the alert dialog, with a message you write there.
  • alert() sends a message built in the script, so it can include values the script calculated. Create the alert with the Any alert() function call condition.
  • Strategies can send order fills, and {{strategy.order.action}} tells the receiver whether it was a buy or a sell.

The Pine Script alert tutorial covers all three, and TradingView strategy alerts as phone calls walks through a strategy setup end to end.

Keep the webhook URL private

Anyone with your webhook URL can send alerts to it.

  • Do not post it in forums, screenshots or public code.
  • TradingView also warns against putting passwords or other credentials in the alert message.
  • If the URL leaks, regenerate the API key in the TradeAlert.Pro dashboard (once every 24 hours) and paste the new URL into each TradingView alert. The old URL stops working straight away.

Frequently asked questions

Can I use webhooks on the free TradingView plan?

No. Webhooks need TradingView Essential or higher, with 2FA. This is a TradingView rule, so it applies to every service that receives webhooks.

Do webhooks work when my computer is off?

Yes. Alerts run on TradingView's servers, so the webhook is sent whether or not you have TradingView open.

Can one alert send to two webhook URLs?

No. Each alert has one webhook URL field. Create a second alert with the same condition for the second URL.

Should my message be plain text or JSON?

Whatever the receiver expects. Plain text works for a phone call; Discord, Telegram's bot API and most trading bots need JSON.

How do I know the webhook was sent?

Open the alert log in TradingView. The Webhook status column shows whether TradingView reached the URL. Then check the receiving service's own log.

How much does a phone call alert cost?

TradeAlert.Pro is free for 3 calls a month with no card. Pro is $8 a month or $80 a year for 500 credits a month; each call, or SMS backup message, uses one credit.

Get your first webhook alert ringing

Set up the URL once and every TradingView alert you point at it becomes a phone call: a ringing phone with the alert read aloud, not a badge you find an hour later.

Start free with 3 calls a month

Related guides: