Guide
What is a webhook in trading?
A webhook is a web address that one program calls when something happens, so a second program can react at once instead of asking over and over whether anything changed. In trading, a charting platform posts an alert's message to that address, and the program that owns it turns the message into an order. This guide explains it plainly, with a TradingView example, what the message needs, why a 200 is not a fill, and why the URL is a secret.
A webhook in plain terms
You give System A an address. When an event happens, System A sends an HTTP POST to that address with a short message describing the event. System B owns the address, reads the message and acts. Nothing polls and nothing waits on a timer: the message is sent when the event occurs.
A TradingView example
On a TradingView alert, the Webhook URL box takes an address, and the Message box takes the text to send. When the alert's condition becomes true, TradingView posts the message to that address. Webhooks need a paid TradingView plan and two-factor authentication on the account. For a Nyria strategy the pair looks like this:
Webhook URL
https://trades.nyria.io/webhooks/{your_strategy_token}Message
long entry AAPL
The receiver reads the message, works out the order, and sends it to the broker's API. That is the whole mechanism. The seconds between the alert and the order are the time the receiver takes to do those steps.
What the message needs
- The ticker
- Which instrument to trade, such as AAPL or SPY.
- The side
- Buy or sell, or long or short.
- Open or close
- Whether the alert starts a position or ends one. Without it, a sell is ambiguous.
- For options
- The expiry, the strike and call or put, unless the receiver picks the contract from its own rules.
Nyria reads any wording or JSON, so there is no template to match. An alert cannot set the order size; the bot sets it from the budget per entry you choose. The alert tester shows how a message will be read, and trades nothing.
A 200 is not a fill
When a receiver answers a webhook with 200, it is saying the message arrived. For Nyria, a 200 with the status processed means Nyria read the alert and handed it to your bots. It does not mean the broker filled an order: the order can still rest, be refused or fill partly. A 200 can also carry a rejection, such as a ticker that is not on the strategy's list.
To see what happened, read the strategy's Logs tab for the alert and the bot's Logs tab for the broker's response. The broker's own order history is the final record.
The URL is a secret
A Nyria webhook URL ends in a token, and that token is the only authentication. There is no password header and no signature, so anyone who has the URL can send an alert to your strategy. Keep it out of screenshots, chats and public repositories. If it leaks, select Rotate token on the strategy's Integration tab. The old URL stops working at once, so update every sender that used it.
Most senders post a webhook once and do not retry. A receiver that is down when the alert fires misses it.
Try it on paper
Nyria Paper is free and needs no broker login. Point a test alert at a paper bot, read the Logs tab, and move to Charles Schwab, Tradier, tastytrade or Alpaca once the messages trade what you meant.
Questions
- Is a webhook the same as an API?
- Related, not the same. An API is something you call to ask for an action. A webhook is the reverse: another system calls your address when an event happens.
- Can I send a webhook from my own script?
- Yes. Any program that can POST to a URL can send one. The guide on sending alerts from a Python script has a minimal sender.
- What does it cost?
- Paper is free. Live trading from $15 a month.
Guides
TradingView webhook not working: a checklist
Six checks, most common first: script type, the URL box, expiry, the message, the bot, and where the reason is logged.
Send alerts from your Python script to your broker
The webhook URL, the documented fields, a minimal requests sender, the response and the Logs tab, paper first.
How does algo trading software execute trades automatically?
Signal, webhook message, receiver, broker API and fill tracking, and what breaks in practice.
Post a test webhook to a paper bot
Paper is free. Live trading from $15 a month.