Go Live (Contract → Everything)
Trigger: user clicks GO LIVE in Contract Generator
1
Contract Generator POSTs to Cloudflare Worker, which creates Slack channel + pins spec sheet (instant)
2
Worker queues Dashboard + QBO creation to Cloudflare KV store
3
Go Live Processor (polls every 30s) picks up queue, creates QBO customer + Dashboard row
4
Posts summary to Slack #management. One button → 4 systems updated.
Photo Pipeline
Trigger: crew uploads photo to a job's Slack channel
1
Slack Bot receives the image via Slack Events API (real-time, always on)
2
Bot copies the photo to NAS at /Volumes/Construction Server/{job}/Photos from Slack/
3
Bot uploads the photo to QBO as an attachment on the matching customer record
4
Photo now lives in 3 places: Slack (original), NAS (backup), QBO (accounting)
Auto Push & Archive
Trigger: every 5 minutes (auto-detects milestones)
1
Scans Dashboard for jobs with a plaster date that haven't been pushed to QBO yet
2
Queues push → QBO Push Watcher (always-on) builds construction notes and writes to QBO customer
3
Verifies in QBO — actually reads back the customer record to confirm notes landed
4
When all 6 final inspections pass AND QBO verified → auto-archives Dashboard job
New Job Onboarding
Trigger: new job added to Google Sheets (via Dashboard)
1
New Job Sync polls Dashboard API every hour for new jobs
2
For each new job, creates a Slack channel named #{job-number}-{customer}
3
Maps the channel to its NAS folder and QBO customer in channel_folder_map.json
4
Channel is ready for crew — photos posted there auto-route to NAS + QBO
Cash Invoice Handling
Trigger: daily at 7:00 AM (cron)
1
Queries QBO API for invoices matching the 21 known cash-pay customers
2
Exports each invoice to Excel + PDF (local archive)
3
Uses Playwright browser automation to delete the invoice from Pool Brain
4
Deletes the invoice from QBO — cash customers get paper invoices only
Contract → Layout → Build
Trigger: salesperson creates a contract
1
Contract Generator (web app) captures pool specs, options, pricing
2
Contract data syncs to Pool Layout Tool which auto-generates the engineering drawing
3
Layout uses Fabric.js + Maker.js — rectangle pool, cross-section, coping, features
4
Both feed back to Dashboard API which tracks the job through construction
Health Monitoring V2
Trigger: every 15 minutes (cron) — 22 checks
1
Calls QBO API with live token to verify it works (not just file age). Checks token expiry math.
2
Logs into all 4 Gmail accounts via IMAP to verify app passwords are valid and mailboxes accessible
3
Checks all 8 LaunchAgents loaded, 2 always-on processes running, 4 logs for errors + staleness
4
Pings 4 web apps, NAS read test, Dashboard API. Posts failures to Slack #management