How to Sync Instagram Data to Airtable (Complete Guide)
Airtable is perfect for building databases, and Instagram data makes it powerful for marketing, sales, and research.
This guide shows you how to automatically sync Instagram data to Airtable using SociaVault. Learn more about how to scrape social media data for your projects.
Need reliable Instagram data access? Check our Instagram API alternatives guide.
Starting out? Try free Instagram API options first.
What You'll Build
- An Airtable base with Instagram profile data
- Automatic sync of followers, posts, and engagement
- Filterable, sortable influencer database
- Linked records for posts and comments
Prerequisites
- Airtable account (free tier works)
- SociaVault API key
- Basic understanding of Airtable
Step 1: Set Up Your Airtable Base
Create a new Airtable base with these tables:
Table 1: Profiles
| Field Name | Field Type |
|---|---|
| Username | Single line text (Primary) |
| Full Name | Single line text |
| Bio | Long text |
| Followers | Number |
| Following | Number |
| Posts Count | Number |
| Engagement Rate | Percent |
| Profile URL | URL |
| Last Updated | Date |
| Posts | Link to Posts table |
Table 2: Posts (Optional)
| Field Name | Field Type |
|---|---|
| Post ID | Single line text (Primary) |
| Profile | Link to Profiles |
| Caption | Long text |
| Likes | Number |
| Comments | Number |
| Post Type | Single select (Photo, Video, Reel, Carousel) |
| Posted Date | Date |
| URL | URL |
Step 2: Get Your Airtable API Key
- Go to airtable.com/create/tokens
- Create a new personal access token
- Add scopes:
data.records:read,data.records:write - Add your base to the token
- Copy the token
Step 3: Create the Sync Script
You can run this as a Node.js script, in Airtable Automations, or in n8n/Zapier.
Node.js Script
const Airtable = require('airtable');
// Configuration
const SOCIAVAULT_API_KEY = 'your_sociavault_key';
const AIRTABLE_API_KEY = 'your_airtable_key';
const AIRTABLE_BASE_ID = 'your_base_id';
// Initialize Airtable
const base = new Airtable({ apiKey: AIRTABLE_API_KEY }).base(AIRTABLE_BASE_ID);
// Fetch Instagram profile from SociaVault
async function getInstagramProfile(username) {
const response = await fetch('https://api.sociavault.com/instagram/profile', {
method: 'POST',
headers: {
'Authorization': `Bearer ${SOCIAVAULT_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ username })
});
return response.json();
}
// Update or create Airtable record
async function syncProfile(username) {
// Get Instagram data
const profile = await getInstagramProfile(username);
if (profile.error) {
console.error(`Error fetching ${username}:`, profile.error);
return;
}
// Calculate engagement rate (simplified)
const engagementRate = profile.posts_count > 0
? (profile.avg_likes / profile.followers) * 100
: 0;
// Prepare Airtable fields
const fields = {
'Username': profile.username,
'Full Name': profile.full_name || '',
'Bio': profile.bio || '',
'Followers': profile.followers,
'Following': profile.following,
'Posts Count': profile.posts_count,
'Engagement Rate': engagementRate / 100,
'Profile URL': `https://instagram.com/${profile.username}`,
'Last Updated': new Date().toISOString().split('T')[0]
};
// Find existing record
const existing = await base('Profiles')
.select({
filterByFormula: `{Username} = '${username}'`,
maxRecords: 1
})
.firstPage();
if (existing.length > 0) {
// Update existing record
await base('Profiles').update(existing[0].id, fields);
console.log(`Updated: ${username}`);
} else {
// Create new record
await base('Profiles').create(fields);
console.log(`Created: ${username}`);
}
}
// Sync multiple profiles
async function syncAllProfiles() {
// Get all usernames from Airtable
const records = await base('Profiles')
.select({ fields: ['Username'] })
.all();
for (const record of records) {
const username = record.get('Username');
if (username) {
await syncProfile(username);
// Rate limiting
await new Promise(r => setTimeout(r, 1000));
}
}
}
// Run
syncAllProfiles().then(() => console.log('Sync complete!'));
Using Airtable Automations
Airtable has built-in automations with scripting:
- Go to Automations in your base
- Create new automation
- Trigger: At scheduled time (daily)
- Action: Run script
- Paste this script:
// Get all records that need updating
let table = base.getTable('Profiles');
let query = await table.selectRecordsAsync({ fields: ['Username'] });
for (let record of query.records) {
let username = record.getCellValue('Username');
if (!username) continue;
// Call SociaVault API
let response = await fetch('https://api.sociavault.com/instagram/profile', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ username })
});
let data = await response.json();
if (!data.error) {
await table.updateRecordAsync(record.id, {
'Full Name': data.full_name || '',
'Bio': data.bio || '',
'Followers': data.followers,
'Following': data.following,
'Posts Count': data.posts_count,
'Last Updated': new Date()
});
}
}
Step 4: Add New Profiles Easily
Create an Airtable form or interface to add new Instagram usernames. The sync script will automatically fetch their data on the next run.
Or add a button field that triggers an automation to fetch data immediately.
Step 5: Sync Posts Data (Optional)
To track individual posts:
async function syncProfilePosts(username, profileRecordId) {
// Get recent posts from SociaVault
const response = await fetch('https://api.sociavault.com/instagram/posts', {
method: 'POST',
headers: {
'Authorization': `Bearer ${SOCIAVAULT_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ username, count: 12 })
});
const { posts } = await response.json();
for (const post of posts) {
const fields = {
'Post ID': post.id,
'Profile': [profileRecordId], // Link to profile
'Caption': post.caption || '',
'Likes': post.likes,
'Comments': post.comments,
'Post Type': post.type,
'Posted Date': post.timestamp,
'URL': post.url
};
// Check if post exists
const existing = await base('Posts')
.select({
filterByFormula: `{Post ID} = '${post.id}'`,
maxRecords: 1
})
.firstPage();
if (existing.length > 0) {
await base('Posts').update(existing[0].id, fields);
} else {
await base('Posts').create(fields);
}
}
}
Useful Airtable Views
Create these views to analyze your data:
Top Influencers
- Filter: Followers > 10000
- Sort: Followers (descending)
High Engagement
- Filter: Engagement Rate > 3%
- Sort: Engagement Rate (descending)
Recently Updated
- Sort: Last Updated (descending)
Needs Update
- Filter: Last Updated < 7 days ago
Cost Calculation
- Profile sync: 1 credit per profile
- Posts sync: 1 credit per request (up to 12 posts)
Example:
- 500 profiles, weekly sync = 500 credits/week = 2,000/month
- Growth pack ($79 for 20,000 credits) = 10 months of syncing
Automation Schedule
Recommended sync frequency:
| Use Case | Frequency |
|---|---|
| Competitor tracking | Daily |
| Influencer database | Weekly |
| One-time research | Manual |
Troubleshooting
"Exceeded rate limit"
Add delays between API calls:
await new Promise(r => setTimeout(r, 1000));
"Record not found"
The Instagram username might be incorrect or the account private.
Airtable script timeout
For large databases, process in batches or use external scripts with cron jobs.
Next Steps
- Sign up for SociaVault (50 free credits)
- Create your Airtable base using the schema above
- Set up the sync script
- Add Instagram usernames and watch the magic!
Related Articles
Found this helpful?
Share it with others who might benefit
Ready to Try SociaVault?
Start extracting social media data with our powerful API. No credit card required.