AutomationFlowsAI & RAG › Analyze & Target High-value Customers with Gpt-5.5 and Bright Data Mcp

Analyze & Target High-value Customers with Gpt-5.5 and Bright Data Mcp

ByYaron Been @yaron-nofluff on n8n.io

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

Cron / scheduled trigger★★★★☆ complexityAI-powered20 nodesAgentN8N Nodes McpOpenAI ChatGmailOutput Parser AutofixingOutput Parser Structured
AI & RAG Trigger: Cron / scheduled Nodes: 20 Complexity: ★★★★☆ AI nodes: yes Added:

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

This workflow follows the Agent → Gmail 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": "wIBHF1QNYzvZZHta",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "23 Analyze Customer Lifetime Value",
  "tags": [],
  "nodes": [
    {
      "id": "a73dd3f9-4d76-46ba-b4bc-9c7035109825",
      "name": "Run Offer Campaign Monthly",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        0
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months",
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "8b11a03a-71da-4d82-8891-084adcddfd77",
      "name": "Set customer history url",
      "type": "n8n-nodes-base.set",
      "position": [
        200,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b366b00a-ad35-46ab-9722-6478ded6ec91",
              "name": "customer data url",
              "type": "string",
              "value": "example.com"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b1f84ba5-90f9-4483-968e-67df657a1936",
      "name": "Scrape Customer Profiles & Orders (Agent)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        480,
        0
      ],
      "parameters": {
        "text": "=scrape the customer history url below and extract the key information:\n{{ $json['customer data url'] }}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "5aced094-ac88-4033-8a9b-dfc7b1457a6d",
      "name": "Bright Data MCP Scraper",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        640,
        280
      ],
      "parameters": {
        "toolName": "scrape_as_markdown",
        "operation": "executeTool",
        "toolParameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}"
      },
      "credentials": {
        "mcpClientApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ef9b75c8-1ec6-43ca-9969-909146214422",
      "name": "AI Assistant",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        440,
        280
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5.5"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2d7909b4-333c-46cc-9909-5df7fe9bdeb6",
      "name": "Format Customer Info",
      "type": "n8n-nodes-base.code",
      "position": [
        900,
        0
      ],
      "parameters": {
        "jsCode": "// Get the array inside the 'output' key\nconst customers = items[0].json.output;\n\n// Map each customer to a separate item\nreturn customers.map(customer => {\n  return { json: customer };\n});\n"
      },
      "typeVersion": 2
    },
    {
      "id": "8d562c3e-2e0c-4ba8-8dbe-a89a23ba913b",
      "name": "Get Customer Order History",
      "type": "n8n-nodes-base.code",
      "position": [
        1100,
        0
      ],
      "parameters": {
        "jsCode": "// Loop through all incoming customers\nconst output = [];\n\nfor (const item of items) {\n  const customerName = item.json.customer_name;\n  const customerEmail = item.json.customer_email;  // Added email extraction\n  const orders = item.json.orders;\n\n  for (const order of orders) {\n    output.push({\n      json: {\n        customer_name: customerName,\n        customer_email: customerEmail,  // Added email in output\n        amount: order.amount,\n        date: order.date\n      }\n    });\n  }\n}\n\nreturn output;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "02a09456-b359-4989-99b5-c830e9d6ca2a",
      "name": "Is Customer High-Value?",
      "type": "n8n-nodes-base.if",
      "position": [
        1360,
        0
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "6725053f-eae9-422c-942d-c82279482697",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.amount }}",
              "rightValue": 200
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "9a0b0647-1341-4159-b639-5b3581548d74",
      "name": "Send Special Offer Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1580,
        -100
      ],
      "parameters": {
        "sendTo": "={{ $json.customer_email }}",
        "message": "write any offer",
        "options": {},
        "subject": "Offer for being out ideal customer"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "3d73fb01-ab20-4be2-97c7-c21d5c95b45f",
      "name": "Ignore Low-Value Customers",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1580,
        100
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "7f81c4d2-d406-4d58-956e-78bca5a8f861",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -40,
        -1020
      ],
      "parameters": {
        "color": 2,
        "width": 400,
        "height": 1200,
        "content": "## \ud83d\udd01 **Section 1: Schedule & Input Setup**\n\n### \ud83e\uddf1 Nodes:\n\n* **\ud83d\udd52 `Run Offer Campaign Daily`**\n* **\u270f\ufe0f `Set Admin Dashboard URL`**\n\n### \ud83d\udcd6 What Happens Here:\n\nThis section **initiates the workflow on a regular schedule** (daily, weekly, etc.). It also **sets the URL** of the **admin dashboard** where your customer data is stored.\n\n\ud83d\udca1 **Beginner Tip:**\nThis is your starting point. You don't need to manually run the workflow every time \u2014 just schedule it, and it will run automatically using the trigger.\n\n\u2705 **Why it\u2019s useful:**\nYou can run this process daily or weekly to find customers who deserve promotional offers, all on autopilot!\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "de0d7ee1-b627-4f17-b03e-4076b09166a9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -900
      ],
      "parameters": {
        "color": 3,
        "width": 340,
        "height": 1080,
        "content": "## \ud83e\udd16 **Section 2: Scraping Customer Data with Agent**\n\n### \ud83e\uddf1 Nodes:\n\n* **\ud83e\udd16 `Scrape Customer Profiles & Orders (Agent)`**\n\n  * \u2699\ufe0f **`AI Assistant (OpenAI Chat Model)`**\n  * \ud83c\udf10 **`Bright Data MCP Scraper`**\n  * \ud83e\uddfe **`Format Agent Output (Structured Output Parser)`**\n\n### \ud83d\udcd6 What Happens Here:\n\nThe **AI Agent** (powered by OpenAI and Bright Data MCP) accesses your dashboard and scrapes:\n\n* \ud83d\udcc7 **Customer profiles**\n* \ud83d\uded2 **Their purchase/order history**\n\nThe **Structured Output Parser** then **cleans up and organizes** this data into a format that other nodes can use.\n\n\ud83d\udca1 **Beginner Tip:**\nThis is like a smart assistant that goes to your admin dashboard, collects important info, and makes sure it\u2019s readable for the next steps.\n\n\u2705 **Why it\u2019s useful:**\nEven if the data is messy or complex on the dashboard, this section makes sure it\u2019s clean and ready to use in your automation.\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9f5db009-9461-4937-8c88-d55bf47bfe2c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        860,
        -760
      ],
      "parameters": {
        "color": 5,
        "width": 360,
        "height": 940,
        "content": "## \ud83e\udde9 **Section 3: Data Formatting & Order Extraction**\n\n### \ud83e\uddf1 Nodes:\n\n* **\ud83d\udd27 `Format Customer Info`**\n* **\ud83d\udce6 `Get Customer Order History`**\n\n### \ud83d\udcd6 What Happens Here:\n\nThese function nodes further **organize and process the scraped data**:\n\n* The first node extracts key customer details like name, email, and ID.\n* The second node focuses on their **order data** \u2014 how many items they bought, total amount spent, etc.\n\n\ud83d\udca1 **Beginner Tip:**\nThink of this as organizing data into two folders: \ud83e\uddcd\u200d\u2642\ufe0f \u201cCustomer Info\u201d and \ud83d\udcca \u201cPurchase Data\u201d.\n\n\u2705 **Why it\u2019s useful:**\nClean separation of data means better targeting. You'll know exactly **who** bought **what**, and **how much** they spent \u2014 perfect for personalized offers!\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a46e5710-fb85-46d6-addd-211994597386",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1320,
        -740
      ],
      "parameters": {
        "color": 6,
        "width": 380,
        "height": 1000,
        "content": "## \ud83c\udfaf **Section 4: Offer Decision & Action**\n\n### \ud83e\uddf1 Nodes:\n\n* **\ud83d\udcb0 `Is Customer High-Value?`**\n* **\ud83d\udce7 `Send Special Offer Email`**\n* **\u27a1\ufe0f `Ignore Low-Value Customers`**\n\n### \ud83d\udcd6 What Happens Here:\n\nThis section **decides what action to take**:\n\n* The \"High Value Check\" compares a customer\u2019s total spending against a fixed threshold.\n* If their spending is **high enough**, they get a personalized **offer email** via Gmail.\n* If not, they\u2019re simply **skipped** \u2014 no email is sent.\n\n\ud83d\udca1 **Beginner Tip:**\nYou don\u2019t want to send offers to everyone. This smart filter ensures **only loyal/high-value customers** get incentives.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e32fb60f-390a-4f16-9b81-6b82fda08328",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1820,
        -740
      ],
      "parameters": {
        "color": 7,
        "width": 380,
        "height": 240,
        "content": "## I\u2019ll receive a tiny commission if you join Bright Data through this link\u2014thanks for fueling more free content!\n\n### https://get.brightdata.com/1tndi4600b25"
      },
      "typeVersion": 1
    },
    {
      "id": "a31f7eec-c104-4631-86f3-523e68aab57b",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1780,
        -1040
      ],
      "parameters": {
        "color": 4,
        "width": 1300,
        "height": 320,
        "content": "=======================================\n            WORKFLOW ASSISTANCE\n=======================================\nFor any questions or support, please contact:\n    Yaron@nofluff.online\n\nExplore more tips and tutorials here:\n   - YouTube: https://www.youtube.com/@YaronBeen/videos\n   - LinkedIn: https://www.linkedin.com/in/yaronbeen/\n=======================================\n"
      },
      "typeVersion": 1
    },
    {
      "id": "0f4db4d3-102f-4c2c-a456-42bd14e95a76",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1780,
        -700
      ],
      "parameters": {
        "color": 4,
        "width": 1289,
        "height": 2758,
        "content": "# \ud83c\udfaf **Automated High-Value Customer Targeting & Offer Campaign**\n\n### *Smartly scrape, segment, and send personalized offers \u2014 all without lifting a finger.*\n\n---\n\n## \ud83d\udd01 **Section 1: Schedule & Input Setup**\n\n### \ud83e\uddf1 Nodes:\n\n* **\ud83d\udd52 `Run Offer Campaign Daily`**\n* **\u270f\ufe0f `Set Admin Dashboard URL`**\n\n### \ud83d\udcd6 What Happens Here:\n\nThis section **initiates the workflow on a regular schedule** (daily, weekly, etc.). It also **sets the URL** of the **admin dashboard** where your customer data is stored.\n\n\ud83d\udca1 **Beginner Tip:**\nThis is your starting point. You don't need to manually run the workflow every time \u2014 just schedule it, and it will run automatically using the trigger.\n\n\u2705 **Why it\u2019s useful:**\nYou can run this process daily or weekly to find customers who deserve promotional offers, all on autopilot!\n\n---\n\n## \ud83e\udd16 **Section 2: Scraping Customer Data with Agent**\n\n### \ud83e\uddf1 Nodes:\n\n* **\ud83e\udd16 `Scrape Customer Profiles & Orders (Agent)`**\n\n  * \u2699\ufe0f **`AI Assistant (OpenAI Chat Model)`**\n  * \ud83c\udf10 **`Bright Data MCP Scraper`**\n  * \ud83e\uddfe **`Format Agent Output (Structured Output Parser)`**\n\n### \ud83d\udcd6 What Happens Here:\n\nThe **AI Agent** (powered by OpenAI and Bright Data MCP) accesses your dashboard and scrapes:\n\n* \ud83d\udcc7 **Customer profiles**\n* \ud83d\uded2 **Their purchase/order history**\n\nThe **Structured Output Parser** then **cleans up and organizes** this data into a format that other nodes can use.\n\n\ud83d\udca1 **Beginner Tip:**\nThis is like a smart assistant that goes to your admin dashboard, collects important info, and makes sure it\u2019s readable for the next steps.\n\n\u2705 **Why it\u2019s useful:**\nEven if the data is messy or complex on the dashboard, this section makes sure it\u2019s clean and ready to use in your automation.\n\n---\n\n## \ud83e\udde9 **Section 3: Data Formatting & Order Extraction**\n\n### \ud83e\uddf1 Nodes:\n\n* **\ud83d\udd27 `Format Customer Info`**\n* **\ud83d\udce6 `Get Customer Order History`**\n\n### \ud83d\udcd6 What Happens Here:\n\nThese function nodes further **organize and process the scraped data**:\n\n* The first node extracts key customer details like name, email, and ID.\n* The second node focuses on their **order data** \u2014 how many items they bought, total amount spent, etc.\n\n\ud83d\udca1 **Beginner Tip:**\nThink of this as organizing data into two folders: \ud83e\uddcd\u200d\u2642\ufe0f \u201cCustomer Info\u201d and \ud83d\udcca \u201cPurchase Data\u201d.\n\n\u2705 **Why it\u2019s useful:**\nClean separation of data means better targeting. You'll know exactly **who** bought **what**, and **how much** they spent \u2014 perfect for personalized offers!\n\n---\n\n## \ud83c\udfaf **Section 4: Offer Decision & Action**\n\n### \ud83e\uddf1 Nodes:\n\n* **\ud83d\udcb0 `Is Customer High-Value?`**\n* **\ud83d\udce7 `Send Special Offer Email`**\n* **\u27a1\ufe0f `Ignore Low-Value Customers`**\n\n### \ud83d\udcd6 What Happens Here:\n\nThis section **decides what action to take**:\n\n* The \"High Value Check\" compares a customer\u2019s total spending against a fixed threshold.\n* If their spending is **high enough**, they get a personalized **offer email** via Gmail.\n* If not, they\u2019re simply **skipped** \u2014 no email is sent.\n\n\ud83d\udca1 **Beginner Tip:**\nYou don\u2019t want to send offers to everyone. This smart filter ensures **only loyal/high-value customers** get incentives.\n\n\u2705 **Why it\u2019s useful:**\nIt automates your **customer segmentation** and **email marketing**, saving you time while targeting the right people to boost sales.\n\n---\n\n## \ud83c\udf89 Final Thoughts\n\nThis workflow is a **powerful marketing automation tool**. Here's what it empowers you to do:\n\n* \u23f0 Run promotions on autopilot\n* \ud83e\udde0 Use AI and proxies to collect data\n* \ud83e\uddf9 Organize complex customer records\n* \ud83c\udfaf Only target the most valuable users\n* \ud83d\udcc8 Increase conversion rates with personalized emails\n\n---\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e7eec1fb-1a84-44be-8b8c-ab6fa4acbc1c",
      "name": "Auto-fixing Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserAutofixing",
      "position": [
        780,
        280
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "3e4a7bfa-5ba6-4abb-8dac-72eeee8263a4",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        760,
        500
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5.5"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "6ba75ee7-46ea-4388-b5c2-b5ab2d4aecc1",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        920,
        500
      ],
      "parameters": {
        "jsonSchemaExample": "[\n  {\n    \"customer_name\": \"John Doe\",\n    \"orders\": [\n      {\n        \"amount\": 120,\n        \"date\": \"2024-05-10\"\n      },\n      {\n        \"amount\": 80,\n        \"date\": \"2024-06-15\"\n      }\n    ]\n  },\n  {\n    \"customer_name\": \"Jane Smith\",\n    \"orders\": [\n      {\n        \"amount\": 200,\n        \"date\": \"2024-04-05\"\n      },\n      {\n        \"amount\": 150,\n        \"date\": \"2024-05-01\"\n      },\n      {\n        \"amount\": 180,\n        \"date\": \"2024-06-10\"\n      }\n    ]\n  },\n  {\n    \"customer_name\": \"Michael Johnson\",\n    \"orders\": [\n      {\n        \"amount\": 600,\n        \"date\": \"2024-07-01\"\n      }\n    ]\n  }\n]\n"
      },
      "typeVersion": 1.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f2ffb3ba-6efc-493d-93c6-6a2e99e8c2d8",
  "connections": {
    "AI Assistant": {
      "ai_languageModel": [
        [
          {
            "node": "Scrape Customer Profiles & Orders (Agent)",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Format Customer Info": {
      "main": [
        [
          {
            "node": "Get Customer Order History",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bright Data MCP Scraper": {
      "ai_tool": [
        [
          {
            "node": "Scrape Customer Profiles & Orders (Agent)",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Is Customer High-Value?": {
      "main": [
        [
          {
            "node": "Send Special Offer Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Ignore Low-Value Customers",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set customer history url": {
      "main": [
        [
          {
            "node": "Scrape Customer Profiles & Orders (Agent)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Auto-fixing Output Parser",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Auto-fixing Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Scrape Customer Profiles & Orders (Agent)",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Get Customer Order History": {
      "main": [
        [
          {
            "node": "Is Customer High-Value?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Run Offer Campaign Monthly": {
      "main": [
        [
          {
            "node": "Set customer history url",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape Customer Profiles & Orders (Agent)": {
      "main": [
        [
          {
            "node": "Format Customer Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

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

Source: https://n8n.io/workflows/5966/ — 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

Note: This template is for self-hosted n8n instances only

Output Parser Structured, Google Sheets, Agent +6
AI & RAG

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

OpenAI Chat, Agent, N8N Nodes Mcp +4
AI & RAG

This workflow automatically monitors social media advertising performance across platforms to track campaign effectiveness and ROI. It saves you time by eliminating the need to manually check multiple

OpenAI Chat, N8N Nodes Mcp, Agent +3
AI & RAG

This workflow automatically monitors competitor pricing across multiple products and services to track market positioning and pricing strategies. It saves you time by eliminating the need to manually

OpenAI Chat, N8N Nodes Mcp, Agent +4
AI & RAG

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

OpenAI Chat, N8N Nodes Mcp, Agent +4