Opening Problem Statement
Meet Alex, a social media analyst who closely monitors influencers and public figures, such as Max Verstappen, on Twitter. Manually sifting through tweets daily to find new posts, check their engagement, and track them in a spreadsheet or database is exhausting. Alex wastes hours each week copying tweet details and likes into Airtable, often missing important new tweets among repeated content. This manual process is prone to errors, duplicates, and significant time loss, hampering efficient social media insights.
Imagine losing precious hours each week to repetitive data entry—and worse, accidentally overlooking critical insights because some tweets were missed or duplicated. Alex needs a solution to automate collecting and storing only fresh, unrecorded tweets about Verstappen to Airtable, boosting accuracy and saving hours.
What This Automation Does
This tailored n8n workflow triggers manually and then:
- Searches Twitter for the latest 100 tweets mentioning “Verstappen,” with mixed result types.
- Retrieves the current list of stored tweets from an Airtable base tracking tweet details.
- Compares the newly fetched tweets with existing records to identify only genuinely new tweets by their unique Tweet IDs.
- Prepares detailed data including tweet text, likes count, author, timestamp, and a direct tweet URL.
- Adds only these new tweets to the Airtable list, preventing duplicates and maintaining an up-to-date dataset.
- Saves social media analysts like Alex approximately 3-5 hours weekly by eliminating manual tracking and data entry inefficiencies.
Prerequisites ⚙️
- n8n account (self-hosting optional via platforms like Hostinger).
- Twitter API credentials configured in n8n.
- Airtable API key and an Airtable base with a table ready to store tweets (fields for Tweet_id, Tweet, Likes, Author, Time, Tweet URL).
- Basic familiarity with n8n workflow editor.
Step-by-Step Guide to Set Up This Workflow
Step 1: Create a Manual Trigger Node
In the n8n editor, click + Add Node, search for and select Manual Trigger. This node lets you run the workflow on demand.
No configuration needed here. After adding, position it as the starting point.
Expected outcome: A node ready to manually start the workflow.
Step 2: Add Twitter Node to Search Tweets
Add a new node, select Twitter. Under parameters:
- Set Operation to Search.
- Enter verstappen as the search text.
- Set the limit to 100 tweets.
- In additional fields, set resultType to mixed to get diverse tweet types.
Expected outcome: This node fetches up to 100 latest tweets mentioning “verstappen”.
Step 3: Add Airtable Node to List Existing Tweets
Add an Airtable node set to List operation. Configure it with your Airtable Application ID and Table ID where tweets are stored.
Expected outcome: Retrieves all stored tweet entries.
Step 4: Set Retrieved Airtable Data Format
Add a Set node named Set_AT_list. Map fields from the Airtable output to create consistent tweet data fields: Tweet, Tweet_id, Tweet URL, Author, Time, and Likes (default 0 if missing).
Likes: ={{$node["get airtable list"].json["fields"]["Likes"] || 0}}
Expected outcome: Airtable tweet data formatted for comparison.
Step 5: Set Twitter Search Data Format
Add another Set node named set twitter data. Map Twitter node output for Likes, Tweet text, Tweet ID, Tweet URL (constructed), Author, and Time.
Example Tweet URL construction:
=https://twitter.com/{{$node["Twitter"].json["user"]["screen_name"]}}/status/{{$node["Twitter"].json["id_str"]}}
Expected outcome: Twitter data is prepared in the same format as Airtable data for merging.
Step 6: Filter to Keep Only New Tweets
Add a Merge node named Leave only new tweets. Configure it to Remove key matches based on Tweet_id between Twitter data and Airtable data.
This effectively excludes tweets already recorded.
Expected outcome: Only new, unique tweets remain for appending.
Step 7: Append New Tweets to Airtable
Add another Airtable node with Append operation, connected to the previous node. Configure credentials, Application, and Table.
This appends new tweets gathered from Twitter to your Airtable base.
Expected outcome: Airtable updates with new tweet records automatically.
Customizations ✏️
- Change search keyword: In the Twitter node, modify searchText to track mentions of any other topic or hashtag.
- Adjust result type: Modify resultType in Twitter node to “recent” for latest tweets only.
- Add additional fields: Include retweet count or user follower count by adding these to the Set nodes.
- Schedule automation: Replace Manual Trigger with a Cron node to run workflow at regular intervals.
- Change Airtable table: Connect to a different Airtable base or table by updating credentials and table ID.
Troubleshooting 🔧
Problem: Twitter node returns empty results
Cause: Either API limits exceeded or the keyword yielded no tweets at the moment.
Solution: Check Twitter API credentials, verify search query spelling, try different keywords.
Problem: Duplicate tweets appearing in Airtable
Cause: Merge node not correctly removing duplicates due to mismatched Tweet_id field mapping.
Solution: Verify the Tweet_id field is identically named and set in both Set nodes and mapped correctly in the Merge node.
Pre-Production Checklist ✅
- Verify Twitter API is active and credentials valid.
- Ensure Airtable credentials have proper permissions to read and append records.
- Test running the workflow manually and confirm new tweets appear correctly appended in Airtable.
- Check that Tweet_id fields are consistently formatted and mapped across nodes.
- Backup your Airtable data before significant automation runs.
Deployment Guide
Activate the workflow in n8n by toggling it from off to on once you’ve tested manual runs successfully.
Optionally, replace the manual trigger with a Cron node to automate periodic execution, such as every hour or day, to keep your tweet list constantly updated without manual intervention.
Monitor execution logs in n8n for errors and ensure updates happen successfully.
FAQs
Q: Can I track tweets for multiple keywords simultaneously?
A: Yes, duplicate this workflow for each keyword or modify the Twitter node to accept multiple queries split by OR operators.
Q: Does this workflow consume a lot of API calls?
A: It uses Twitter’s search API with a limit of 100 tweets per run; depending on frequency, it could use several calls, so monitor your Twitter API limits.
Q: Is my tweet data stored securely?
A: Data is stored in your Airtable base which you control, and API credentials are securely handled within n8n.
Conclusion
By following this guide, you’ve built a n8n workflow that automatically searches for new tweets mentioning Verstappen, compares them to existing Airtable records, and appends only fresh tweets to your database. This saves you hours of tedious manual tracking and reduces duplicate entries or missed data.
Next, you might explore adding Slack notifications for new tweets, or expanding the workflow to analyze tweet sentiment automatically. Automations like these empower social media analysts like Alex to work smarter and faster.