{
  "id": "hAq4tv014k8txJGa",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Qualify TikTok Influencers from Username with Dumpling AI + GPT-4",
  "tags": [],
  "nodes": [
    {
      "id": "fcbf3d68-d5d3-48b6-8980-09f2ec1815a8",
      "name": "Trigger on TikTok Username Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -656,
        -240
      ],
      "parameters": {
        "options": {},
        "formTitle": "Tiktok User",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Tik Tok Username"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "76fbe780-3739-49db-bce8-982db09856f3",
      "name": "Get TikTok Profile (Dumpling AI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -432,
        -240
      ],
      "parameters": {
        "url": "https://app.dumplingai.com/api/v1/get-tiktok-profile",
        "method": "POST",
        "options": {},
        "jsonBody": "={ \"handle\": \"{{ $json['Tik Tok Username'] }}\" }",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth"
      },
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6be1336b-21d2-4da6-8f98-bfe5d2b26bbf",
      "name": "Evaluate Profile Qualification (GPT-4)",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -208,
        -240
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1",
          "cachedResultName": "GPT-4.1"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are analyzing a TikTok user profile. Check the following conditions:\n\n1. The user must have at least 40 videos.  \n2. The user must have at least 100000 followers.  \n3. The user must have a heart count (total likes) greater than 300000.  \n\nIf all three conditions are met, output exactly: \"Qualified for influencer outreach\".  \nIf any condition is not met, output exactly: \"Not qualified\".\n"
            },
            {
              "content": "=\n  video_count: {{ $json.stats.videoCount }},\n  follower_count\": {{ $json.stats.followerCount }}\n  heart_count\": {{ $json.stats.heartCount }}\n\n "
            }
          ]
        }
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "a9c9d2ac-a201-42b1-b43a-03986b111fc1",
      "name": "Check if User Already Exists",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        144,
        -240
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.user.id }}",
              "lookupColumn": "User ID "
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TE8Llr1PfaKs0OhH3TMr73nwcohKyGaGVXwsaEEMHgY/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TE8Llr1PfaKs0OhH3TMr73nwcohKyGaGVXwsaEEMHgY/edit?usp=drivesdk",
          "cachedResultName": "TikTOK"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": true
    },
    {
      "id": "4e20d033-ec7f-40d1-8bc1-ab0741894d8d",
      "name": "Route Based on Existence",
      "type": "n8n-nodes-base.switch",
      "position": [
        368,
        -240
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Does not exist",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "43a01054-c765-4719-bfe8-db2219f1db55",
                    "operator": {
                      "type": "number",
                      "operation": "equals"
                    },
                    "leftValue": "={{ Object.keys($json).length }}",
                    "rightValue": 0
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Exists",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "bc4b7e5a-1ddb-4a41-9f2f-8bd928d9872b",
                    "operator": {
                      "type": "number",
                      "operation": "gte"
                    },
                    "leftValue": "={{ Object.keys($json).length }}",
                    "rightValue": 1
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.3
    },
    {
      "id": "70df6b45-8521-406b-9009-c80c26169fea",
      "name": "Add New TikTok User to Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        672,
        -320
      ],
      "parameters": {
        "columns": {
          "value": {
            "User ID ": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.user.id }}",
            "Qualifed?": "={{ $('Evaluate Profile Qualification (GPT-4)').item.json.message.content }}",
            "Heart Count": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.stats.heartCount }}",
            "Video Count": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.stats.videoCount }}",
            "Tik Tok user": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.user.uniqueId }}",
            "Follower Count": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.stats.followerCount }}",
            "Following Count": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.stats.followingCount }}"
          },
          "schema": [
            {
              "id": "Tik Tok user",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Tik Tok user",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "User ID ",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "User ID ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Follower Count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Follower Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Following Count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Following Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Heart Count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Heart Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Video Count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Video Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Qualifed?",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Qualifed?",
              "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/1TE8Llr1PfaKs0OhH3TMr73nwcohKyGaGVXwsaEEMHgY/edit#gid=0",
          "cachedResultName": "Tik TOK ID"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TE8Llr1PfaKs0OhH3TMr73nwcohKyGaGVXwsaEEMHgY/edit?usp=drivesdk",
          "cachedResultName": "TikTOK"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "dc2c7d9f-d364-4756-975e-6fdb95df41b4",
      "name": "Update Existing TikTok User in Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        608,
        -112
      ],
      "parameters": {
        "columns": {
          "value": {
            "User ID ": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.user.id }}",
            "Qualifed?": "={{ $('Evaluate Profile Qualification (GPT-4)').item.json.message.content }}",
            "Video Count": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.stats.heartCount }}",
            "Tik Tok user": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.user.uniqueId }}",
            "Follower Count": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.stats.followerCount }}",
            "Following Count": "={{ $('Get TikTok Profile (Dumpling AI)').item.json.stats.followingCount }}"
          },
          "schema": [
            {
              "id": "Tik Tok user",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Tik Tok user",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "User ID ",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "User ID ",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Follower Count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Follower Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Following Count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Following Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Heart Count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Heart Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Video Count",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Video Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Qualifed?",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Qualifed?",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "User ID "
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TE8Llr1PfaKs0OhH3TMr73nwcohKyGaGVXwsaEEMHgY/edit#gid=0",
          "cachedResultName": "Tik TOK ID"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1TE8Llr1PfaKs0OhH3TMr73nwcohKyGaGVXwsaEEMHgY/edit?usp=drivesdk",
          "cachedResultName": "TikTOK"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "c05eccd1-f75c-4c88-b593-4e4ae4a4812b",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -704,
        -592
      ],
      "parameters": {
        "width": 768,
        "height": 592,
        "content": "## \ud83e\udde0 Get TikTok Profile & Evaluate with AI\n\n1. \ud83d\udd04 Trigger when a TikTok username is submitted via form  \n2. \ud83d\udcca Get profile data from Dumpling AI  \n3. \u2705 GPT-4 checks if user meets these criteria:\n   - At least 40 videos\n   - 100,000+ followers\n   - 300,000+ hearts\n\nThe result is either:\n**\"Qualified for influencer outreach\"** or **\"Not qualified\"**\n\n\ud83d\udc49 This section is only for data collection and decision-making.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bc173c53-c336-40c7-b0fd-94d86d746869",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        96,
        -592
      ],
      "parameters": {
        "color": 4,
        "width": 672,
        "height": 592,
        "content": "## \ud83d\udcc4 Check Google Sheet & Save Result\n\n4. \ud83d\udd0d Check if the TikTok user already exists in your sheet (match by `User ID`)  \n5. \ud83d\udd01 If user exists \u2192 update row  \n6. \ud83c\udd95 If new user \u2192 append a new row\n\nSheet columns should include:\n- `Tik Tok user`\n- `User ID`\n- `Follower Count`\n- `Following Count`\n- `Heart Count`\n- `Video Count`\n- `Qualified?`\n\n\u2705 Requires connected Google Sheets account with correct structure\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "307c922e-3067-4d31-bfa1-b7eb07966aa5",
  "connections": {
    "Route Based on Existence": {
      "main": [
        [
          {
            "node": "Add New TikTok User to Sheet",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Update Existing TikTok User in Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if User Already Exists": {
      "main": [
        [
          {
            "node": "Route Based on Existence",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger on TikTok Username Form": {
      "main": [
        [
          {
            "node": "Get TikTok Profile (Dumpling AI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get TikTok Profile (Dumpling AI)": {
      "main": [
        [
          {
            "node": "Evaluate Profile Qualification (GPT-4)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Evaluate Profile Qualification (GPT-4)": {
      "main": [
        [
          {
            "node": "Check if User Already Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}