Skip to main content

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.

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
company_nametextYESTarget company name
contact_nametextYESPrimary contact name
contact_emailtextYESPrimary contact email
contact_phonetextYESPrimary contact phone
contact_titletextYESContact's job title
linkedin_urltextYESLinkedIn profile or company URL
websitetextYESCompany website
sourcetextYESLead source (e.g., linkedin, referral, apollo)
notestextYESFree-text notes
engagement_leveltextYES'new'Pipeline stage (see values below)
last_contacted_attimestamptzYESLast outreach timestamp
next_follow_up_attimestamptzYESScheduled next follow-up
created_byuuidYESFK to auth.users.id
ghl_contact_idtextYESGoHighLevel contact ID
ghl_synced_attimestamptzYESWhen last synced to GHL
ghl_location_idtextYESWhich GHL location this prospect belongs to
do_not_contactbooleanYESfalseDNC flag -- blocks further outreach
created_attimestamptzYESnow()
updated_attimestamptzYESnow()

Engagement Level Pipeline

The engagement_level field tracks where a prospect sits in the sales pipeline:

ValueDescription
newJust added, no outreach yet
contactedInitial outreach made
interestedExpressed interest
in_conversationActive discussions underway
proposal_sentProposal/pricing sent
closed_wonDeal closed, became a client
closed_lostDeal lost
dormantNo response or went cold
AI Auto-Update

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.

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
prospect_iduuidYESFK to sales_prospects.id
called_byuuidYESFK to auth.users.id (BDR who made the call)
call_started_attimestamptzYESWhen the call started
duration_secondsintegerYESCall duration in seconds
dispositiontextYESCall outcome
notestextYESBDR-entered notes
transcripttextYESFull call transcript
ai_summaryjsonbYESAI-generated summary (see schema below)
follow_up_actiontextYESNext action to take
follow_up_datedateYESWhen to follow up
external_call_idtextYESGHL call ID (for dedup)
created_attimestamptzYESnow()
updated_attimestamptzYESnow()

Sales Call Dispositions

ValueDescription
no_answerPhone rang, nobody picked up
voicemailReached voicemail
gatekeeperBlocked by assistant/receptionist
connectedReached the contact but brief
conversationHad a meaningful conversation
meeting_bookedSuccessfully booked a meeting
not_interestedContact 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.

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
nametextNOCampaign name
statustextYES'active'active, paused, completed
ghl_location_idtextYESLinks campaign to a GHL location account
descriptiontextYESCampaign description
created_byuuidYESFK to auth.users.id
created_attimestamptzYESnow()
updated_attimestamptzYESnow()

sales_companies

Company database enriched via Apollo. Used as a lookup table when adding prospects.

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
nametextYESCompany name
domaintextYESCompany domain
industrytextYESIndustry classification
employee_countintegerYESNumber of employees
citytextYESHQ city
statetextYESHQ state
countrytextYESHQ country
linkedin_urltextYESLinkedIn company page
descriptiontextYESCompany description
apollo_idtextYESApollo organization ID
created_attimestamptzYESnow()
updated_attimestamptzYESnow()

sales_meetings

Internal meetings booked via sales booking links. Linked to prospects and booking links.

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
prospect_iduuidYESFK to sales_prospects.id
booking_link_iduuidYESFK to booking_links.id
user_iduuidNOFK to auth.users.id (meeting owner)
titletextYESMeeting title
scheduled_fortimestamptzNOMeeting date/time
duration_minutesintegerYES30Duration
statustextYES'scheduled'Meeting status
booker_nametextYESName of person who booked
booker_emailtextYESEmail of person who booked
booker_phonetextYESPhone of person who booked
booking_sourcetextYESmanual or booking_link
calendar_event_idtextYESGoogle/Outlook event ID
meeting_linktextYESVideo call URL
confirmation_sent_attimestamptzYESConfirmation email sent
reminder_24h_sent_attimestamptzYES24h reminder sent
reminder_1h_sent_attimestamptzYES1h reminder sent
outcome_notestextYESPost-meeting notes
close_lead_idtextYESClose CRM lead ID
created_attimestamptzYESnow()
updated_attimestamptzYESnow()

Status values: scheduled, completed, cancelled, no_show

Entity Relationships