Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sendpilot.ai/llms.txt

Use this file to discover all available pages before exploring further.

This event is triggered when a Lead Extractor (LinkedIn scraper) campaign finishes extracting and optionally enriching leads.

When This Event Fires

  • A Lead Extractor campaign initiated via the API completes
  • All leads have been extracted from the provided LinkedIn search URLs
  • Enrichment is complete (if enabled)
  • The campaign status changes to FINISHED

Payload

{
  "eventId": "evt_1708456789123_abc123def",
  "eventType": "lead_extractor.job.completed",
  "timestamp": "2024-02-24T10:30:00.000Z",
  "workspaceId": "ws_abc123xyz",
  "data": {
    "campaign_id": "camp_abc123",
    "campaign_name": "Tech Startup Founders",
    "campaign_type": "SEARCH",
    "mode": "with_enrichment",
    "search_urls": [
      "https://www.linkedin.com/search/results/people/?keywords=CEO%20startup"
    ],
    "total_leads_extracted": 100,
    "total_leads_enriched": 95,
    "requested_limit": 100,
    "started_at": "2024-02-24T10:00:00.000Z",
    "completed_at": "2024-02-24T10:30:00.000Z",
    "duration_ms": 1800000,
    "credits_used": {
      "extraction": 100,
      "enrichment": 100,
      "total": 200
    },
    "leads": [
      {
        "id": "lead_xyz789",
        "linkedin_identifier": "johndoe",
        "linkedin_url": "https://www.linkedin.com/in/johndoe",
        "first_name": "John",
        "last_name": "Doe",
        "full_name": "John Doe",
        "headline": "CEO at TechCorp | Building the future of AI",
        "summary": "Experienced technology executive with 15+ years...",
        "location": "San Francisco Bay Area",
        "city": "San Francisco",
        "country": "United States",
        "profile_picture_url": "https://media.licdn.com/...",
        "company": "TechCorp Inc",
        "job_position": "CEO",
        "email": "john.doe@techcorp.com",
        "phone": "+1-555-123-4567",
        "connections": 500,
        "followers": 12500,
        "experience": [
          {
            "title": "CEO",
            "company": "TechCorp Inc",
            "duration": "2020 - Present"
          }
        ],
        "education": [
          {
            "school": "Stanford University",
            "degree": "MBA"
          }
        ],
        "skills": ["Leadership", "Strategy", "AI/ML"]
      }
    ],
    "results_url": "/v1/lead-extractor/campaigns/camp_abc123/results"
  }
}

Payload Fields

FieldTypeDescription
eventIdstringUnique event identifier for idempotency
eventTypestringAlways lead_extractor.job.completed
timestampstringISO 8601 timestamp when the job completed
workspaceIdstringYour workspace ID
data.campaign_idstringUnique identifier for the campaign
data.campaign_namestringName you provided for the campaign
data.campaign_typestringType: SEARCH, SALES_NAVIGATOR, or POST_ENGAGEMENT
data.modestringextraction_only or with_enrichment
data.search_urlsarrayLinkedIn search URLs that were scraped
data.total_leads_extractednumberTotal leads extracted
data.total_leads_enrichednumberLeads with enrichment data (0 if extraction_only)
data.requested_limitnumberMaximum leads you requested
data.started_atstringWhen the campaign started
data.completed_atstringWhen the campaign completed
data.duration_msnumberProcessing time in milliseconds
data.credits_usedobjectCredits consumed breakdown
data.leadsarrayArray of all extracted leads with full data
data.results_urlstringAPI endpoint to fetch results

Lead Object Fields

Each lead in the leads array contains extensive profile data:
FieldTypeDescription
idstringUnique lead identifier
linkedin_identifierstringLinkedIn username
linkedin_urlstringFull LinkedIn profile URL
first_namestringFirst name
last_namestringLast name
full_namestringFull name
headlinestringLinkedIn headline
summarystringProfile summary/about
locationstringLocation string
citystringCity
countrystringCountry
profile_picture_urlstringProfile photo URL
companystringCurrent company
job_positionstringCurrent job title
emailstringEmail (if enriched)
phonestringPhone (if enriched)
connectionsnumberConnection count
followersnumberFollower count
experiencearrayWork experience history
educationarrayEducation history
skillsarrayListed skills

Use Cases

CRM Import

Automatically import enriched leads into your CRM

Outreach Campaigns

Trigger LinkedIn outreach campaigns with extracted leads

Lead Scoring

Score and prioritize leads based on profile data

Data Sync

Keep your lead database in sync with LinkedIn

Example Handler

app.post('/webhooks/sendpilot', (req, res) => {
  const event = req.body;
  
  if (event.eventType === 'lead_extractor.job.completed') {
    const { 
      campaign_id, 
      campaign_name, 
      total_leads_extracted,
      credits_used,
      leads 
    } = event.data;
    
    // Import leads to CRM with enriched data
    for (const lead of leads) {
      await crm.createOrUpdateLead({
        firstName: lead.first_name,
        lastName: lead.last_name,
        email: lead.email,
        phone: lead.phone,
        company: lead.company,
        title: lead.job_position,
        linkedinUrl: lead.linkedin_url,
        headline: lead.headline,
        location: lead.location,
        source: `SendPilot Extractor: ${campaign_name}`
      });
    }
    
    // Send notification with credits summary
    await slack.notify({
      channel: '#lead-generation',
      text: `✅ Lead Extractor "${campaign_name}" completed!\n` +
            `Extracted: ${total_leads_extracted} leads\n` +
            `Credits used: ${credits_used.total}`
    });
    
    console.log(`Campaign ${campaign_id} completed with ${total_leads_extracted} leads`);
  }
  
  res.status(200).send('OK');
});
The leads array contains all extracted leads with complete profile data. For campaigns with enrichment enabled, email and phone fields will be populated when available.