Twitter Node

Extract Twitter/X data with the Anysite Twitter node for n8n workflows

Overview

The Anysite Twitter node enables you to extract Twitter (X) data within your n8n workflows. Search tweets, analyze user profiles, monitor hashtags, and track social media conversations.

Node Configuration

Authentication

Select your Anysite API credentials from the dropdown or create new ones.

Available Operations

Search Users

Search for Twitter users by username, bio, or other criteria.

Parameters:

Example Output:

{
  "users": [
    {
      "id": "twitter123",
      "username": "johnsmith_dev",
      "displayName": "John Smith",
      "bio": "Senior Software Engineer | Python enthusiast",
      "followers": 15000,
      "following": 800,
      "verified": false,
      "location": "San Francisco, CA",
      "profileImageUrl": "https://pbs.twimg.com/profile_images/..."
    }
  ]
}

Get User Posts

Extract tweets and posts from a specific Twitter user.

Parameters:

Example Output:

{
  "tweets": [
    {
      "id": "tweet456",
      "text": "Just shipped a new feature! Excited to see how users respond 🚀",
      "createdAt": "2024-08-26T14:30:00Z",
      "engagement": {
        "likes": 125,
        "retweets": 32,
        "replies": 18,
        "views": 2500
      },
      "mediaUrls": [],
      "hashtags": ["#ProductLaunch", "#TechStartup"]
    }
  ]
}

Search Tweets

Search for tweets by keywords, hashtags, or phrases.

Parameters:

Example Output:

{
  "tweets": [
    {
      "id": "search789",
      "text": "The future of AI development is looking incredible! #AI #MachineLearning",
      "author": {
        "username": "ai_researcher",
        "displayName": "Dr. Sarah Wilson"
      },
      "createdAt": "2024-08-26T12:00:00Z",
      "engagement": {
        "likes": 89,
        "retweets": 24,
        "replies": 12
      }
    }
  ]
}

Get Tweet Details

Get detailed information about a specific tweet.

Parameters:

Example Output:

{
  "tweet": {
    "id": "tweet123",
    "text": "Thread about building scalable APIs: 1/8",
    "author": {
      "username": "backend_expert",
      "followers": 25000
    },
    "engagement": {
      "likes": 245,
      "retweets": 89,
      "replies": 34
    },
    "threadTweets": [
      {
        "id": "tweet124",
        "text": "First, consider your data architecture..."
      }
    ]
  }
}

Workflow Examples

Social Media Monitoring

Monitor Brand Mentions

Search for tweets mentioning your brand, product, or competitors.

Analyze Sentiment

Use AI nodes to analyze sentiment and categorize mentions as positive, negative, or neutral.

Identify Influencers

Find high-engagement users mentioning your brand and assess their influence.

Alert Team

Send notifications to your social media team for important mentions or negative sentiment.

Example Workflow:

{
  "nodes": [
    {
      "name": "Monitor Brand",
      "type": "@horizondatawave/n8n-nodes-anysite.Twitter",
      "operation": "searchTweets",
      "parameters": {
        "query": "YourBrand OR @YourHandle OR #YourHashtag",
        "resultType": "recent",
        "limit": 100
      }
    },
    {
      "name": "Sentiment Analysis",
      "type": "n8n-nodes-base.openAi",
      "parameters": {
        "operation": "analyze",
        "prompt": "Analyze sentiment: {{ $json.text }}"
      }
    },
    {
      "name": "Filter Negative",
      "type": "n8n-nodes-base.filter",
      "parameters": {
        "conditions": [
          {
            "field": "sentiment",
            "operation": "equal",
            "value": "negative"
          }
        ]
      }
    },
    {
      "name": "Alert Team",
      "type": "n8n-nodes-base.slack",
      "parameters": {
        "channel": "#social-media",
        "text": "🚨 Negative mention detected: {{ $json.text }}"
      }
    }
  ]
}

Influencer Outreach

Find and analyze potential influencer partners:

  1. Search Influencers - Find users with high engagement in your niche
  2. Analyze Profile - Check follower count, engagement rate, and content themes
  3. Content Analysis - Review recent posts for brand alignment
  4. Contact Information - Extract bio links and contact details
  5. CRM Integration - Add qualified influencers to your outreach database

