AutomationFlowsAI & RAG › Find, Scrape & Analyze Twitter Posts by Name with Bright Data & Gemini

Find, Scrape & Analyze Twitter Posts by Name with Bright Data & Gemini

ByGleb D @glebd on n8n.io

This n8n workflow template automates the process of collecting and analyzing Twitter (X) posts for any public profile, then generates a clean, AI-powered summary including key metrics, interests, and activity trends.

Event trigger★★★★☆ complexityAI-powered22 nodesForm TriggerGoogle Gemini ChatOutput Parser StructuredFormGoogle SheetsChain LlmN8N Nodes Brightdata
AI & RAG Trigger: Event Nodes: 22 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #4325 — we link there as the canonical source.

This workflow follows the Chainllm → Form Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "AbtPK2RrW116HBH3",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Find Twitter Profile by Name, Scrape Posts & Analyze Content with AI, save in Google Sheets.",
  "tags": [],
  "nodes": [
    {
      "id": "3f37efb9-0ba6-474a-b5df-d453bb79d8e6",
      "name": "Extract Body and Title from Website",
      "type": "n8n-nodes-base.html",
      "position": [
        660,
        0
      ],
      "parameters": {
        "options": {
          "trimValues": true
        },
        "operation": "extractHtmlContent",
        "dataPropertyName": "body",
        "extractionValues": {
          "values": [
            {
              "key": "title",
              "cssSelector": "title"
            },
            {
              "key": "body",
              "cssSelector": "body"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "89d9a5af-f79a-44ad-87c3-99a410fe52eb",
      "name": "When User Completes Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {
          "path": "search-user",
          "ignoreBots": true,
          "buttonLabel": "Get References"
        },
        "formTitle": "Twitter (X) posts analyzer",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Person Fullname",
              "placeholder": "Complete the fullname",
              "requiredField": true
            },
            {
              "fieldLabel": "Analyze Posts From Date",
              "placeholder": "2025-05-01"
            },
            {
              "fieldLabel": "Analyze Posts To Date",
              "placeholder": "2025-05-20"
            }
          ]
        },
        "responseMode": "lastNode",
        "formDescription": "Complete the data of the person you want to analyze.\n\nA personalized follow-up email with insights and suggested outreach steps will be sent to you:"
      },
      "typeVersion": 2.2
    },
    {
      "id": "9cc99302-3a97-471b-8260-b2d0dda37be5",
      "name": "Edit Url Google Search",
      "type": "n8n-nodes-base.set",
      "position": [
        220,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "6b95685b-3286-4643-bfa1-6335d3f8cb39",
              "name": "google_search",
              "type": "string",
              "value": "=https://www.google.com/search?q=site%3Ax.com+{{ encodeURIComponent($json[\"Person Fullname\"].trim()) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "ae25a27d-4631-4131-ac42-ab39ba423806",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        900,
        180
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "typeVersion": 1
    },
    {
      "id": "dca04cd0-4519-41ae-9b0f-3c202a72cac3",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1040,
        180
      ],
      "parameters": {
        "jsonSchemaExample": "[{\n  \"username\": \"string\",\n  \"name\": \"string\",\n  \"url\": \"string\",\n  \"description\": \"string\"\n}]\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "d26a1cf1-c131-4a78-b968-4d2280c7dd7d",
      "name": "Form Not Found",
      "type": "n8n-nodes-base.form",
      "position": [
        1260,
        160
      ],
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "=We didn't found X Profile for \"{{ $('When User Completes Form').item.json[\"Person Fullname\"] }} \""
      },
      "typeVersion": 1
    },
    {
      "id": "d05c6134-02ba-4e75-b062-0994c1802ba1",
      "name": "X Profile is Found?",
      "type": "n8n-nodes-base.if",
      "position": [
        1260,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "645d85d3-c5cc-4e51-a989-075c0a851449",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              },
              "leftValue": "={{ $json.output[0]['url'] }}",
              "rightValue": 1
            },
            {
              "id": "b44e6a86-9a9b-4d3e-b9c8-cf75bba8ed03",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d2f963d7-4bb9-41d6-b698-028d76e08bd5",
      "name": "Check for errors",
      "type": "n8n-nodes-base.if",
      "position": [
        1320,
        440
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "645d85d3-c5cc-4e51-a989-075c0a851449",
              "operator": {
                "type": "string",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.error }}",
              "rightValue": 1
            },
            {
              "id": "b44e6a86-9a9b-4d3e-b9c8-cf75bba8ed03",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "34dfe012-f2b0-4921-aff7-2c97eafc206e",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1780,
        660
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash"
      },
      "typeVersion": 1
    },
    {
      "id": "223f4ef1-2ed0-48e3-a7b6-e2ecb762756f",
      "name": "Form Error",
      "type": "n8n-nodes-base.form",
      "position": [
        1320,
        680
      ],
      "parameters": {
        "operation": "completion",
        "respondWith": "showText",
        "responseText": "=Bright Data error for \"{{ $('When User Completes Form').item.json[\"Person Fullname\"] }} \""
      },
      "typeVersion": 1
    },
    {
      "id": "28c124cd-dd4b-4a8d-888e-d39709425920",
      "name": "Google Sheets - Adding Posts and Summary",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2140,
        440
      ],
      "parameters": {
        "columns": {
          "value": {
            "name": "={{ $('When User Completes Form').item.json['Person Fullname'] }}",
            "posts": "={{ $('Code').item.json.posts }}",
            "x_url": "={{ $('Parse X Url').item.json.output[0]['url'] }}",
            "end_date": "={{ $('When User Completes Form').item.json['Analyze Posts To Date'] }}",
            "ai_summary": "={{ $json.text }}",
            "start_date": "={{ $('When User Completes Form').item.json['Analyze Posts From Date'] }}"
          },
          "schema": [
            {
              "id": "name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "start_date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "start_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "end_date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "end_date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "x_url",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "x_url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "posts",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "posts",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "ai_summary",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "ai_summary",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1V1J7E5EKofN9Uhjg_kItpK0Wjh3Ga_To2k_QYj7hcPA/edit#gid=0",
          "cachedResultName": "results"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1V1J7E5EKofN9Uhjg_kItpK0Wjh3Ga_To2k_QYj7hcPA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1V1J7E5EKofN9Uhjg_kItpK0Wjh3Ga_To2k_QYj7hcPA/edit?usp=drivesdk",
          "cachedResultName": "X parsed posts"
        }
      },
      "typeVersion": 4.3,
      "alwaysOutputData": true
    },
    {
      "id": "abc5d30c-2d5c-4186-ac62-32129f33618e",
      "name": "Analyze Posts",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1760,
        440
      ],
      "parameters": {
        "text": "={{$json}}",
        "messages": {
          "messageValues": [
            {
              "message": "=Analyze these twitter posts - Detect interests, tone, sentiments, common topics, popularity and return summary"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.6
    },
    {
      "id": "daee9dbd-c65a-40cf-a84e-b8b9eec4e108",
      "name": "Parse X Url",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        880,
        0
      ],
      "parameters": {
        "text": "={{$('Extract Body and Title from Website').item.json[\"body\"]}}",
        "messages": {
          "messageValues": [
            {
              "message": "=Extract x.com (Twitter) profile from google results. Return a result property with unique parsed result in JSON including a property \"match\" if user matches the data entry values \"{{ $('When User Completes Form').item.json[\"Person Fullname\"].trim() }}\""
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.6
    },
    {
      "id": "b0ae5f34-dcd3-424e-b85b-6a339f701857",
      "name": "Snapshot Content",
      "type": "n8n-nodes-brightdata.brightData",
      "position": [
        880,
        440
      ],
      "parameters": {
        "resource": "marketplaceDataset",
        "operation": "getSnapshotContent",
        "snapshot_id": "={{ $('Snapshot Request').item.json.snapshot_id }}"
      },
      "typeVersion": 1
    },
    {
      "id": "d697b7b2-3c50-414e-a4d4-8f5f6f582cf9",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1540,
        440
      ],
      "parameters": {
        "jsCode": "const input = items[0].json;\nconst posts = input.items || [];\n\nconst extracted = posts.map(post => {\n  const quoted = post.quoted_post || {};\n  const taggedUsers = post.tagged_users || [];\n\n  return {\n    date_posted: post.date_posted || null,\n    description: post.description || null,\n    hashtags: post.hashtags || [],\n    likes: post.likes || null,\n\n    quoted_date_posted: quoted.date_posted || null,\n    quoted_description: quoted.description || null,\n\n    quotes: post.quotes || 0,\n    replies: post.replies || 0,\n    reposts: post.reposts || 0,\n\n    profile_names: taggedUsers.map(user => user.profile_name || null),\n\n    views: post.views || 0,\n  };\n});\n\nreturn [\n  {\n    json: {\n      posts: extracted\n    }\n  }\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "ba5770f0-db44-4032-bd45-1939b5f2740b",
      "name": "Wait 30s - Polling Bright Data",
      "type": "n8n-nodes-base.wait",
      "position": [
        220,
        440
      ],
      "parameters": {
        "amount": 30
      },
      "executeOnce": false,
      "typeVersion": 1.1
    },
    {
      "id": "fe2adace-a369-44ef-b048-eb90f309ee92",
      "name": "If - Checking status of Snapshot - if data is ready or not",
      "type": "n8n-nodes-base.if",
      "position": [
        660,
        440
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7932282b-71bb-4bbb-ab73-4978e554de7e",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.status }}",
              "rightValue": "ready"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "72326f8d-d381-4620-a3a7-1bed7389a146",
      "name": "Snapshot Request",
      "type": "n8n-nodes-brightdata.brightData",
      "position": [
        0,
        440
      ],
      "parameters": {
        "resource": "marketplaceDataset",
        "operation": "filterDataset",
        "dataset_id": {
          "__rl": true,
          "mode": "list",
          "value": "gd_lwxkxvnf1cynvib9co",
          "cachedResultName": "X (formerly Twitter) - Posts"
        },
        "filter_type": "filters_group",
        "filters_group": "={\"operator\":\"and\",\"filters\":[{\"name\":\"url\",\"operator\":\"includes\",\"value\":\"{{ $json[\"output\"][0]['url'] }}\"},\n{\"name\":\"date_posted\",\"operator\":\">=\",\"value\":\"{{ $('When User Completes Form').item.json[\"Analyze Posts From Date\"] }}\"},\n{\"name\":\"date_posted\",\"operator\":\"<=\",\"value\":\"{{ $('When User Completes Form').item.json[\"Analyze Posts To Date\"] }}\"}]}"
      },
      "typeVersion": 1
    },
    {
      "id": "665656d5-78e4-480c-a472-ade64f43609c",
      "name": "Snapshot Progress",
      "type": "n8n-nodes-brightdata.brightData",
      "position": [
        440,
        440
      ],
      "parameters": {
        "resource": "marketplaceDataset",
        "operation": "getSnapshotMetadata",
        "snapshot_id": "={{ $json.snapshot_id }}"
      },
      "typeVersion": 1
    },
    {
      "id": "f346f9b0-f5f0-452e-932f-b27d956e3383",
      "name": "BrightData",
      "type": "n8n-nodes-brightdata.brightData",
      "position": [
        440,
        0
      ],
      "parameters": {
        "url": "={{ $json.google_search }}",
        "zone": {
          "__rl": true,
          "mode": "list",
          "value": "web_unlocker1"
        },
        "format": "json",
        "country": {
          "__rl": true,
          "mode": "list",
          "value": "us"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "3fe4b2e8-4cc6-4e23-a2da-c8c668537036",
      "name": "Check for errors1",
      "type": "n8n-nodes-base.if",
      "position": [
        1100,
        440
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "645d85d3-c5cc-4e51-a989-075c0a851449",
              "operator": {
                "type": "array",
                "operation": "notExists",
                "singleValue": true
              },
              "leftValue": "={{ $json.items}}",
              "rightValue": "Snapshot is building."
            },
            {
              "id": "b44e6a86-9a9b-4d3e-b9c8-cf75bba8ed03",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4b5aa6d7-9328-46fa-b333-6b068c5ffa79",
      "name": "Wait 30s - Check if the snapshot is ready",
      "type": "n8n-nodes-base.wait",
      "position": [
        880,
        680
      ],
      "parameters": {
        "amount": 30
      },
      "executeOnce": false,
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a93d240e-59b4-49a9-84ce-60fdffc2b48f",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Analyze Posts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BrightData": {
      "main": [
        [
          {
            "node": "Extract Body and Title from Website",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse X Url": {
      "main": [
        [
          {
            "node": "X Profile is Found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Posts": {
      "main": [
        [
          {
            "node": "Google Sheets - Adding Posts and Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Form Not Found": {
      "main": [
        []
      ]
    },
    "Check for errors": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Form Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Snapshot Content": {
      "main": [
        [
          {
            "node": "Check for errors1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Snapshot Request": {
      "main": [
        [
          {
            "node": "Wait 30s - Polling Bright Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for errors1": {
      "main": [
        [
          {
            "node": "Wait 30s - Check if the snapshot is ready",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Check for errors",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Snapshot Progress": {
      "main": [
        [
          {
            "node": "If - Checking status of Snapshot - if data is ready or not",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "X Profile is Found?": {
      "main": [
        [
          {
            "node": "Snapshot Request",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Form Not Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Url Google Search": {
      "main": [
        [
          {
            "node": "BrightData",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Parse X Url",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Parse X Url",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When User Completes Form": {
      "main": [
        [
          {
            "node": "Edit Url Google Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Posts",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait 30s - Polling Bright Data": {
      "main": [
        [
          {
            "node": "Snapshot Progress",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Body and Title from Website": {
      "main": [
        [
          {
            "node": "Parse X Url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 30s - Check if the snapshot is ready": {
      "main": [
        [
          {
            "node": "Snapshot Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If - Checking status of Snapshot - if data is ready or not": {
      "main": [
        [
          {
            "node": "Snapshot Content",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 30s - Polling Bright Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This n8n workflow template automates the process of collecting and analyzing Twitter (X) posts for any public profile, then generates a clean, AI-powered summary including key metrics, interests, and activity trends.

Source: https://n8n.io/workflows/4325/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This template attempts to replicate OpenAI's DeepResearch feature which, at time of writing, is only available to their pro subscribers.

Output Parser Structured, OpenAI Chat, Form Trigger +8
AI & RAG

My workflow 53. Uses formTrigger, httpRequest, lmChatOpenAi, form. Event-driven trigger; 74 nodes.

Form Trigger, HTTP Request, OpenAI Chat +15
AI & RAG

Automate your lead intake, scoring, and outreach pipeline. This workflow collects leads from forms, enriches and scores them using Relevance AI, routes them by quality, and triggers the right follow-u

Form Trigger, HTTP Request, Chain Llm +6
AI & RAG

Summary

Google Sheets, WordPress, HTTP Request +5
AI & RAG

This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

Output Parser Structured, HTTP Request, Form Trigger +6