{
  "id": "GA1HTM4YyIidEJb3",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Automated TikTok Influencer Discovery & Analysis via Bright Data and Anthropic AI and Send Email Notification",
  "tags": [],
  "nodes": [
    {
      "id": "cb75134b-4746-4715-87b4-c2bb596d4366",
      "name": "Anthropic Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        1460,
        300
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "claude-sonnet-4-20250514",
          "cachedResultName": "Claude 4 Sonnet"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "aef0b016-6017-4b2a-8bcc-56e78b9a5cc1",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        1680,
        0
      ],
      "parameters": {
        "jsCode": "// N8N Code Node to extract data from AI output\nconst items = $input.all();\n\nreturn items.map(item => {\n  try {\n    // Get the output string from the item\n    const outputString = item.json.output;\n    \n    // Extract JSON from the markdown code block\n    const jsonMatch = outputString.match(/```json\\n([\\s\\S]*?)\\n```/);\n    \n    if (jsonMatch && jsonMatch[1]) {\n      // Parse the extracted JSON\n      const parsedData = JSON.parse(jsonMatch[1]);\n      \n      // Return the extracted data as separate columns\n      return {\n        json: {\n          Collaboration: parsedData.Collaboration || '',\n          Analysis: parsedData.Analysis || '',\n          Profile_ID: parsedData['Profile ID'] || '',\n          // Keep original data as well if needed\n          original_output: outputString\n        }\n      };\n    } else {\n      // If no JSON found, return empty values\n      return {\n        json: {\n          Collaboration: '',\n          Analysis: '',\n          Profile_ID: '',\n          original_output: outputString,\n          error: 'No JSON found in output'\n        }\n      };\n    }\n  } catch (error) {\n    // Handle any parsing errors\n    return {\n      json: {\n        Collaboration: '',\n        Analysis: '',\n        Profile_ID: '',\n        original_output: item.json.output || '',\n        error: `Parsing error: ${error.message}`\n      }\n    };\n  }\n});"
      },
      "typeVersion": 2
    },
    {
      "id": "51d9eee9-63c0-43a4-bb03-d94a1d9ceb2a",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1980,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "Analysis": "={{ $json.Analysis }}",
            "Profile ID": "={{ $json.Profile_ID }}",
            "Collaboration": "={{ $json.Collaboration }}"
          },
          "schema": [
            {
              "id": "Profile ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Profile ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Username",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Followers",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Followers",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Collaboration",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Collaboration",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Analysis",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Analysis",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Profile ID"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "YOUR_GOOGLE_SHEET_URL",
          "cachedResultName": "TikTok"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "YOUR_GOOGLE_SHEET_URL"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "4db5fe1f-9038-4746-859b-7b38a2b3056d",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        2240,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "7c4c648b-a7df-41d6-bc6c-b6d05221f7bf",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.Collaboration }}",
              "rightValue": "Highly Relevant"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "50db5760-83fe-4119-bb18-27d637acbee9",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2520,
        0
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=Hi,\nI wanted to share some of the best TikTok creators perfectly matched to collaborate with your business. These influencers align closely with your brand and audience, helping you maximize your reach and impact.\nUsername: {{ $('Update Data in the Google Sheet').item.json.Username }}\nTikTok Profile: {{ $('Update Data in the Google Sheet').item.json.URL }}\nFollowers: {{ $('Update Data in the Google Sheet').item.json.Followers }}\n\nLet me know if you'd like more details or to explore specific collaboration opportunities.\n\nBest regards",
        "options": {},
        "subject": "Top TikTok Influencer Match for Your Business Collaboration",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "a6067955-adf4-4926-8082-81459d5aff1d",
      "name": "Scrape Data from TikTok through Keyword by BrightData",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        240,
        0
      ],
      "parameters": {
        "url": "https://api.brightdata.com/datasets/v3/trigger",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"input\": [\n    {\n      \"search_keyword\": \"{{ $json['Search Keyword'] }}\",\n      \"country\": \"\"\n    }\n  ],\n  \"custom_output_fields\": [\n    \"url\",\n    \"description\",\n    \"profile_id\",\n    \"profile_username\",\n    \"profile_url\",\n    \"profile_followers\"\n  ]\n}",
        "sendBody": true,
        "sendQuery": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "queryParameters": {
          "parameters": [
            {
              "name": "dataset_id",
              "value": "YOUR_BRIGHTDATA_DATASET_ID"
            },
            {
              "name": "include_errors",
              "value": "true"
            },
            {
              "name": "type",
              "value": "discover_new"
            },
            {
              "name": "discover_by",
              "value": "keyword"
            },
            {
              "name": "limit_per_input",
              "value": "5"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "fbc8f8b2-5e63-4914-b4b8-a44fa5163cda",
      "name": "3 Minute Wait Time",
      "type": "n8n-nodes-base.wait",
      "position": [
        520,
        0
      ],
      "parameters": {
        "unit": "minutes",
        "amount": 3
      },
      "typeVersion": 1.1
    },
    {
      "id": "9ad6728c-2136-46bb-9ddf-0d445b28be22",
      "name": "Extract Data from Snapshot Generated by BrightData",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        800,
        0
      ],
      "parameters": {
        "url": "=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "format",
              "value": "json"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "8e3577fb-1077-44d4-bada-ca9f5f2aa141",
      "name": "Update Data in the Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        0
      ],
      "parameters": {
        "columns": {
          "value": {
            "URL": "={{ $json.profile_url }}",
            "Username": "={{ $json.profile_username }}",
            "Followers": "={{ $json.profile_followers }}",
            "Profile ID": "={{ $json.profile_id }}",
            "Description": "={{ $json.description }}"
          },
          "schema": [
            {
              "id": "Profile ID",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Profile ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Username",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Username",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Followers",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Followers",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Collaboration",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Collaboration",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Analysis",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Analysis",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "YOUR_GOOGLE_SHEET_URL",
          "cachedResultName": "TikTok"
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": "YOUR_GOOGLE_SHEET_URL"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "16bfd75e-fc30-4e6f-94f2-5e554d25cf64",
      "name": "Find the Collaborator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1300,
        0
      ],
      "parameters": {
        "text": "=Assume you are a social media expert and you find the best influencers based on the business and industry by analyzing the below data.\nHere are the Details of the Influencers.\nProfile URL: {{ $json.URL }}\nDescription: {{ $json.Description }}\nFollowers: {{ $json.Followers }}\nProfile ID: {{ $json['Profile ID'] }}\n\nMy Business Details:\nAbout my business: {{ $('Submit Form with Keyword, Business Info, Industry').item.json['About My Business'] }}\nIndustry: {{ $('Submit Form with Keyword, Business Info, Industry').item.json.Industry }}\n\nRequirements:\nFollowers should be more than 5000\nand Influencer should be in my industry.\nand Just Provide the Output according to below format\n\nFormat:\nOutput should be in Json\nCollaboration: Not Relevant, Highly Relevant\nAnalysis: Explain in 50 words\nProfile ID: Just add the Profile ID without any change\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "6d482ee5-fd98-4ed3-bfac-dc1ca014769f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -80
      ],
      "parameters": {
        "color": 2,
        "width": 220,
        "height": 260,
        "content": "\ud83c\udfaf Intelligent Filtering\n\nProcesses only influencers who meet your criteria (e.g., 5000+ followers, industry match).\n\n\u26a1 Fast & Reliable\n\nUses professional scraping with robust error handling.\n\n\ud83d\udd04 Batch Processing\n\nSupports bulk influencer processing through a single automated flow.\n\nSubmit the form with search terms, business description, and industry category to trigger the workflow.\n\nEdit the \"Find the Collaborator\" prompt to adjust:\n\nGoogle Sheets log includes:\n\nDvir Sharon\n\nDvir Sharon\n\nDvir Sharon\n\nAkram Kadri\n\nAlex Kim\n\nLucas Perret\n\nn8n Team\n\nNot Another Marketer\n\nJoseph LePage\n\nOur customer\u2019s words, not ours.\n\nSkeptical? Try it out, and see for yourself.\n\nBuild complex workflows that other tools can't. I used other tools before. I got to know the N8N and I say it properly: it is better to do everything on the n8n! Congratulations on your work, you are a star!\n\n@igordisco\n\nThank you to the n8n community. I did the beginners course and promptly took an automation WAY beyond my skill level.\n\n@robm\n\nn8n is a beast for automation. self-hosting and low-code make it a dev\u2019s dream. if you\u2019re not automating yet, you\u2019re working too hard.\n\n@Anderoav\n\nI've said it many times. But I'll say it again. n8n is the GOAT. Anything is possible with n8n. You just need some technical knowledge + imagination. I'm actually looking to start a side project. Just to have an excuse to use n8n more \ud83d\ude05\n\n@maximpoulsen\n\nIt blows my mind. I was hating on no-code tools my whole life, but n8n changed everything. Made a Slack agent that can basically do everything, in half an hour.\n\n@felixleber\n\nI just have to say, n8n's integration with third-party services is absolutely mind-blowing. It's like having a Swiss Army knife for automation. So many tasks become a breeze, and I can quickly validate and implement my ideas without any hassle.\n\n@1ronben\n\nFound the holy grail of automation yesterday... Yesterday I tried n8n and it blew my mind \ud83e\udd2f What would've taken me 3 days to code from scratch? Done in 2 hours. The best part? If you still want to get your hands dirty with code (because let's be honest, we developers can't help ourselves \ud83d\ude05), you can just drop in custom code nodes. Zero restrictions.\n\n@francois-la\u00dfl\n\nAnything is possible with n8n. I think @n8n_io Cloud version is great, they are doing amazing stuff and I love that everything is available to look at on Github.\n\n@jodiem\n\nAutomate without limits\n\nImprint\n\n|\n\nSecurity\n\n|\n\nPrivacy\n\n|\n\nReport a vulnerability\n\n\u00a9 2025 n8n \u00a0 | \u00a0 All rights reserved."
      },
      "typeVersion": 1
    },
    {
      "id": "2b3f2a04-cee9-4fae-8199-2c5cef6969cd",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -80
      ],
      "parameters": {
        "color": 3,
        "height": 260,
        "content": "Calls Bright Data API to fetch TikTok profiles by keyword."
      },
      "typeVersion": 1
    },
    {
      "id": "3aed623a-1827-4641-96dc-d652332946e9",
      "name": "Submit Form with Keyword, Business Info, Industry",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "TikTok Profile Scraper",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Search Keyword"
            },
            {
              "fieldLabel": "About My Business"
            },
            {
              "fieldLabel": "Industry"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "c8434c0a-5df9-43e6-924e-6078bbf13c3f",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        460,
        -80
      ],
      "parameters": {
        "color": 4,
        "height": 260,
        "content": "Waits 3 minutes to allow Bright Data to complete scraping."
      },
      "typeVersion": 1
    },
    {
      "id": "951080be-56e7-4616-a8f3-4bdf6e29be06",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        -80
      ],
      "parameters": {
        "color": 5,
        "height": 260,
        "content": "Fetches snapshot data (scraped influencer profiles) from Bright Data."
      },
      "typeVersion": 1
    },
    {
      "id": "2fe42472-7b93-41f3-b2d9-ddf6a1472c32",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        980,
        -80
      ],
      "parameters": {
        "color": 6,
        "height": 260,
        "content": "Stores raw influencer data (ID, followers, description, etc.) in Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "c6340b5e-bd02-469c-909c-5300430fcba8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        -80
      ],
      "parameters": {
        "color": 2,
        "width": 360,
        "height": 260,
        "content": "Uses Claude AI to evaluate each influencer's relevance to your business. Returns profile ID, relevance, and a 50-word analysis."
      },
      "typeVersion": 1
    },
    {
      "id": "3c94de79-c64d-4d89-ad9d-387314d84d2b",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1380,
        200
      ],
      "parameters": {
        "color": 6,
        "height": 240,
        "content": "Claude Sonnet 4 model that powers the influencer analysis."
      },
      "typeVersion": 1
    },
    {
      "id": "eb61e536-d234-450c-94db-896d24757ad5",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1640,
        -80
      ],
      "parameters": {
        "color": 4,
        "height": 260,
        "content": "Parses Claude AI's markdown output and extracts structured JSON fields for further use."
      },
      "typeVersion": 1
    },
    {
      "id": "d08dd360-e26f-421a-bf1f-95976adce3a2",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1900,
        -80
      ],
      "parameters": {
        "color": 3,
        "width": 260,
        "height": 260,
        "content": "Logs Claude's insights (Profile ID, Collaboration status, Analysis) into Google Sheets."
      },
      "typeVersion": 1
    },
    {
      "id": "02d41818-b12f-4b45-9e93-f3b7162cd6f6",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2180,
        -80
      ],
      "parameters": {
        "height": 260,
        "content": "Filters results to retain only Highly Relevant influencers for email outreach."
      },
      "typeVersion": 1
    },
    {
      "id": "873b1c8a-fb26-40ca-9885-51c80eb1bd61",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2440,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 260,
        "height": 260,
        "content": "Sends personalized collaboration email to your target contact with top influencer information."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "18042508-1631-4802-8863-d015a36bed62",
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3 Minute Wait Time": {
      "main": [
        [
          {
            "node": "Extract Data from Snapshot Generated by BrightData",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Anthropic Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Find the Collaborator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Find the Collaborator": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Data in the Google Sheet": {
      "main": [
        [
          {
            "node": "Find the Collaborator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submit Form with Keyword, Business Info, Industry": {
      "main": [
        [
          {
            "node": "Scrape Data from TikTok through Keyword by BrightData",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Data from Snapshot Generated by BrightData": {
      "main": [
        [
          {
            "node": "Update Data in the Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Data from TikTok through Keyword by BrightData": {
      "main": [
        [
          {
            "node": "3 Minute Wait Time",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}