price_threshold webhook, with fire-and-delete so each alert fires once and cleans itself up.
How it fits together
- A user taps “Notify me at 75%” on a market in your app.
- Your backend creates a
price_thresholdwebhook that points at your server, scoped to that market, withone_shot: true. - When the market’s price crosses the target, Struct delivers the event to your server.
- Your server looks up the device that registered the alert and sends a push notification.
- Because the webhook is
one_shot, it deletes itself after that single delivery. To repeat the alert, create a new one.
1. Create the alert when the user opts in
When the user sets an alert, create aprice_threshold webhook from your backend and store the returned id against that user and device. Use min_price for an “above” alert (fire when the price crosses up to the target) or max_price for a “below” alert.
price_threshold requires condition_ids or position_ids when one_shot is set, which the per-market scope here already provides.2. Receive the event and send the push
Struct delivers theprice_threshold event to your endpoint as an HTTP POST. Verify the signature, look up the device that registered the alert, and forward a push notification.
Node (Express)
3. Let users cancel an alert
If a user removes a pending alert before it fires, delete the webhook so it never delivers:one_shot alert that has already fired is gone on Struct’s side, so there is nothing to cancel once the push has been sent.
Recurring alerts
one_shot makes each alert fire once. For an alert that should keep notifying every time a market crosses a level (a “watchlist” toggle rather than a one-time target), omit one_shot: the subscription stays active and re-arms after each crossing. Delete it when the user turns the watch off.
Reading the payload
The fields you will use most in the notification:direction:"up"(crossed themin_pricetarget) or"down"(crossed themax_pricetarget).threshold: the target from your filter that was crossed.price/probability: the value that triggered it, on a0.0–1.0scale.question/market_slug/event_slug: for the notification copy and for deep-linking back into your app.
price_threshold webhook page.