Sales Tables
The sales tables power 1HR's internal sales CRM. These are used exclusively by the admin/bdr team for outbound prospecting, call logging, AI summarization, and pipeline management. All sales tables are accessible at /admin/sales/*.
sales_prospects
Companies and contacts being prospected by 1HR's sales team.
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | NO | gen_random_uuid() | Primary key |
company_name | text | YES | Target company name | |
contact_name | text | YES | Primary contact name | |
contact_email | text | YES | Primary contact email | |
contact_phone | text | YES | Primary contact phone | |
contact_title | text | YES | Contact's job title | |
linkedin_url | text | YES | LinkedIn profile or company URL | |
website | text | YES | Company website | |
source | text | YES | Lead source (e.g., linkedin, referral, apollo) | |
notes | text | YES | Free-text notes | |
engagement_level | text | YES | 'new' | Pipeline stage (see values below) |
last_contacted_at | timestamptz | YES | Last outreach timestamp | |
next_follow_up_at | timestamptz | YES | Scheduled next follow-up | |
created_by | uuid | YES | FK to auth.users.id | |
ghl_contact_id | text | YES | GoHighLevel contact ID | |
ghl_synced_at | timestamptz | YES | When last synced to GHL | |
ghl_location_id | text | YES | Which GHL location this prospect belongs to | |
do_not_contact | boolean | YES | false | DNC flag -- blocks further outreach |
created_at | timestamptz | YES | now() | |
updated_at | timestamptz | YES | now() |
Engagement Level Pipeline
The engagement_level field tracks where a prospect sits in the sales pipeline:
| Value | Description |
|---|---|
new | Just added, no outreach yet |
contacted | Initial outreach made |
interested | Expressed interest |
in_conversation | Active discussions underway |
proposal_sent | Proposal/pricing sent |
closed_won | Deal closed, became a client |
closed_lost | Deal lost |
dormant | No response or went cold |
When a sales call is summarized by the summarize-sales-call edge function, it automatically updates engagement_level and next_follow_up_at based on the conversation analysis.
sales_calls
Internal sales call logs. Each call is linked to a prospect and optionally includes a transcript for AI summarization.
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | NO | gen_random_uuid() | Primary key |
prospect_id | uuid | YES | FK to sales_prospects.id | |
called_by | uuid | YES | FK to auth.users.id (BDR who made the call) | |
call_started_at | timestamptz | YES | When the call started | |
duration_seconds | integer | YES | Call duration in seconds | |
disposition | text | YES | Call outcome | |
notes | text | YES | BDR-entered notes | |
transcript | text | YES | Full call transcript | |
ai_summary | jsonb | YES | AI-generated summary (see schema below) | |
follow_up_action | text | YES | Next action to take | |
follow_up_date | date | YES | When to follow up | |
external_call_id | text | YES | GHL call ID (for dedup) | |
created_at | timestamptz | YES | now() | |
updated_at | timestamptz | YES | now() |
Sales Call Dispositions
| Value | Description |
|---|---|
no_answer | Phone rang, nobody picked up |
voicemail | Reached voicemail |
gatekeeper | Blocked by assistant/receptionist |
connected | Reached the contact but brief |
conversation | Had a meaningful conversation |
meeting_booked | Successfully booked a meeting |
not_interested | Contact declined |
AI Summary Schema
The ai_summary JSONB field is populated by the summarize-sales-call edge function:
interface AISummary {
disposition: string; // Inferred disposition
key_points: string[]; // Bullet points from the conversation
sentiment: string; // positive / neutral / negative
action_items: string[]; // Recommended next steps
engagement_assessment: string; // Overall engagement quality
conversation_quality: string; // Quality of the conversation
interest_level: string; // high / medium / low / none
objections: string[]; // Objections raised
buying_signals: string[]; // Positive buying indicators
}
sales_campaigns
Sales campaign definitions for organizing outbound prospecting efforts.
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | NO | gen_random_uuid() | Primary key |
name | text | NO | Campaign name | |
status | text | YES | 'active' | active, paused, completed |
ghl_location_id | text | YES | Links campaign to a GHL location account | |
description | text | YES | Campaign description | |
created_by | uuid | YES | FK to auth.users.id | |
created_at | timestamptz | YES | now() | |
updated_at | timestamptz | YES | now() |
sales_companies
Company database enriched via Apollo. Used as a lookup table when adding prospects.
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | NO | gen_random_uuid() | Primary key |
name | text | YES | Company name | |
domain | text | YES | Company domain | |
industry | text | YES | Industry classification | |
employee_count | integer | YES | Number of employees | |
city | text | YES | HQ city | |
state | text | YES | HQ state | |
country | text | YES | HQ country | |
linkedin_url | text | YES | LinkedIn company page | |
description | text | YES | Company description | |
apollo_id | text | YES | Apollo organization ID | |
created_at | timestamptz | YES | now() | |
updated_at | timestamptz | YES | now() |
sales_meetings
Internal meetings booked via sales booking links. Linked to prospects and booking links.
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | NO | gen_random_uuid() | Primary key |
prospect_id | uuid | YES | FK to sales_prospects.id | |
booking_link_id | uuid | YES | FK to booking_links.id | |
user_id | uuid | NO | FK to auth.users.id (meeting owner) | |
title | text | YES | Meeting title | |
scheduled_for | timestamptz | NO | Meeting date/time | |
duration_minutes | integer | YES | 30 | Duration |
status | text | YES | 'scheduled' | Meeting status |
booker_name | text | YES | Name of person who booked | |
booker_email | text | YES | Email of person who booked | |
booker_phone | text | YES | Phone of person who booked | |
booking_source | text | YES | manual or booking_link | |
calendar_event_id | text | YES | Google/Outlook event ID | |
meeting_link | text | YES | Video call URL | |
confirmation_sent_at | timestamptz | YES | Confirmation email sent | |
reminder_24h_sent_at | timestamptz | YES | 24h reminder sent | |
reminder_1h_sent_at | timestamptz | YES | 1h reminder sent | |
outcome_notes | text | YES | Post-meeting notes | |
close_lead_id | text | YES | Close CRM lead ID | |
created_at | timestamptz | YES | now() | |
updated_at | timestamptz | YES | now() |
Status values: scheduled, completed, cancelled, no_show