Supabase Edge Functions Specification¶
Overview¶
Supabase Edge Functions are the main service layer for the application. The codebase currently exposes a large function inventory organized by naming convention rather than by separate deployable services.
Shared Conventions¶
- Shared helpers live in
supabase/functions/_shared/ - Most function names are domain-prefixed and act like module APIs
- Several functions are configured with
verify_jwt = falseinsupabase/config.toml, meaning auth is handled by webhook validation, custom bearer/API keys, or service-role access patterns - DB-heavy behavior is often delegated to shared DB wrappers or RPCs
Function Domains¶
AI and AI review¶
admin-ai-settingsagents-convo-responseagents-no-intentai-convo-thread-*ai-no-intent-update-from-agentai-yes-intent-update-from-agentai-review-apply-data
Primary role: - admin control plane for AI toggles and prompt drafts - persistence of AI conversation state - callback/update endpoints used by Cloudflare Workers
Analytics and reporting¶
analytic-*report-*github-release-latest
Primary role: - event logging - report feeds and counts - app version lookup
Broadcast and campaign operations¶
broadcast-countbroadcast-searchcampaign-*campaign-lead-*contact-countseligible-leads-search
Primary role: - campaign CRUD - campaign-lead search/send/delivery tracking - campaign metrics - broadcast-adjacent counts and search
Leads and customer records¶
lead-*vehicle-*warehouse-*lvo-sales-milestones-readsales-sheet-search
Primary role: - lead CRUD/search - addresses, phones, vehicles, audits, billing opportunities, follow-ups, and opportunity updates - sales-sheet data access
This is the largest domain in the function layer and effectively acts as the core CRM API.
Message Center and communications¶
message-*thread-*send-filevoicemail-dropcall-missed-answeredcall-recording-transcripttranscribe-audiotwilio-message-*
Primary role: - inbound/outbound SMS - thread search/read/update - call logging, voicemail open flows, transcript handling - message media send and replay tooling
PBX and telephony helpers¶
lead-pbx-actionslead-pbx-sms-actionsthread-call-dialthread-update-last-call-userthread-voicemail-openphone-number-validategroundwire-contacts
Primary role: - PBX-side webhook handoff - click-to-call preflight/analytics - thread activity synchronization with telephony events
Insurance workflows¶
insurance-company-phone-*insurance-followup-reactivationinsurance-followups-categorieslead-followup-categoriesquery-followup-status
Primary role: - insurance provider phone management - insurance follow-up priority refresh and reactivation - read models used by navbar-driven follow-up workflows
General utility/config functions¶
get-all-app-enumsget-google-maps-keygeocoding-proxygrammar-checknotification-*settings-filter-*storeuser-creatework-order-management
Notable Entry Points¶
message-inbound¶
This is a high-importance function. It: - authenticates Twilio webhook traffic - normalizes inbound payloads - resolves thread/lead/message context - gates AI yes/no behavior using global settings and Phoenix-time windows - triggers OCR/extraction and summary-related flows
campaign-metrics¶
Provides real KPI/aggregate campaign data for broadcast analytics. Current implementation still uses placeholder conversion logic and does not provide a full real time-series backend.
thread-call-dial¶
Acts as the call preflight/guard path from the UI. It marks active caller state, prevents conflicting live-call ownership, and logs analytics before the PBX click-to-call URL is used.
admin-ai-settings¶
Admin-only control plane for: - yes/no agent enablement - AI active window - prompt draft persistence in Supabase
ocr-vision¶
Dual-purpose OCR endpoint: - user-facing VIN detection mode for image preview overlays - update/summary mode used by message/AI flows
As-Built Assessment¶
- The function layer is broad and functional, but it is not small or tightly bounded
- Several flows cross domains, especially Message Center + AI + telephony
- Naming is generally consistent enough to navigate the system, but ownership would benefit from a formal function map by product surface
Recommended Reading Order¶
message-inboundthread-*andmessage-*campaign-*andcampaign-lead-*lead-*admin-ai-settingsand AI callback functions