02/05/2020 |
TrendSpider Software Update: Webhook Alerts Added
At TrendSpider, we are constantly working on adding new, useful features to our platform as well as updating and improving the ones we currently have. In this blog post, we take a look at the addition of Webhook Alerts which will drastically increase speed and efficiency when sending alerts to an automated execution engine. Enjoy!
What Are Webhook Alerts?
Webhooks are a faster way for you to receive notifications when your alerts fire. Instead of receiving an email or SMS message, we’ll send an HTTP POST request to the URL provided by a user. This will allow you to trigger third-party systems, trading bots, and other automation activities using your TrendSpider analysis and TrendSpider alerts.
Set the webhook URL in your account’s Notification settings (just like you would set your email or cell phone number).
We always send webhook calls from a specific host. The server IP is 3.12.143.24.
The Webhook call sends a POST request with a body equal to what you’ve set in your alert’s description. If the description contains a valid JSON, we’ll set the content-type header to be application/json; in all the other cases, it’s text/plain.
Webhook call timeout is 5 seconds.
We support placeholders for Webhooks, in 2 places:
- In Webhook URL (which you set in your account settings) you can use: %alert_name%, %alert_symbol%, %alert_note%. Example: http://mywebhook.com/trigger?symbol=%alert_symbol%
- In “Your Note” field of alert: %alert_name%, %alert_symbol%. Example: { “text”: “Your alert (%alert_name%) has triggered for %alert_symbol%” }
Example
In your Notification Settings widget, you set Webhook URL to
https://webhook.site/1902dc91-ffdb-4322-9c65-5df94cec5f34?symbol=%alert_symbol%
In the alert’s Note field, you the text below (it will display a “valid JSON” mark to help you)
{"event":"alert_triggered","which":"%alert_name%","my_additional_parameter":42}
Once completed, when your alert triggers (say, it was an alert for AAPL, called “Meaningful Dubinsky”), we’ll send the following request from 3.12.143.24:
HTTP POST https://webhook.site/1902dc91-ffdb-4322-9c65-5df94cec5f34?symbol=AAPL Content-Type: application/json X-requester: trendspider X-reason: alert-webhook {"event":"alert_triggered","which":"Meaningful Dubinsky","my_additional_parameter":42}