TradingView webhook alerts: JSON messages, placeholders and testing

TradingView sends a webhook as an HTTP POST with your alert message as the body: as JSON if the message is valid JSON, as plain text otherwise. Test the exact message in a free webhooks.sh bin before it reaches a bot: no signup, 48 hours, 100 requests a day.

A TradingView webhook is an HTTP POST of your alert message to a URL, and most failures come down to the message format: if the message isn't valid JSON, it goes out as plain text and your bot rejects it. The fastest way to run a TradingView webhook test is to drop a free bin URL into the alert, let it fire, and read the exact headers and body it sent. Below we cover the requirements TradingView enforces, how JSON vs plain text works, placeholders, retries, and how to check who sent the request.

Send a test alert to a free bin

  1. Create a free bin in your browser at view.webhooks.page or run curl -X POST https://webhooks.sh/v1/bins to get your ingest_url and view_url.
  2. Create or edit an alert in TradingView, turn on the webhook URL option, and paste the ingest URL (it's served over HTTPS on port 443, which TradingView accepts).
  3. Write the exact message you plan to send to your bot.
  4. Let the alert fire (a price alert close to the current price triggers quickly) and open your view URL to inspect the Content-Type header and the raw body.

Note that webhook alerts need a paid TradingView plan and 2-factor authentication turned on for your account. You can also use the curl command below to send the same kind of request yourself and test message formats without waiting for alerts to trigger.

# 1. Create a free bin (or open view.webhooks.page)
curl -X POST https://webhooks.sh/v1/bins

# 2. Send the request TradingView sends for a JSON message
curl -X POST "https://<bin>.webhooks.page/tradingview" \
  -H "Content-Type: application/json; charset=utf-8" \
  -d '{"ticker": "BTCUSD", "action": "buy", "price": "9000"}'

Requirements TradingView enforces

TradingView is strict about where it sends webhooks.

If your server or firewall filters incoming traffic by IP, make sure you allow all four of TradingView's source addresses, and keep in mind that an IPv6-only host won't receive anything.

RuleValue
PlanAny paid plan, not the free plan
Account security2-factor authentication must be on
Ports80 and 443 only, other ports are rejected
Timeout3 seconds, then the request is cancelled
ResendsUp to 3, 5 seconds apart, after a 5xx reply other than 504
IP versionIPv4 only, IPv6 isn't supported
Source IPs52.89.214.238, 34.212.75.30, 54.218.53.128, 52.32.178.7

JSON or plain text: why your bot rejects the alert

TradingView sets the Content-Type header based on the final message after placeholders are replaced: if the whole string is valid JSON, it sends application/json, and otherwise it falls back to text/plain. Plain text is the default alert message format, while most bots and chat apps want a TradingView webhook JSON payload, so a single stray quote or missing comma quietly turns the request into text/plain without any warning. Checking the Content-Type header in the bin viewer is the quickest way to catch this.

The classic trap is an unquoted placeholder that can return text instead of a number. For example, {{syminfo.basecurrency}} returns na when the symbol isn't a currency pair, which produces "base": na and breaks your JSON. Put quotes around every placeholder unless you're sure it always outputs a valid number.

Placeholders you can put in the message

TradingView swaps out placeholders for live values the moment the alert triggers.

Beyond the standard ticker and price fields, you can use {{plot_0}} through {{plot_19}} to pull values from indicator output series. Strategy placeholders like {{strategy.order.action}} or {{strategy.position_size}} only work in strategy alerts, and {{interval}} always returns 1 for simple price alerts because TradingView calculates those on 1-minute bars.

PlaceholderReturns
{{ticker}}Symbol, such as AAPL or BTCUSD
{{exchange}}Exchange, such as NASDAQ or CME
{{close}}Close of the bar the alert fired on
{{time}}Bar time in UTC, such as 2019-08-27T09:56:00Z
{{timenow}}Fire time of the alert, to the second
{{interval}}Chart timeframe, 1 for simple price alerts
{{strategy.order.action}}buy or sell (strategy alerts only)
{{strategy.order.contracts}}Contracts in the executed order
{{strategy.market_position}}long, flat or short
{
  "ticker": "{{ticker}}",
  "exchange": "{{exchange}}",
  "action": "{{strategy.order.action}}",
  "contracts": "{{strategy.order.contracts}}",
  "price": "{{strategy.order.price}}",
  "position": "{{strategy.market_position}}",
  "fired_at": "{{timenow}}"
}

Timeouts, resends and the alert log

TradingView gives your receiving server 3 seconds to respond before it cancels the request, so your code should reply right away and handle slow work like calling a broker or posting to chat afterwards. If your server returns a 500 to 599 status code other than 504, TradingView resends the webhook after 5 seconds, up to 3 times (meaning a single trigger can send up to 4 requests), so make your handler safe to run twice for the same alert.

You can check the Webhook status column in your TradingView alert log to see delivery results. Common errors include 3xx redirects, 4xx rejections like invalid JSON, timeouts over 3 seconds, TLS errors, or URLs that use localhost or resolve to a private IP. A webhooks.sh bin always replies with HTTP 200, which lets you separate message format problems from server problems; if requests still don't show up, read our webhook not received guide.

Check that requests come from TradingView

TradingView's help center gives you three ways to keep your receiver safe:

  • Filter traffic at your firewall or proxy to allow only the four TradingView webhook IP addresses.
  • Configure your server or reverse proxy to verify the SSL client certificate TradingView presents over HTTPS, which has CN webhook-server@tradingview.com and organization TradingView, Inc..
  • Keep secrets out of the payload, as TradingView warns against putting logins, passwords, or credentials in the webhook URL or message and notes that its alerts aren't designed for automated trading.

If you test with a bin, remember that the request body shows in full in the browser viewer, so anyone who has your full view_url can read whatever you put in the alert message.

Keep the URL or relay to localhost

A free bin lasts 48 hours and takes 100 requests a day, which is plenty to get your message format right, and you can claim it with a free Google sign-in to keep the same URL active with 30 days of rolling history.

Because TradingView can't reach localhost or private IPs, testing your own bot on your machine needs a public URL that relays to it. The Solo plan ($12 a month, detailed on our pricing page) gives you a persistent named endpoint on webhooks.host, and the wsh CLI relays live alerts straight to your local server with wsh listen <endpoint> --to localhost:3000; see our local webhook testing guide for the setup. Solo endpoints can also automatically forward each alert to up to 3 verified HTTPS URLs.

FAQ

Do TradingView webhooks need a paid plan?

Yes. Webhook notifications aren't available on TradingView's free plan (they require Essential, Plus, Premium, Expert, or Ultimate), and you must have 2-factor authentication enabled on your account.

Why does TradingView send my webhook as text instead of JSON?

Your message isn't valid JSON after TradingView fills in the placeholders, so it defaults to sending text/plain. Send an alert to a free bin and check the Content-Type header and raw body to see which value broke the syntax.

What IP addresses do TradingView webhooks come from?

TradingView sends all webhooks from four IPv4 addresses: 52.89.214.238, 34.212.75.30, 54.218.53.128, and 52.32.178.7.

Which ports can a TradingView webhook URL use?

Only ports 80 and 443 are accepted; TradingView rejects webhook URLs with any other port number.

Does TradingView retry failed webhooks?

Only when your server returns a 500 to 599 status code other than 504, in which case TradingView resends the alert up to 3 times, 5 seconds apart. Any request that takes longer than 3 seconds is cancelled.

Can I send TradingView alerts to localhost?

No, TradingView rejects URLs that use localhost or resolve to a private IP address. You need a public URL, and you can use the Solo plan's wsh CLI to relay alerts from a public webhooks.host endpoint to localhost.

Last updated

Try it in 10 seconds.

Create a free bin at view.webhooks.page — no signup, no install. Point your sender at the URL and watch requests land live. Bins expire after 48 hours.