What's in your pipeline database

    Smartlead, Instantly, HeyReach, PlusVibe, EmailBison, and Prosp all write into the same local SQLite file. One schema. Your agent queries it directly.

    This page lists every table, field, type, and an example row so you (or your agent) can write SQL without guessing column names. Data stays on your machine in outreachmagic.db. No hosted CRM, no CSV stitching.

    Which table do I need?

    QuestionTable
    Replies, bounces, sends, campaign breakdownsevents
    Lead list with per-workspace status and sentimentworkspace_leads + leads
    Clay custom fields or API attributeslead_personalization
    LinkedIn connection state per senderworkspace_lead_linkedin_status
    Hard bounces by sender mailboxbounce_events

    Core pipeline

    Leads, companies, campaigns, and the events timeline. Smartlead, Instantly, HeyReach, PlusVibe, EmailBison, and Prosp webhooks all land here.

    leads

    One row per contact. Email and/or LinkedIn identity. Org-wide, not workspace-scoped.

    FieldTypeDescription
    idINTEGERPrimary key
    nameTEXTFull name
    company_idINTEGERFK to companies.id
    companyTEXTDenormalized company name
    titleTEXTJob title
    industryTEXTIndustry segment
    headcountTEXTCompany size band (e.g. 51-200)
    headcount_numericINTEGERNumeric headcount when known
    emailTEXTPrimary email (unique when set)
    email_domainTEXTDomain part of email
    linkedin_urlTEXTLinkedIn profile URL (unique when set)
    location_cityTEXTCity
    location_stateTEXTState or region
    location_countryTEXTCountry
    channelTEXTPrimary channel: email or linkedin
    stageTEXTPipeline stage (legacy; see workspace_leads for per-workspace status)
    notesTEXTFree-form notes
    original_sourceTEXTFirst source that created the lead
    original_source_detailTEXTDetail for original source
    original_source_platformTEXTPlatform for original source
    original_source_atTEXTISO timestamp of first source
    latest_sourceTEXTMost recent source event
    latest_source_detailTEXTDetail for latest source
    latest_source_platformTEXTPlatform for latest source
    latest_source_atTEXTISO timestamp of latest source
    email_verification_statusTEXTLatest verification status summary
    email_verified_atTEXTWhen email was last verified
    created_atTEXTRow created (ISO)
    updated_atTEXTRow last updated (ISO)
    last_contact_atTEXTLast outbound or inbound touch
    next_actionTEXTSuggested next step
    next_action_atTEXTWhen next action is due
    cloud_pendingINTEGER1 if local changes await cloud sync
    latest_senderTEXTMost recent sender address or profile
    latest_sender_platformTEXTPlatform of latest sender

    Example row

    {
      "id": 1042,
      "name": "Jordan Lee",
      "company_id": 88,
      "company": "Northstar Logistics",
      "title": "VP Operations",
      "industry": "Logistics",
      "headcount": "201-500",
      "headcount_numeric": 340,
      "email": "jordan.lee@northstarlogistics.com",
      "email_domain": "northstarlogistics.com",
      "linkedin_url": "https://www.linkedin.com/in/jordan-lee-ops",
      "location_city": "Chicago",
      "location_state": "IL",
      "location_country": "US",
      "channel": "email",
      "stage": "replied",
      "notes": null,
      "original_source": "smartlead_import",
      "original_source_platform": "smartlead",
      "latest_source": "email_reply",
      "latest_source_platform": "smartlead",
      "email_verification_status": "valid",
      "created_at": "2026-05-12T14:22:00Z",
      "updated_at": "2026-06-17T09:41:00Z",
      "last_contact_at": "2026-06-16T18:03:00Z",
      "cloud_pending": 0,
      "latest_sender": "alex@agency-mail.com",
      "latest_sender_platform": "smartlead"
    }

    companies

    Canonical company records linked from leads. Deduped by domain when present.

    FieldTypeDescription
    idINTEGERPrimary key
    nameTEXTCompany name
    domainTEXTPrimary domain (unique when set)
    industryTEXTIndustry
    headcountTEXTSize band
    headcount_numericINTEGERNumeric employee count
    hq_cityTEXTHQ city
    hq_stateTEXTHQ state
    hq_countryTEXTHQ country
    cloud_pendingINTEGER1 if awaiting cloud sync
    created_atTEXTRow created (ISO)
    updated_atTEXTRow updated (ISO)

    Example row

    {
      "id": 88,
      "name": "Northstar Logistics",
      "domain": "northstarlogistics.com",
      "industry": "Logistics",
      "headcount": "201-500",
      "headcount_numeric": 340,
      "hq_city": "Chicago",
      "hq_state": "IL",
      "hq_country": "US",
      "cloud_pending": 0,
      "created_at": "2026-05-12T14:22:00Z",
      "updated_at": "2026-06-10T11:00:00Z"
    }

    events

    Primary timeline for analytics. Replies, bounces, sends, status labels, and LinkedIn activity from every connected sequencer.

    Use events (not workspace_lead_events) for reply rates, campaign breakdowns, and timelines.

    FieldTypeDescription
    idINTEGERPrimary key
    lead_idINTEGERFK to leads.id
    event_typeTEXTe.g. email_sent, email_reply, bounce, linkedin_reply
    directionTEXToutbound or inbound
    channelTEXTemail or linkedin
    subjectTEXTEmail subject or LinkedIn thread title
    body_previewTEXTTruncated message preview
    metadata_jsonTEXTPlatform-specific payload (JSON string)
    campaign_idINTEGERFK to campaigns.id
    senderTEXTSending address or LinkedIn profile
    created_atTEXTWhen the event occurred (ISO)

    Example row

    {
      "id": 98231,
      "lead_id": 1042,
      "event_type": "email_reply",
      "direction": "inbound",
      "channel": "email",
      "subject": "Re: quick question on freight ops",
      "body_preview": "Thanks for reaching out. We are evaluating vendors in Q3...",
      "metadata_json": "{\"platform\":\"smartlead\",\"campaign_external_id\":\"cmp_abc\"}",
      "campaign_id": 14,
      "sender": "alex@agency-mail.com",
      "created_at": "2026-06-16T18:03:00Z"
    }

    campaigns

    Campaign names. In multi-workspace setups, names use a workspace prefix (e.g. northstar | Q2 outbound).

    FieldTypeDescription
    idINTEGERPrimary key
    nameTEXTUnique campaign name
    descriptionTEXTOptional description
    statusTEXTactive, paused, or completed
    created_atTEXTRow created (ISO)

    Example row

    {
      "id": 14,
      "name": "northstar | Q2 freight ops",
      "description": "Smartlead campaign for Northstar workspace",
      "status": "active",
      "created_at": "2026-04-01T10:00:00Z"
    }

    campaign_leads

    Many-to-many link between campaigns and leads.

    FieldTypeDescription
    campaign_idINTEGERFK to campaigns.id
    lead_idINTEGERFK to leads.id
    added_atTEXTWhen lead was added to campaign (ISO)

    Example row

    {
      "campaign_id": 14,
      "lead_id": 1042,
      "added_at": "2026-05-12T14:30:00Z"
    }

    Workspaces and routing

    Multi-client setups use workspaces to separate clients. Campaign webhooks route to the right workspace through campaign_workspace_map.

    organizations

    Top-level org record. One SQLite file per install, usually one org.

    FieldTypeDescription
    idTEXTOrg UUID
    nameTEXTOrganization name
    workspace_routing_modeTEXTsingle or multi
    default_workspace_idTEXTFallback workspace UUID
    created_atTEXTRow created (ISO)

    Example row

    {
      "id": "org_7f3a9c2e",
      "name": "Summit Outbound Agency",
      "workspace_routing_mode": "multi",
      "default_workspace_id": "ws_northstar",
      "created_at": "2026-03-15T08:00:00Z"
    }

    workspaces

    Client or brand partition. Status, tags, and reporting filter by workspace.

    FieldTypeDescription
    idTEXTWorkspace UUID
    org_idTEXTFK to organizations.id
    nameTEXTDisplay name
    slugTEXTURL-safe slug (unique per org)
    cloud_syncedINTEGER1 if synced to cloud
    created_atTEXTRow created (ISO)
    updated_atTEXTRow updated (ISO)

    Example row

    {
      "id": "ws_northstar",
      "org_id": "org_7f3a9c2e",
      "name": "Northstar Logistics",
      "slug": "northstar",
      "cloud_synced": 1,
      "created_at": "2026-03-15T08:05:00Z",
      "updated_at": "2026-06-17T07:00:00Z"
    }

    workspace_leads

    Per-workspace lead status, sentiment, owner, and activity timestamps.

    FieldTypeDescription
    idTEXTWorkspace lead UUID
    org_idTEXTOrg UUID
    workspace_idTEXTFK to workspaces.id
    lead_idINTEGERFK to leads.id
    statusTEXTPipeline status (prospecting, replied, interested, etc.)
    owner_user_idTEXTAssigned rep
    stage_entered_atTEXTWhen current status started
    last_activity_atTEXTLast event in this workspace
    current_status_labelTEXTHuman-readable status from sequencer
    current_status_sentimentTEXTpositive, interested, neutral, negative, etc.
    contact_priorityINTEGERSort priority (lower = higher)
    latest_senderTEXTLatest sender in this workspace
    cloud_pendingINTEGER1 if awaiting cloud sync
    created_atTEXTRow created (ISO)
    updated_atTEXTRow updated (ISO)

    Example row

    {
      "id": "wl_9b2c4d1e",
      "org_id": "org_7f3a9c2e",
      "workspace_id": "ws_northstar",
      "lead_id": 1042,
      "status": "replied",
      "owner_user_id": "user_alex",
      "stage_entered_at": "2026-06-16T18:03:00Z",
      "last_activity_at": "2026-06-16T18:03:00Z",
      "current_status_label": "Interested",
      "current_status_sentiment": "interested",
      "contact_priority": 2,
      "latest_sender": "alex@agency-mail.com",
      "cloud_pending": 0,
      "created_at": "2026-05-12T14:30:00Z",
      "updated_at": "2026-06-16T18:03:00Z"
    }

    workspace_lead_events

    Workspace-scoped ingest audit log. Not the full event volume; use events for analytics.

    FieldTypeDescription
    idTEXTEvent UUID
    org_idTEXTOrg UUID
    workspace_idTEXTWorkspace UUID
    lead_idINTEGERFK to leads.id
    workspace_lead_idTEXTFK to workspace_leads.id
    event_typeTEXTIngest event type
    event_atTEXTSource event time (ISO)
    source_platformTEXTsmartlead, instantly, heyreach, etc.
    external_event_idTEXTPlatform event ID
    idempotency_keyTEXTDedup key (unique per org)
    payload_jsonTEXTRaw ingest payload (JSON string)
    created_atTEXTRow created (ISO)

    Example row

    {
      "id": "wse_4f8a1b2c",
      "org_id": "org_7f3a9c2e",
      "workspace_id": "ws_northstar",
      "lead_id": 1042,
      "workspace_lead_id": "wl_9b2c4d1e",
      "event_type": "email_reply",
      "event_at": "2026-06-16T18:03:00Z",
      "source_platform": "smartlead",
      "external_event_id": "sl_evt_88291",
      "idempotency_key": "smartlead:sl_evt_88291",
      "payload_json": "{\"reply_body\":\"Thanks for reaching out...\"}",
      "created_at": "2026-06-16T18:03:12Z"
    }

    campaign_workspace_map

    Maps platform campaign IDs or normalized names to a workspace.

    FieldTypeDescription
    idTEXTMap row UUID
    org_idTEXTOrg UUID
    source_platformTEXTPlatform identifier
    campaign_idTEXTExternal campaign ID
    campaign_name_normalizedTEXTLowercase trimmed name for fuzzy match
    workspace_idTEXTFK to workspaces.id
    match_strategyTEXTid_exact or name_normalized
    priorityINTEGERLower wins on conflict
    is_activeINTEGER1 if rule is active
    cloud_syncedINTEGER1 if synced to cloud
    created_atTEXTRow created (ISO)
    updated_atTEXTRow updated (ISO)

    Example row

    {
      "id": "cwm_1a2b3c4d",
      "org_id": "org_7f3a9c2e",
      "source_platform": "smartlead",
      "campaign_id": "cmp_abc123",
      "campaign_name_normalized": "q2 freight ops",
      "workspace_id": "ws_northstar",
      "match_strategy": "id_exact",
      "priority": 100,
      "is_active": 1,
      "cloud_synced": 1,
      "created_at": "2026-04-01T09:00:00Z",
      "updated_at": "2026-04-01T09:00:00Z"
    }

    unmapped_campaign_queue

    Quarantined webhook events when no workspace mapping exists. Resolve via agent or portal, then sync.

    FieldTypeDescription
    idTEXTQueue row UUID
    org_idTEXTOrg UUID
    source_platformTEXTPlatform identifier
    campaign_idTEXTExternal campaign ID
    campaign_name_rawTEXTRaw campaign name from webhook
    campaign_name_normalizedTEXTNormalized name
    external_event_idTEXTPlatform event ID
    reasonTEXTWhy event was quarantined
    statusTEXTpending, resolved, or dismissed
    payload_jsonTEXTFull webhook payload (JSON string)
    received_atTEXTWhen webhook arrived (ISO)
    resolved_atTEXTWhen mapping was assigned (ISO)
    cloud_pendingINTEGER1 if resolution awaits cloud sync
    assigned_workspaceTEXTWorkspace assigned on resolve

    Example row

    {
      "id": "ucq_5e6f7g8h",
      "org_id": "org_7f3a9c2e",
      "source_platform": "instantly",
      "campaign_id": "inst_cmp_991",
      "campaign_name_raw": "New Client Test",
      "campaign_name_normalized": "new client test",
      "external_event_id": "inst_evt_44102",
      "reason": "no_workspace_mapping",
      "status": "pending",
      "payload_json": "{\"event\":\"reply\",\"lead_email\":\"test@example.com\"}",
      "received_at": "2026-06-17T12:00:00Z",
      "resolved_at": null,
      "cloud_pending": 1,
      "assigned_workspace": null
    }

    Identity and deduplication

    Cross-platform identity keys, merge history, and webhook dedupe.

    lead_identities

    Normalized identity keys (email, LinkedIn URL, etc.) per org for dedup and matching.

    FieldTypeDescription
    idTEXTIdentity UUID
    org_idTEXTOrg UUID
    lead_idINTEGERFK to leads.id
    identity_typeTEXTemail, linkedin_url, linkedin_id, etc.
    identity_value_normalizedTEXTLowercase normalized value
    sourceTEXTWhere identity was first seen
    is_verifiedINTEGER1 if verified
    created_atTEXTRow created (ISO)

    Example row

    {
      "id": "lid_3c4d5e6f",
      "org_id": "org_7f3a9c2e",
      "lead_id": 1042,
      "identity_type": "email",
      "identity_value_normalized": "jordan.lee@northstarlogistics.com",
      "source": "smartlead",
      "is_verified": 1,
      "created_at": "2026-05-12T14:22:00Z"
    }

    lead_merges

    Audit trail when duplicate leads are merged. merge_id is the deleted lead.

    FieldTypeDescription
    idINTEGERPrimary key
    keep_idINTEGERSurviving lead FK
    merge_idINTEGERMerged-away lead ID (no FK)
    reasonTEXTWhy merge happened
    merge_entity_keyTEXTDedup key used
    relay_delete_pushedINTEGER1 if cloud delete was sent
    merged_atTEXTMerge timestamp (ISO)

    Example row

    {
      "id": 42,
      "keep_id": 1042,
      "merge_id": 1038,
      "reason": "duplicate_email",
      "merge_entity_key": "email:jordan.lee@northstarlogistics.com",
      "relay_delete_pushed": 1,
      "merged_at": "2026-05-20T16:45:00Z"
    }

    lead_merge_jobs

    Cloud-side merge job records with audit JSON.

    FieldTypeDescription
    idTEXTJob UUID
    org_idTEXTOrg UUID
    keep_lead_idINTEGERSurviving lead
    merge_lead_idINTEGERMerged lead
    statusTEXTcompleted, pending, or failed
    reasonTEXTMerge reason
    audit_jsonTEXTField-level merge audit (JSON string)
    created_atTEXTJob created (ISO)

    Example row

    {
      "id": "lmj_8h9i0j1k",
      "org_id": "org_7f3a9c2e",
      "keep_lead_id": 1042,
      "merge_lead_id": 1038,
      "status": "completed",
      "reason": "sheet_review_approved",
      "audit_json": "{\"fields_merged\":[\"title\",\"linkedin_url\"]}",
      "created_at": "2026-05-20T16:45:00Z"
    }

    relay_ingested

    Webhook dedupe keys. Prevents the same platform event from being applied twice.

    FieldTypeDescription
    dedupe_keyTEXTPrimary key (platform:event_id)
    lead_idINTEGERLead that received the event
    ingested_atTEXTWhen ingest completed (ISO)

    Example row

    {
      "dedupe_key": "smartlead:sl_evt_88291",
      "lead_id": 1042,
      "ingested_at": "2026-06-16T18:03:12Z"
    }

    Enrichment and attributes

    Clay imports, custom fields, tags, and LinkedIn connection state per sender profile.

    lead_personalization

    Key-value custom fields on leads (Clay columns, API attributes, etc.).

    FieldTypeDescription
    lead_idINTEGERFK to leads.id (PK part)
    field_nameTEXTAttribute key (PK part)
    field_valueTEXTAttribute value
    field_dateTEXTOptional date associated with value
    source_hashTEXTHash of source row for change detection
    processed_atTEXTWhen field was last written (ISO)
    cloud_pendingINTEGER1 if awaiting cloud sync

    Example row

    {
      "lead_id": 1042,
      "field_name": "icp_tier",
      "field_value": "A",
      "field_date": null,
      "source_hash": "clay_row_99102",
      "processed_at": "2026-06-01T10:00:00Z",
      "cloud_pending": 0
    }

    company_personalization

    Key-value custom fields on companies.

    FieldTypeDescription
    company_idINTEGERFK to companies.id (PK part)
    field_nameTEXTAttribute key (PK part)
    field_valueTEXTAttribute value
    field_dateTEXTOptional date
    source_hashTEXTSource row hash
    processed_atTEXTLast written (ISO)
    cloud_pendingINTEGER1 if awaiting cloud sync

    Example row

    {
      "company_id": 88,
      "field_name": "tech_stack",
      "field_value": "Salesforce, NetSuite",
      "field_date": null,
      "source_hash": "clay_co_4410",
      "processed_at": "2026-06-01T10:00:00Z",
      "cloud_pending": 0
    }

    workspace_lead_tags

    Tags on leads within a workspace (ICP, list source, exclusion flags, etc.).

    FieldTypeDescription
    idTEXTTag row UUID
    workspace_idTEXTFK to workspaces.id
    lead_idINTEGERFK to leads.id
    tagTEXTTag string
    created_atTEXTRow created (ISO)

    Example row

    {
      "id": "wlt_2a3b4c5d",
      "workspace_id": "ws_northstar",
      "lead_id": 1042,
      "tag": "icp:a-tier",
      "created_at": "2026-05-12T14:35:00Z"
    }

    workspace_lead_linkedin_status

    LinkedIn connection state per lead, workspace, and sender profile (HeyReach, Prosp).

    FieldTypeDescription
    idTEXTStatus row UUID
    workspace_idTEXTFK to workspaces.id
    lead_idINTEGERFK to leads.id
    sender_profileTEXTLinkedIn sender account URL or ID
    is_connectedINTEGER1 if connected
    is_request_pendingINTEGER1 if invite pending
    connected_atTEXTWhen connection was accepted (ISO)
    request_sent_atTEXTWhen invite was sent (ISO)
    updated_atTEXTRow updated (ISO)

    Example row

    {
      "id": "llis_6e7f8g9h",
      "workspace_id": "ws_northstar",
      "lead_id": 1042,
      "sender_profile": "https://www.linkedin.com/in/alex-sender",
      "is_connected": 1,
      "is_request_pending": 0,
      "connected_at": "2026-06-10T14:00:00Z",
      "request_sent_at": "2026-06-08T09:30:00Z",
      "updated_at": "2026-06-10T14:00:00Z"
    }

    Deliverability

    Email verification results and bounce tracking across senders and platforms.

    lead_email_verification

    Verification results from Prospeo, Icypeas, Clay, or bounce-driven updates.

    FieldTypeDescription
    idTEXTVerification UUID
    org_idTEXTOrg UUID
    lead_idINTEGERFK to leads.id
    emailTEXTVerified address
    statusTEXTvalid, invalid, catch_all, unknown
    sub_statusTEXTProvider-specific detail
    sourceTEXTprospeo, icypeas, bounce, etc.
    source_detailTEXTProvider response snippet
    bounce_messageTEXTSMTP bounce text if applicable
    free_emailINTEGER1 if free provider (Gmail, etc.)
    mx_foundINTEGER1 if MX records exist
    smtp_providerTEXTDetected mail host
    verified_atTEXTVerification time (ISO)
    created_atTEXTRow created (ISO)

    Example row

    {
      "id": "lev_1x2y3z4a",
      "org_id": "org_7f3a9c2e",
      "lead_id": 1042,
      "email": "jordan.lee@northstarlogistics.com",
      "status": "valid",
      "sub_status": "ok",
      "source": "prospeo",
      "source_detail": "smtp_check_passed",
      "bounce_message": null,
      "free_email": 0,
      "mx_found": 1,
      "smtp_provider": "Google Workspace",
      "verified_at": "2026-05-12T14:25:00Z",
      "created_at": "2026-05-12T14:25:00Z"
    }

    bounce_events

    Aggregated bounce records per lead and sender. Links back to events for forensics.

    FieldTypeDescription
    idTEXTBounce row UUID
    org_idTEXTOrg UUID
    lead_idINTEGERFK to leads.id
    first_event_idINTEGERFK to first events.id
    latest_event_idINTEGERFK to latest events.id
    platformTEXTsmartlead, instantly, etc.
    sender_emailTEXTSending mailbox
    lead_emailTEXTBounced recipient
    bounce_typeTEXThard, soft, or unknown
    bounce_messageTEXTSMTP diagnostic
    smtp_codeTEXTSMTP status code
    recipient_mxTEXTRecipient mail host
    sender_mxTEXTSender mail host
    campaign_idINTEGERFK to campaigns.id
    campaign_nameTEXTDenormalized campaign name
    workspace_idTEXTWorkspace UUID
    relay_idTEXTInternal ingest ID
    occurrence_countINTEGERTimes this bounce repeated
    first_seen_atTEXTFirst bounce (ISO)
    last_seen_atTEXTMost recent bounce (ISO)
    created_atTEXTRow created (ISO)
    updated_atTEXTRow updated (ISO)

    Example row

    {
      "id": "be_9k8j7h6g",
      "org_id": "org_7f3a9c2e",
      "lead_id": 991,
      "first_event_id": 97001,
      "latest_event_id": 97001,
      "platform": "instantly",
      "sender_email": "outreach@agency-mail.com",
      "lead_email": "bad-address@oldcorp.com",
      "bounce_type": "hard",
      "bounce_message": "550 5.1.1 User unknown",
      "smtp_code": "550",
      "recipient_mx": "oldcorp.com",
      "sender_mx": "agency-mail.com",
      "campaign_id": 22,
      "campaign_name": "northstar | re-engage list",
      "workspace_id": "ws_northstar",
      "relay_id": "rly_88210",
      "occurrence_count": 1,
      "first_seen_at": "2026-06-15T11:22:00Z",
      "last_seen_at": "2026-06-15T11:22:00Z",
      "created_at": "2026-06-15T11:22:05Z",
      "updated_at": "2026-06-15T11:22:05Z"
    }

    Analytics views

    Read-only SQL views applied on init and migrate. Not tables, but queryable like tables.

    v_inbound_events_by_campaign

    Pre-joined view of inbound events with campaign names. Faster reply and engagement queries.

    FieldTypeDescription
    event_idINTEGERevents.id
    lead_idINTEGERevents.lead_id
    event_typeTEXTevents.event_type
    directionTEXTAlways inbound in this view
    channelTEXTemail or linkedin
    created_atTEXTEvent timestamp
    campaign_idINTEGERcampaigns.id (nullable)
    campaign_nameTEXTcampaigns.name (nullable)

    Example row

    {
      "event_id": 98231,
      "lead_id": 1042,
      "event_type": "email_reply",
      "direction": "inbound",
      "channel": "email",
      "created_at": "2026-06-16T18:03:00Z",
      "campaign_id": 14,
      "campaign_name": "northstar | Q2 freight ops"
    }

    Example SQL queries

    Pair these with prompts from the agent prompts guide or ask your agent to run pipeline.py query presets.

    Inbound engagement by campaign (last 48 hours)

    SELECT c.name, e.event_type, COUNT(*) AS count
    FROM events e
    LEFT JOIN campaigns c ON e.campaign_id = c.id
    WHERE c.name LIKE 'northstar |%'
      AND e.created_at >= datetime('now', '-48 hours')
      AND lower(coalesce(e.direction, '')) = 'inbound'
    GROUP BY c.name, e.event_type
    ORDER BY count DESC;

    Reply count by campaign (last 7 days)

    SELECT c.name, COUNT(*) AS replies
    FROM events e
    LEFT JOIN campaigns c ON e.campaign_id = c.id
    WHERE c.name LIKE 'northstar |%'
      AND (
        lower(e.event_type) IN ('email_reply', 'linkedin_reply')
        OR (lower(e.direction) = 'inbound' AND lower(e.event_type) = 'email')
      )
      AND e.created_at >= datetime('now', '-7 days')
    GROUP BY c.name
    ORDER BY replies DESC;

    Recent timeline for one lead

    SELECT event_type, direction, subject, created_at
    FROM events
    WHERE lead_id = 1042
    ORDER BY created_at DESC
    LIMIT 50;

    Workspace lead status with sentiment

    SELECT l.name, l.email, wl.status, wl.current_status_sentiment, wl.last_activity_at
    FROM workspace_leads wl
    JOIN leads l ON l.id = wl.lead_id
    WHERE wl.workspace_id = 'ws_northstar'
    ORDER BY wl.last_activity_at DESC
    LIMIT 25;

    Hard bounces this week by sender

    SELECT sender_email, COUNT(*) AS hard_bounces
    FROM bounce_events
    WHERE bounce_type = 'hard'
      AND last_seen_at >= datetime('now', '-7 days')
    GROUP BY sender_email
    ORDER BY hard_bounces DESC;

    Common questions

    Where does Outreach Magic store my lead data?

    In a local SQLite file on your machine (typically outreachmagic.db under the skill home). Webhooks route through our servers on the way in, but the pipeline database stays local. Your agent queries the file directly.

    Which table should I query for replies and bounces?

    Use the events table for reply rates, campaign breakdowns, and timelines. bounce_events aggregates hard and soft bounces per lead and sender. workspace_lead_events is an ingest audit log, not the full event volume.

    How do workspaces relate to campaigns?

    Each workspace is a client or brand partition. campaign_workspace_map routes platform campaign IDs or names to a workspace. Campaign names in the campaigns table often use a workspace prefix like northstar | campaign name.

    Does every sequencer write the same event types?

    Event types vary by platform (Smartlead, Instantly, HeyReach, PlusVibe, EmailBison, Prosp), but all normalize into the same events and leads tables. Check metadata_json on events for platform-specific fields.

    Related resources

    Ready to query your pipeline?

    Install the skill, connect a sequencer webhook, and ask your agent who replied today.