How It Works

The Complete AI Follow-Up Flow

Five steps from first contact to booked appointment — fully automated, 24/7.

Step 1 — Missed Call Detection

1

Twilio + GHL Call Routing

When a call goes to voicemail, GHL triggers a webhook to LeadLoop within seconds. The caller's number is captured from Twilio's call log payload. This works for both GHL phone numbers and standalone Twilio numbers routed through GHL.

Endpoint: POST /api/webhooks/ghl with phone_number, contact_name

Or: Direct Twilio Webhook

If using Twilio standalone, configure Twilio to POST missed calls to POST /api/webhooks/twilio. The From number and CallSid are extracted from the payload.

Step 2 — Automated SMS Text Back

2

Twilio SMS Dispatch

Immediately after the missed call is captured, LeadLoop sends an SMS via Twilio to the caller's number. The message acknowledges the missed call, promises a follow-up within 30 minutes, and provides a direct callback number for urgent inquiries.

"Hi [Name], this is LeadLoop for Glow Dental. We saw you tried to reach us — someone from our team will follow up within 30 minutes. Need immediate help? Call us at (555) 123-4567."

Service: services/sms-service.js · Function: sendSMS({ to, body })

Step 3 — AI Lead Qualification

3

OpenAI GPT-4o-mini Scoring

Each lead is sent to the OpenAI API with a scoring prompt tuned for med spa and dental verticals. The model returns a score (1-100), a decision (book_now / follow_up / low_quality), and a human-readable reason. This runs synchronously before the lead is saved to the database.

Model: gpt-4o-mini · Temperature: 0.3 · Max tokens: 300

Service: services/ai-qualify.js · Function: qualifyLead({ name, phone, email, source, message })

Step 4 — Calendly Booking Link

4

Conditional Calendly Link Generation

If the AI qualifies the lead as book_now (score 80+), a Calendly booking link is generated with the lead's name and email pre-populated via URL params. The link is saved to the lead record and can be included in a follow-up SMS or email. For follow_up leads, no link is sent — a human reps follows up instead.

Env var: CALENDLY_BOOKING_URL · Example: https://calendly.com/your-business/consultation

Step 5 — Review Request Sequence

5

Post-Appointment Review SMS

Once an appointment is confirmed (via Calendly webhook or manual API call to POST /api/appointments), LeadLoop immediately sends a review request SMS. In production, this would be scheduled 24 hours after the appointment time to catch the patient when the experience is fresh.

"Hi [Name] — thanks for visiting Glow Dental! We'd love your feedback: https://review.link/demo — it only takes 60 seconds and helps us improve."

API: POST /api/appointments with lead_id, scheduled_at, service_type

Integration Architecture

GoHighLevel (GHL)
Workflows → Webhooks → LeadLoop API
Forms → Contact capture → Qualification
Twilio
SMS send (missed call, review)
Call log webhooks (missed calls)
Calendly
Booking links generated per lead
Webhook confirms scheduled appointments
OpenAI
Lead scoring via GPT-4o-mini
Qualification reason generation