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.

SimpleFunctions delivers signed webhooks for alert events, thesis-state changes, and portfolio events. Every endpoint is HTTPS-only, signed with a shared secret, and idempotent via a stable delivery id.

Register an endpoint

sf webhooks create --url https://your.app/sf-hook --label ops
Or via API:
POST /api/webhook-endpoints
Authorization: Bearer sf_live_...
Content-Type: application/json

{ "url": "https://your.app/sf-hook", "label": "ops" }
Response includes the endpoint id (we_...) and signing secret.

Signature verification

Every delivery includes:
X-SF-Signature: t=<unix_ts>,v1=<hex_hmac>
X-SF-Endpoint-Id: we_...
X-SF-Delivery-Id: del_...
X-SF-Event: alert.fired
import crypto from 'crypto'

function verify(secret: string, headers: Record<string,string>, body: string): boolean {
  const sig = headers['x-sf-signature']
  if (!sig) return false
  const [tPart, vPart] = sig.split(',')
  const t = tPart.split('=')[1]
  const v1 = vPart.split('=')[1]
  const expected = crypto
    .createHmac('sha256', secret)
    .update(`${t}.${body}`)
    .digest('hex')
  if (Math.abs(Date.now()/1000 - Number(t)) > 300) return false  // 5min window
  return crypto.timingSafeEqual(Buffer.from(v1, 'hex'), Buffer.from(expected, 'hex'))
}

Events

EventPayload
alert.firedAlert rule tripped; includes rule, watched object, snapshot
alert.pausedRule auto-paused after repeated failures
thesis.confidence_changedThesis confidence delta crossed threshold
thesis.killedThesis kill-flag raised by monitor
portfolio.tick_completedPortfolio autopilot tick finished
portfolio.halt_triggeredDrawdown halt fired
Full payload shapes: Webhook events reference.

Retries

  • Delivery is attempted up to 5 times with exponential backoff (1s, 4s, 16s, 64s, 256s).
  • Endpoints that 5xx more than 50% of the time across a 24h window get auto-paused.
  • You can re-enable with sf webhooks resume <id>.
  • Failed deliveries are persisted in alert_deliveries with status = failed for replay.

Test a delivery

sf webhooks test <endpoint-id>
Sends a synthetic alert.fired event so you can verify your receiver before going live.

Next steps

Webhook events

Full payload schemas per event type.

Webhook receiver

Receiver patterns with retry handling.

Watchlist + alerts

The system that produces these events.