Finding influencers is easy. Getting their contact information and actually reaching out to them is the hard part.
Most marketers spend hours manually scrolling through Instagram and TikTok bios, looking for an email address, copying it into a spreadsheet, and sending generic templates.
As developers, we can automate this entire workflow.
In this tutorial, I'll show you how to build a Node.js pipeline that:
- Scrapes a list of influencers based on a hashtag.
- Uses Regex to extract email addresses from their bios.
- Filters out agencies and management companies.
- Generates a CSV ready for your cold email tool (like Lemlist or Instantly).
The Tech Stack
- Node.js
- SociaVault API (for scraping Instagram/TikTok without getting blocked)
- json2csv (for exporting the data)
Step 1: Setup
npm init -y
npm install axios dotenv json2csv
Create your .env file:
SOCIAVAULT_API_KEY=your_api_key_here
Step 2: Fetching Influencers
We'll use SociaVault to search for recent posts under a specific hashtag (e.g., #skincareroutine), and then extract the profile information of the creators.
require('dotenv').config();
const axios = require('axios');
const { Parser } = require('json2csv');
const fs = require('fs');
const API_KEY = process.env.SOCIAVAULT_API_KEY;
const BASE_URL = 'https://api.sociavault.com/v1';
async function getCreatorsByHashtag(hashtag, limit = 50) {
console.log(`Fetching posts for #${hashtag}...`);
try {
const response = await axios.get(`${BASE_URL}/instagram/hashtag/posts`, {
headers: { 'Authorization': `Bearer ${API_KEY}` },
params: { hashtag, limit }
});
// Extract unique creators from the posts
const creators = new Map();
response.data.data.forEach(post => {
const owner = post.owner;
if (!creators.has(owner.username)) {
creators.set(owner.username, owner);
}
});
return Array.from(creators.values());
} catch (error) {
console.error('Error fetching creators:', error.message);
return [];
}
}
Step 3: Extracting Emails with Regex
Many creators put their email in their bio. We need a robust Regex to find it. We also want to filter out emails that belong to talent agencies (e.g., management@..., collabs@agency.com).
function extractEmail(text) {
if (!text) return null;
// Standard email regex
const emailRegex = /([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+\.[a-zA-Z0-9_-]+)/gi;
const matches = text.match(emailRegex);
if (!matches) return null;
const email = matches[0].toLowerCase();
// Filter out common agency/management emails
const agencyKeywords = ['management', 'agency', 'talent', 'collab', 'pr@'];
const isAgency = agencyKeywords.some(keyword => email.includes(keyword));
if (isAgency) {
return null; // Skip agencies, we want direct contact
}
return email;
}
Step 4: Enriching Profiles
The hashtag search gives us basic profile info. To get the full bio (where the email lives), we need to fetch the full profile details.
async function enrichCreatorProfile(username) {
try {
const response = await axios.get(`${BASE_URL}/instagram/profile`, {
headers: { 'Authorization': `Bearer ${API_KEY}` },
params: { username }
});
const profile = response.data.data;
const email = extractEmail(profile.biography) || profile.public_email;
return {
username: profile.username,
full_name: profile.full_name,
followers: profile.followers_count,
engagement_rate: profile.engagement_rate,
email: email,
bio: profile.biography.replace(/\n/g, ' ') // Clean up newlines
};
} catch (error) {
return null;
}
}
Step 5: Putting It All Together
Now we orchestrate the pipeline: Fetch posts -> Get unique creators -> Enrich profiles -> Extract emails -> Save to CSV.
async function runPipeline(hashtag) {
const creators = await getCreatorsByHashtag(hashtag, 50);
console.log(`Found ${creators.length} unique creators. Enriching profiles...`);
const leads = [];
for (const creator of creators) {
// Add a small delay to be polite to the API
await new Promise(resolve => setTimeout(resolve, 500));
const enriched = await enrichCreatorProfile(creator.username);
// Only keep creators who have an email AND have over 10k followers
if (enriched && enriched.email && enriched.followers > 10000) {
console.log(`✅ Found lead: ${enriched.username} (${enriched.email})`);
leads.push(enriched);
}
}
console.log(`\nPipeline complete! Found ${leads.length} qualified leads with emails.`);
if (leads.length > 0) {
// Export to CSV
const parser = new Parser();
const csv = parser.parse(leads);
fs.writeFileSync(`${hashtag}_leads.csv`, csv);
console.log(`Saved to ${hashtag}_leads.csv`);
}
}
// Run it!
runPipeline('skincareroutine');
The Result
When you run this script, it will output a clean CSV file containing:
- Username
- Full Name
- Follower Count
- Engagement Rate
- Verified Email Address
You can upload this CSV directly into your cold email software. Because you have their full_name and username, you can write highly personalized email templates:
"Hey {{full_name}}, loved your recent post on your {{username}} account about #skincareroutine..."
Scaling Up
If you try to build this using Puppeteer or Playwright, Instagram will block your IP address within 10 minutes.
By using SociaVault, you bypass login walls, CAPTCHAs, and IP bans. You just make a REST API call and get clean JSON data back.
Get your free API key at SociaVault.com and automate your influencer outreach today.
Top comments (0)