← All posts
Automation · Alerts·June 2026·8 min read

Send TradingView Alerts to Telegram or Discord (2026)

Step-by-step guide to forward TradingView alerts to Telegram or Discord using webhooks and Pine Script. Includes code examples and troubleshooting tips.

dkcodenut — Pine Script & MQL5 developer
By dkcodenut — Pine Script & MQL5 developer since 2014
Published June 2026 · Last updated June 2026 · 8 min read

Getting TradingView alerts as a quiet email in your inbox 20 minutes after the signal fires is useless. In 2026 the standard is real-time push to Telegram or Discord — usually with a price, ticker, and a direct chart link. Here's the full setup using TradingView webhooks and Pine Script's alert() function.

TradingView webhook setup — the basics. Webhooks require a TradingView Pro plan or higher (the free plan does not allow webhook URLs). When you create an alert, fill in the Webhook URL field and tick Webhook notifications. TradingView will POST the alert message body as JSON (or plain text, your choice) to that URL the moment the alert fires. Set the frequency to Once Per Bar Close to avoid double-firing on intra-bar wiggles.

Option A — Send alerts to Telegram. Telegram doesn't accept TradingView webhooks directly because it requires a chat_id parameter in the URL. You have two clean options: (1) Use a relay like webhook.site → a tiny Cloudflare Worker / Vercel function that forwards to Telegram, or (2) Use a paid service like Wickhook or ChartAlerts. The DIY route: create a bot with @BotFather to get a bot token, send any message to your bot, then call https://api.telegram.org/bot<TOKEN>/getUpdates to find your chat_id. Your relay endpoint forwards the TradingView payload to https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=<ID>&text=<message>.

Option B — Send alerts to Discord (easier). Discord accepts TradingView webhooks natively. In Discord, open the target channel → Edit Channel → Integrations → Webhooks → New Webhook → Copy URL. Paste that URL directly into TradingView's Webhook URL field. Set the alert message to a JSON body like { "content": "BUY {{ticker}} at {{close}}" } and Discord will post it as a normal message in the channel.

Pine Script alert() with dynamic messages. Inside your strategy or indicator, replace static alertcondition() blocks with the modern alert() call so you can interpolate live values. Example: if (longCondition) alert('{"ticker":"' + syminfo.ticker + '","price":' + str.tostring(close) + ',"action":"buy"}', alert.freq_once_per_bar_close). TradingView will substitute {{close}}, {{ticker}}, {{interval}}, {{exchange}}, {{timenow}} in the alert message field if you use those placeholders instead.

Adding chart links and screenshots. Append https://www.tradingview.com/chart/?symbol={{exchange}}:{{ticker}} to your message so Telegram or Discord recipients can jump straight to the live chart. Discord auto-embeds the link with a preview; Telegram shows it as a clickable URL.

Common errors and fixes. 'Webhook URL is invalid' → make sure the URL starts with https:// and points to a real public endpoint, not a localhost address. Duplicate messages → alert frequency set to Once Per Bar instead of Once Per Bar Close. Telegram silent failure → wrong chat_id, or you never sent the first message to the bot from your own account (Telegram requires you to start the conversation). Discord message blank → the JSON body is invalid; the 'content' field must be a string, not an object. 429 Too Many Requests → Telegram/Discord rate-limited you; throttle alerts or batch them.

Need custom alert logic built? dkcodenut builds Pine Script with custom alert payloads, multi-channel routing (Telegram + Discord + 3Commas at the same time), and webhook relays hosted on Cloudflare for free. WhatsApp +91 7620 116 390 or Telegram @dk_codenut for a fixed-price quote. Related reading: How to Automate a TradingView Strategy with 3Commas Using Webhooks and How to Automate with PineConnector.