Close CRM
Close CRM is the sales pipeline management tool for 1 Hour Recruitment. Client Portal auto-creates leads and opportunities in Close when meetings are booked, and handles pipeline automation via incoming webhooks.
API Configuration
| Setting | Value |
|---|---|
| API Base URL | https://api.close.com/api/v1 |
| Auth | Basic Auth (CLOSE_API_KEY + empty password) |
| Env Variable | CLOSE_API_KEY (Supabase secret) |
function closeAuthHeader(): string {
const encoded = btoa(CLOSE_API_KEY + ":");
return `Basic ${encoded}`;
}
Edge Functions
create-close-lead
Trigger: Called automatically by create-calendar-event or send-booking-notification when a meeting is booked (both client and internal booking flows).
Purpose: Creates a lead in Close CRM with full enriched context from the prospect's call history.
Request
{
"meeting_id": "uuid (client meetings)",
"sales_meeting_id": "uuid (internal meetings)",
"prospect_id": "uuid (optional, for enriched notes)",
"prospect_name": "John Doe",
"prospect_company": "Smith Legal Search",
"prospect_email": "[email protected]",
"prospect_phone": "+15551234567",
"scheduled_for": "2026-02-15T14:00:00Z",
"booking_link_title": "Intro Call"
}
Process Flow
Enriched Note Content
When prospect_id is provided, the function builds a rich note from the prospect's full history:
-- Prospect --
Name: John Doe
Company: Smith Legal Search
Title: Managing Partner
Email: [email protected]
Phone: +15551234567
-- Call History --
Total Dials: 5 | Connects: 2 | Conversations: 1
Last Contacted: Feb 10, 2026
-- Call Summaries --
[Feb 10, 2026 -- Future Potential]
Discussed market intelligence services. Prospect is interested in
patent litigation market coverage. Interest: 7/10.
Pipeline & Opportunity
New leads get an opportunity in the Market Validation pipeline:
| Setting | Value |
|---|---|
| Pipeline ID | pipe_1UpHuqi0SS83CC2SsIbYl7 |
| Initial Status | Market Alignment Scheduled |
| Confidence | 20% |
| Currency | USD |
close-webhook-handler
Trigger: Incoming webhook from Close CRM when opportunity statuses change.
Purpose: Automates pipeline transitions and task creation based on deal stage changes.
Handled Events
The handler only processes opportunity.updated events where the status changed:
if (event.object_type !== "opportunity" || event.action !== "updated") {
return { skipped: true };
}
if (!oldStatusId || oldStatusId === newStatusId) {
return { skipped: true, reason: "no status change" };
}
Automation Rules
| Status Change | Automation |
|---|---|
| Validation -> Validation Active | 1. Update lead status to "Validation Client". 2. Create opportunity in Coverage pipeline (status: "Validation In Progress", confidence: 50%). |
| Validation -> Follow-Up Scheduled | Create follow-up task (due 7 days from now). |
| Coverage -> Coverage Active | Update lead status to "Coverage Client". |
Lead Status IDs
| Status | Close ID | Meaning |
|---|---|---|
| Prospect | stat_TUBkZd9H... | New prospect |
| Validation Client | stat_A9LGXzr9... | Active validation pilot |
| Coverage Client | stat_ICFqft3Q... | Active coverage subscription |
Close API Endpoints Used
| Endpoint | Method | Purpose |
|---|---|---|
/lead/ | POST | Create new lead |
/lead/?query=email:{email} | GET | Search for existing lead by email |
/lead/{id}/ | PUT | Update lead status |
/activity/note/ | POST | Add note to a lead |
/opportunity/ | POST | Create opportunity |
/opportunity/?lead_id={id}&pipeline_id={id} | GET | Check for existing opportunities |
/task/ | POST | Create follow-up task |
Data Flow
Error Handling
- The webhook handler returns HTTP 200 even on errors to prevent Close from retrying.
- Lead creation failures are logged but do not block the booking flow.
- Duplicate lead detection by email prevents creating multiple leads for the same prospect.
Related Documentation
- Calendar OAuth -- Booking system that triggers Close lead creation
- Resend Email -- Email notifications sent alongside Close lead creation