Settings
Webhook URLs, env vars, and integration guide.
Webhook endpoints
Required environment variables
Add these in your backend project secrets so edge functions can authenticate.
OPENAI_API_KEYUsed for GPT-4o (agent) and GPT-4o-mini (stage detection).GHL_WEBHOOK_SECRETShared secret. Send as x-webhook-secret header from GHL.HANDOFF_WEBHOOK_URLSlack-style incoming webhook for human-handoff alerts (optional).SUPABASE_SERVICE_ROLE_KEYAuto-provisioned. Used internally.
GHL setup checklist
- In GHL, create a sub-account and grab its Location ID and an API key. Paste into the Clients page.
- Inbound trigger — workflow on Customer Replied (or Inbound Message). Action: Webhook, URL above, method POST.
- Outbound trigger — second workflow on Outbound Message (when you/staff send from GHL or IG). Same webhook URL. This is what makes your manual replies show up in the chat thread here.
- Send these fields in the body:
contactId, message, locationId, contactName, phone, email, type, direction. For the outbound workflow setdirection: "outbound". - Add a custom header:
x-webhook-secret: <your secret>. - Optional: add a Contact Created trigger pointing at the contact-created URL to fire opening DMs automatically.
- Schedule the follow-up endpoint to be hit every 5 min via cron (cron-job.org, Railway, or pg_cron).
Security note
Auth is currently disabled on the dashboard — anyone with this URL can read and write data. Add login + RLS before going to production.