---
title: "TradingView webhooks | WebhookRelay"
meta:
  "og:description": "Learn how to integrate TradingView with Discord to automate trading alerts. Step-by-step guide for connecting TradingView alerts to your preferred destinations."
  "og:title": "TradingView webhooks"
  description: "Learn how to integrate TradingView with Discord to automate trading alerts. Step-by-step guide for connecting TradingView alerts to your preferred destinations."
---

![Stripes](https://webhookrelay.com/blog/trading-view/images/stripes.svg)

# **TradingView webhooks**

Learn how to integrate TradingView with Discord to automate trading alerts. Step-by-step guide for connecting TradingView alerts to your preferred destinations.

[TradingView](https://www.tradingview.com/) is a popular charting platform and social network for traders and investors that provides tools for technical analysis of financial markets. It offers customizable charts, over 100 technical indicators, drawing tools, and a community forum to share and discuss trading ideas. Users can also connect their brokerage accounts to trade directly on the platform

Webhook Relay allows to receive, transform and forward webhooks to multiple destinations. In this tutorial we will show how to use it to receive webhooks from TradingView and send them to Discord.

## [Setup Discord to receive webhooks](#setup-discord-to-receive-webhooks)

We will be sending webhooks to Discord. Get your Discord webhook URL from here:

![Create discord webhook](https://webhookrelay.com/blog/trading-view/images/blog/tradingview/discord.png)

Copy it, we will use it in Webhook Relay.

## [Setup Webhook Relay](#setup-webhook-relay)

1. Open [https://my.webhookrelay.com/new-public-destination](https://my.webhookrelay.com/new-public-destination) and add the URL we copied from Discord. To do that you can either click the link directly or open it from the dashboard:

![Create a new public forwarding configuration](https://webhookrelay.com/blog/trading-view/images/blog/tradingview/public-url.png)

Then, copy the URL

![Discord webhook URL goes into the public URL as the destination](https://webhookrelay.com/blog/trading-view/images/blog/tradingview/public-url-discord.png)

1. Then, on the input click this "Transform":

![Transform input](https://webhookrelay.com/blog/trading-view/images/blog/tradingview/transform.png)

Now, we will need to create a new function:

1. Open [Functions](https://my.webhookrelay.com/functions) page and click "Create function".
2. Select from scratch
3. Copy paste this:

```
local json = require("json")

local new_body = {
    content = r.RequestBody,
}

local encoded_payload, err = json.encode(new_body)
if err then error(err) end

r:SetRequestHeader("content-type","application/json")
r:SetRequestMethod("POST")
r:SetRequestBody(encoded_payload)
```

This function will receive the webhook from TradingView and send it to Discord in a special format. You can add any logic here!

## [Let's create an alert](#lets-create-an-alert)

Let's head to TradingView and create a new alert. I will monitor BTC price and create an alert. This is merely an example, you can use it with NVIDIA, S&P or anything else where you want to get notified about market events:

![Creating an alert](https://webhookrelay.com/blog/trading-view/images/blog/tradingview/tradingview-alert.png)

Now, configure it to the Input URL we copied from Webhook Relay. In the message field you can write any message you want, it will be sent to your webhook endpoint.

Send a test payload and we will see the alert:

![Discord message](https://webhookrelay.com/blog/trading-view/images/blog/tradingview/message.png)

Other use cases could involve:

- Sending you an email
- Triggering a Slack message
- Performing a trade on your behalf as you can call another API from within a function