Public
Weekly gross revenue run-rate ping to Slack (Fridays)
cronslackstripe
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data โ€“ all from the browser, and deployed in milliseconds.

runrate-bot

Weekly gross revenue run-rate ping, posted to Slack #test every Friday. Independent of consensus/arr-bot.

The metric

Gross revenue run rate = trailing 28 complete days of gross payment volume ร— 13.

  • Gross volume = all successful Stripe charges (paid + captured), by charge date, FX-converted to USD โ€” matches the dashboard's "Gross volume".
  • Pre-fee, pre-refund, no tax component (Consensus collects no tax via Stripe).
  • Window ends yesterday, so today's partial day is never counted.
  • WoW = vs the same 28-day window shifted back one week. Both windows come from one Sigma query over 35 days of charges โ€” no stored state.
  • Validated against paid-invoice totals and Stripe's own gross_volume metric (all three agree within 0.01%).

Required env vars

๐Ÿ‘‰ Add STRIPE_SECRET_KEY here: https://www.val.town/x/consensus/runrate-bot/environment-variables?key=STRIPE_SECRET_KEY

(Same restricted key as arr-bot: needs Sigma + Sigma API permissions and an active Sigma subscription.)

SLACK_TOKEN comes from Val Town's Slack integration โ€” connect it on this val's dashboard (same flow as arr-bot).

Files

  • main.ts โ€” interval handler: one Sigma query โ†’ run rate + WoW โ†’ Slack
  • sigma.ts โ€” Sigma Query Run API client (copy of arr-bot's, kept local so this val is self-contained)

Schedule

Fridays 6pm PT โ€” cron 0 1 * * 6 (01:00 UTC Saturday). Val Town cron is UTC-only with no DST adjustment, so this is 6pm during PDT (summer) and 5pm during PST (winter), same convention as arr-bot's daily digest.