Trend Analysis

Track trending topics and hashtags:

  1. Hashtag Monitoring - Track specific hashtags relevant to your industry
  2. Engagement Tracking - Monitor tweet performance and viral content
  3. Competitor Analysis - See what competitors are posting about
  4. Content Opportunities - Identify trending topics for your content calendar
  5. Reporting - Generate weekly trend reports

Advanced Search Queries

Search Operators

Use Twitter's advanced search operators:

// Exact phrase search
{
  "query": "\"artificial intelligence\""
}

// Exclude retweets
{
  "query": "machine learning -RT"
}

// From specific user
{
  "query": "from:elonmusk"
}

// Mentions of user
{
  "query": "@openai"
}

// Multiple hashtags
{
  "query": "#AI #MachineLearning"
}

// Location-based
{
  "query": "startup near:\"San Francisco\""
}

// Date range
{
  "query": "product launch since:2024-08-01 until:2024-08-31"
}

Engagement Filters

Filter by engagement metrics:

{
  "name": "High Engagement Filter",
  "type": "n8n-nodes-base.filter",
  "parameters": {
    "conditions": [
      {
        "field": "engagement.likes",
        "operation": "greaterThan",
        "value": 100
      },
      {
        "field": "engagement.retweets", 
        "operation": "greaterThan",
        "value": 20
      }
    ]
  }
}

Error Handling

Common Errors

Rate Limit Exceeded

Error: 429 - Too Many Requests

Solution:

Tweet Not Found

Error: 404 - Tweet not found

Solution:

User Suspended

Error: 403 - User account suspended

Solution:

Retry Configuration

{
  "name": "Twitter with Retry",
  "type": "@horizondatawave/n8n-nodes-anysite.Twitter",
  "retryOnFail": true,
  "maxTries": 3,
  "waitBetweenTries": 5000,
  "parameters": {
    "operation": "searchTweets",
    "query": "your search query"
  }
}

Data Processing

Tweet Analysis

Extract insights from tweet data:

// Calculate engagement rate
{
  "engagementRate": "={{ ($json.engagement.likes + $json.engagement.retweets + $json.engagement.replies) / $json.engagement.views * 100 }}"
}

// Extract hashtags
{
  "hashtags": "={{ $json.text.match(/#\w+/g) }}"
}

// Check if verified user
{
  "isInfluencer": "={{ $json.author.verified || $json.author.followers > 10000 }}"
}

Content Classification

Use AI to categorize tweets:

{
  "name": "Classify Content",
  "type": "n8n-nodes-base.openAi",
  "parameters": {
    "operation": "classify",
    "prompt": "Classify this tweet into categories (Product, Marketing, Support, Other): {{ $json.text }}"
  }
}

Integration Examples

Google Sheets Export

Export tweet data to spreadsheets:

{
  "name": "Export to Sheets",
  "type": "n8n-nodes-base.googleSheets",
  "parameters": {
    "operation": "append",
    "sheetId": "your-sheet-id",
    "values": [
      "={{ $json.author.username }}",
      "={{ $json.text }}",
      "={{ $json.createdAt }}",
      "={{ $json.engagement.likes }}",
      "={{ $json.engagement.retweets }}"
    ]
  }
}

Webhook Notifications

Send real-time alerts:

{
  "name": "Webhook Alert",
  "type": "n8n-nodes-base.webhook",
  "parameters": {
    "httpMethod": "POST",
    "responseMode": "onReceived",
    "options": {
      "data": {
        "tweet": "={{ $json.text }}",
        "author": "={{ $json.author.username }}",
        "engagement": "={{ $json.engagement.likes }}"
      }
    }
  }
}

Performance Optimization

Batch Processing

Process large datasets efficiently:

{
  "name": "Process in Batches",
  "type": "n8n-nodes-base.splitInBatches",
  "parameters": {
    "batchSize": 25
  }
}

Caching

Cache frequently accessed data:

// Store user data in memory
{
  "name": "Cache User Data",
  "type": "n8n-nodes-base.set",
  "parameters": {
    "values": {
      "userCache.{{ $json.username }}": "={{ $json }}"
    }
  }
}

Next Steps