Skip to main content

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

credential
AnySite API Credentials
required
Select your AnySite API credentials from the dropdown or create new ones.

Available Operations

  • Search Users
  • Get User Posts
  • Search Tweets
  • Get Tweet Details
Search for Twitter users by username, bio, or other criteria.Parameters:
  • Query (required): Search terms for finding users
  • Result Type: “recent”, “popular”, or “mixed”
  • Limit: Maximum results to return (1-100)
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/..."
    }
  ]
}

Workflow Examples

Social Media Monitoring

1

Monitor Brand Mentions

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

Analyze Sentiment

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

Identify Influencers

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

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

Error: 429 - Too Many RequestsSolution:
  • Add delay nodes between requests (recommended: 1-2 seconds)
  • Implement retry logic with exponential backoff
  • Consider upgrading your API plan for higher limits
Error: 404 - Tweet not foundSolution:
  • Tweet may have been deleted or made private
  • Verify the tweet ID is correct
  • Handle missing tweets gracefully in your workflow
Error: 403 - User account suspendedSolution:
  • Skip suspended accounts in bulk operations
  • Update your user database to mark suspended accounts
  • Implement error handling to continue workflow

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

I