Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.simplefunctions.dev/llms.txt

Use this file to discover all available pages before exploring further.

The watchlist + alerts system has three layers:
  1. Watched objects — what you’re tracking (ticker, query, URL, text).
  2. Alert rules — conditions on watched objects (price_above, price_below, econ_release, gov_action, semantic_match).
  3. Webhook endpoints — where alerts get delivered.

Add to watchlist

sf watchlist add KXRATECUT-26DEC31
sf watchlist identify "Will the Fed cut rates by July?" --json
sf watchlist list --json
identify resolves a free-text query, URL, or ticker into a canonical watched object. The CLI handles dedupe and lifecycle.

Create an alert rule

sf alerts create \
  --object <watched-object-id> \
  --condition price_above \
  --threshold 65 \
  --channel webhook \
  --endpoint <webhook-endpoint-id>
Conditions:
ConditionTrigger
price_aboveYes price ≥ threshold (cents)
price_belowYes price ≤ threshold (cents)
econ_releaseFRED series prints (e.g., CPI release)
gov_actionBill / nomination / treaty status change
semantic_matchLLM-classified content match
Each rule is active, paused, or archived. Test with sf alerts test <id>.

Register a webhook endpoint

sf webhooks create \
  --url https://your.app/sf-alerts \
  --label "ops-alerts"
Returns the endpoint id and a signing secret. Subsequent deliveries include:
X-SF-Signature: t=1714572345,v1=hex(hmac_sha256(secret, "{t}.{body}"))
X-SF-Endpoint-Id: we_...
X-SF-Delivery-Id: del_...
See Webhook receiver for verification code samples.

Delivery and dedupe

Alert deliveries write to the alert_deliveries table with a stable dedupe key sha256(rule_id + channel + endpoint_id + window). The runtime worker (scripts/workers/alert-runtime.ts) won’t re-fire the same condition more than once per window.

Runtime architecture

A long-running worker on Fly.io (sf-alert-runtime) polls every 30s, prefers WebSocket from wss://app.simplefunctions.dev/ws for active tickers, falls back to REST. Vercel’s 1-min cron minimum couldn’t honor a 30s loop, so the evaluator was moved off Vercel.

Next steps

Watch + alert API

Endpoint shapes and curl examples.

Webhook events

Every event payload shape.

Webhook receiver

Verification + retry handling code samples.

Webhooks

Endpoint registration and signing.