Skip to main content

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

SettingValue
API Base URLhttps://api.close.com/api/v1
AuthBasic Auth (CLOSE_API_KEY + empty password)
Env VariableCLOSE_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:

SettingValue
Pipeline IDpipe_1UpHuqi0SS83CC2SsIbYl7
Initial StatusMarket Alignment Scheduled
Confidence20%
CurrencyUSD

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 ChangeAutomation
Validation -> Validation Active1. Update lead status to "Validation Client". 2. Create opportunity in Coverage pipeline (status: "Validation In Progress", confidence: 50%).
Validation -> Follow-Up ScheduledCreate follow-up task (due 7 days from now).
Coverage -> Coverage ActiveUpdate lead status to "Coverage Client".

Lead Status IDs

StatusClose IDMeaning
Prospectstat_TUBkZd9H...New prospect
Validation Clientstat_A9LGXzr9...Active validation pilot
Coverage Clientstat_ICFqft3Q...Active coverage subscription

Close API Endpoints Used

EndpointMethodPurpose
/lead/POSTCreate new lead
/lead/?query=email:{email}GETSearch for existing lead by email
/lead/{id}/PUTUpdate lead status
/activity/note/POSTAdd note to a lead
/opportunity/POSTCreate opportunity
/opportunity/?lead_id={id}&pipeline_id={id}GETCheck for existing opportunities
/task/POSTCreate 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.
  • Calendar OAuth -- Booking system that triggers Close lead creation
  • Resend Email -- Email notifications sent alongside Close lead creation