Webhooks in alerts

From TradingView Wiki
Jump to: navigation, search

Webhooks allow you to send a POST request to a certain URL every time alert is triggered. This feature can be enabled when you create or edit an alert. Add the correct URL for your app and we will send a POST request as soon as the alert is triggered, with the description of the alert in the body of the message.

Here is a list of IP addresses that we will use to send POST requests, in case they need to be permissioned:

  • 52.89.214.238
  • 34.212.75.30
  • 54.218.53.128
  • 52.32.178.7

If you want to send a request to a URL with a port number, please note that we only accept URLs with port numbers 80 and 443. Request on the URL with any other port number will be rejected. If a remote server processes a request for more than 3 seconds the request gets cancelled.

Keep in mind, that many apps and services expect to receive data from webhooks in the JSON format (and not the plain text which we have in the alert message by default). Before sending a request, please read the documentation of the corresponding app or service and format your alert message properly. You can find out more about the JSON format in the wiki.

Common questions

How can I send a webhook to Slack?

Slack only accepts JSON data, as written in their documentation, so you need to format the alert message properly. You can find the example of formatting in the documentation. Instead of a usual alert message 'BTCUSD Greater Than 9000' you should use a key "text" with a value containing the alert message:

{"text":"BTCUSD Greater Than 9000"}