Scrape Followers, Following, and Optionally Enrich Emails with Apify

If you need a practical and scalable way to generate leads from Twitter/X, this workflow gives you a clean production baseline in n8n.
It combines follower collection and optional email enrichment in one structured flow, so your team can run campaigns without rebuilding logic every time.
This template is built for execution, not experimentation. It is designed to help agencies, founders, growth teams, and sales ops run repeatable social lead generation with predictable inputs and clean outputs.
Why This Workflow Matters
Most Twitter/X scraping automations fail in operations, not in scraping itself.
Typical pain points include inconsistent input formats, unstable branching, overuse of enrichment, and messy outputs that require manual cleanup before outreach.
This workflow addresses those issues by default:
It extracts usernames automatically from profile URLs.
It separates social collection from email enrichment using a strict control flag.
It returns normalized records plus CSV-ready data.
It stays understandable for non-technical operators.
The result is faster setup, clearer control over costs, and easier handoff into CRM or sales workflows.
What the Workflow Does
Step 1: Intake and Input Validation
The flow starts with a webhook and accepts a profile URL (or username).
If required fields are missing, the workflow asks for them in sequence, creating a conversational run experience instead of a brittle one-shot payload.
Step 2: Username Normalization
The workflow parses x.com/... or twitter.com/... links and extracts a clean username for actor input.
This removes a common source of actor errors and makes user input more forgiving.
Step 3: Followers/Following Collection
The first Apify actor runs and collects followers, following, or both, based on run parameters.
Collection size can be exact (number) or broad (all) depending on campaign needs.
Step 4: Optional Email Enrichment
The second Apify actor runs only when includeEmails=true.
If includeEmails=false, the flow skips enrichment entirely and returns faster with lower run cost.
Step 5: Structured Delivery
The final output includes:
a summary block,
normalized rows,
CSV-ready content.
This makes the data immediately usable for outreach operations.
Apify Actors Used
Followers / Following Actor
Actor ID: bIYXeMcKISYGnHhBG
This actor handles audience graph collection and is used as the primary source for lead usernames.
Email Enrichment Actor
Actor ID: mSaHt2tt3Z7Fcwf0o
This actor is used only when enrichment is explicitly requested and adds contactability depth to selected leads.
Input Model
Use the following fields when triggering the workflow:
targetLink — Twitter/X profile URL or @username
collectType — followers | following | both
limitMode — number | all
limit — required when limitMode=number
includeEmails — true to enrich, false to skip enrichment
outputTarget — recommended default: json
Example Request
{ "targetLink": "https://x.com/elonmusk", "collectType": "followers", "limitMode": "number", "limit": 1000, "includeEmails": true, "outputTarget": "json"}
Output Structure
The workflow returns a clear summary for immediate decision-making:
run status
target username
total records collected
number of emails found (if enrichment enabled)
It also returns a full record array and CSV-ready content, so the same run output can feed analytics and outreach systems without reformatting.
Practical Use Cases
Audience Prospecting
Collect followers from relevant accounts and build initial lead pools for outbound campaigns.
Competitive Mapping
Collect following relationships to understand adjacency and overlap in niche markets.
Enrichment on Demand
Run email enrichment only for shortlisted segments to control budget and improve signal quality.
Sales Ops Export
Use normalized output for direct import into Sheets, CRM tools, or custom internal systems.
Setup Requirements
Required
n8n instance
Apify credentials configured in n8n (Apify account)
Optional Extensions
Google Sheets for logging and team visibility
Telegram for run notifications
CRM/API connector nodes for immediate lead routing
Who This Template Is For
This workflow is especially useful for:
agencies running multi-client lead campaigns,
founders doing lean outbound from social channels,
growth teams that need repeatable top-of-funnel data acquisition,
sales operations teams that need clean, consistent lead payloads.
Repository and Workflow Export
Full template code and documentation:
https://github.com/hundevmode/n8n-twitter-x-leads-agent-template
The repository includes:
workflow JSON export,
setup guidance,
actor links,
request examples,
license for unrestricted usage.
Final Summary
This n8n template gives you a reliable Twitter/X lead generation engine with a clean operational model:
collect followers/following at scale,
enrich emails only when needed,
deliver structured output ready for action.
If your goal is to move from manual scraping to repeatable lead operations, this is a strong production starting point.

