AutomationFlowsAI & RAG › Automate Sdr Outreach: Source Wiza Leads and Personalize Emails with Llms

Automate Sdr Outreach: Source Wiza Leads and Personalize Emails with Llms

ByMezie @mezie on n8n.io

Receives campaign parameters via form, creates a Smartlead campaign, sources qualified leads through Wiza based on your ICP description, researches each prospect with Perplexity AI, generates personalized icebreaker emails and follow-up sequences with OpenRouter LLMs, and…

Event trigger★★★★★ complexityAI-powered48 nodesHTTP RequestOutput Parser StructuredMemory Buffer WindowOpenRouter ChatPerplexity ToolForm TriggerAgentData Table
AI & RAG Trigger: Event Nodes: 48 Complexity: ★★★★★ AI nodes: yes Added:
Automate Sdr Outreach: Source Wiza Leads and Personalize Emails with Llms — n8n workflow card showing HTTP Request, Output Parser Structured, Memory Buffer Window integration

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

This workflow follows the Agent → Datatable 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": "1LnK9G3HUxNhOKIy",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Full AI SDR",
  "tags": [
    {
      "id": "yfTRL636KaCy3a0g",
      "name": "Video 3",
      "createdAt": "2025-09-25T18:39:22.560Z",
      "updatedAt": "2025-09-25T18:39:22.560Z"
    }
  ],
  "nodes": [
    {
      "id": "285eddc1-cb14-4743-b9f8-25b0e501db16",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1936,
        736
      ],
      "parameters": {
        "color": 7,
        "width": 2080,
        "height": 1200,
        "content": "# Stage 2: Lead Sourcing via Wiza\nPurpose: To bridge the gap between a high-level \"Ideal Client Profile\" (ICP) and raw lead data. An AI agent translates your natural language description \n(e.g., \"SaaS CEOs in Europe\") into precise API filters for Wiza. The system then polls the API until the leads are enriched with verified emails \nand standardizes the data into your internal database.\n\n## Configuration:\n- [Wiza](https://wiza.co/auth/login) api \n- ICP Input: Fill in the \"Set Campaign Details\" node with a detailed description of your target audience and the number of leads required.\n- Data Mapping: Ensure the \"Standardize Data\" node matches the column headers in your n8n Lead Database table."
      },
      "typeVersion": 1
    },
    {
      "id": "e763bdd4-2a46-4ea0-ab76-d282458f4275",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        736
      ],
      "parameters": {
        "color": 7,
        "width": 2480,
        "height": 1200,
        "content": "# Stage 1: Campaign Infrastructure Setup\nPurpose: This stage gets everything ready in Smartlead before you send a single email. \nIt creates your campaign and automatically picks your \"healthiest\" email account (the one with the best reputation) \nso your messages stay out of the spam folder.\n\n## Configuration:\n- Smartlead API: Connect your account so n8n can talk to Smartlead.\n- Email Picking: The system automatically checks which of your accounts are \"Active\" and have a good \"warmup reputation\".\n- Sequence Structure: Define the number of steps and the delay (days) between each email in the \"Build Sequence Templates\" node.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "e83dc7bc-efd6-462e-9d16-e08461aac290",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4032,
        736
      ],
      "parameters": {
        "color": 7,
        "width": 3024,
        "height": 1200,
        "content": "# Stage 3: AI Copywriting (Hyper-Personalization)\n**Purpose** : To transform generic outreach into high-converting, research-backed conversations. For every lead, a Research Agent uses live web data to find \"triggers\" (news, hiring, growth). \nA writing agent then combines this research with your specific Business Context and Case Study Database to generate a unique icebreaker and a narrative-driven 3-step follow-up sequence.\n\n## Configuration:\n- **- [OpenRouter](https://openrouter.ai/)**: Add API keys for LLM processing and live web research.\n- Business Context: Define **Your Offer** clearly in the *business context node* \u2014 the AI needs to know exactly what value you are providing.\n- Case Study Table: Connect to your n8n Data Table include your success stories (Client name, metric, and problem solved) for the AI to reference \n"
      },
      "typeVersion": 1
    },
    {
      "id": "931cd241-2539-4ab5-9d8d-684210595874",
      "name": "Create Smartlead Campaign",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -16,
        1296
      ],
      "parameters": {
        "url": "https://server.smartlead.ai/api/v1/campaigns/create",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"name\": \"{{ $json['Campaign name'] }}\"\n}",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "bb2cb535-93f7-4b0b-b20b-f844965be44a",
      "name": "Fetch Email Accounts",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        432,
        1296
      ],
      "parameters": {
        "url": "https://server.smartlead.ai/api/v1/email-accounts",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f4baeb40-8493-4557-a941-b30103d8b7eb",
      "name": "Find Least Used Account",
      "type": "n8n-nodes-base.code",
      "position": [
        656,
        1296
      ],
      "parameters": {
        "jsCode": "// Find best email account based on multiple criteria\nconst accounts = $input.all();\n\nif (!accounts || accounts.length === 0) {\n  throw new Error('No email accounts received');\n}\n\n// Filter for active accounts (case-insensitive, or if status is missing/undefined, include it)\nconst activeAccounts = accounts.filter(acc => {\n  const status = acc.json.status;\n  return !status || status.toString().toLowerCase() === 'active';\n});\n\n// Use all accounts if no active ones found\nconst accountsToProcess = activeAccounts.length > 0 ? activeAccounts : accounts;\n\n// Score each account (lower score = better)\nconst scoredAccounts = accountsToProcess.map(acc => {\n  const data = acc.json;\n  return {\n    ...data,\n    score: (\n      (data.campaign_count || 0) * 1000 +           // Lower campaign_count is better (weight: 1000)\n      (100 - (data.warmup_reputation || 50)) * 10 + // Higher warmup_reputation is better (weight: 10)\n      (data.total_spam_count || 0) * 100            // Lower spam_count is better (weight: 100)\n    ),\n    campaign_count: data.campaign_count || 0,\n    warmup_reputation: data.warmup_reputation || 0,\n    total_spam_count: data.total_spam_count || 0\n  };\n});\n\n// Sort by score (ascending = best first)\nscoredAccounts.sort((a, b) => a.score - b.score);\n\n// Check if all accounts have the same score\nconst bestScore = scoredAccounts[0].score;\nconst sameScoreAccounts = scoredAccounts.filter(acc => acc.score === bestScore);\n\n// If all same, pick random from top scorers, otherwise pick best\nconst selectedAccount = sameScoreAccounts.length === scoredAccounts.length\n  ? sameScoreAccounts[Math.floor(Math.random() * sameScoreAccounts.length)]\n  : scoredAccounts[0];\n\nif (!selectedAccount || !selectedAccount.id) {\n  throw new Error('Selected account missing ID');\n}\n\nreturn [{\n  json: {\n    email_account_id: selectedAccount.id,\n    email_account_email: selectedAccount.from_email || selectedAccount.email || '',\n    campaign_count: selectedAccount.campaign_count,\n    warmup_reputation: selectedAccount.warmup_reputation,\n    total_spam_count: selectedAccount.total_spam_count\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "681b5dac-eb3e-41b0-a28d-476dfdb346ca",
      "name": "Save Sequence Templates",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1328,
        1296
      ],
      "parameters": {
        "url": "=https://server.smartlead.ai/api/v1/campaigns/{{ $node[\"Create Smartlead Campaign\"].json.id }}/sequences",
        "method": "POST",
        "options": {},
        "jsonBody": "={{ $json }}",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6c442048-6e58-40c6-8c0d-5bae10c2aea4",
      "name": "Update Campaign Settings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1552,
        1296
      ],
      "parameters": {
        "url": "=https://server.smartlead.ai/api/v1/campaigns/{{ $node[\"Create Smartlead Campaign\"].json.id }}/settings",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n\"stop_lead_settings\": \"REPLY_TO_AN_EMAIL\"\n}",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "48a1963c-0cf1-4946-9a30-a834adf29bd4",
      "name": "Upload Lead to Smartlead",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        6848,
        1520
      ],
      "parameters": {
        "url": "=https://server.smartlead.ai/api/v1/campaigns/{{ $node[\"Create Smartlead Campaign\"].json.id }}/leads",
        "method": "POST",
        "options": {},
        "jsonBody": "={{$json}}",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "c6b84f68-e370-4707-ae1b-8b98f350ef2a",
      "name": "Structured Output Parser9",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2304,
        1520
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"filters\": {\n    \"job_title\": [\n      {\n        \"v\": \"CEO\",\n        \"s\": \"i\"\n      }\n    ],\n    \"job_title_level\": [\n      \"CXO\"\n    ],\n    \"job_role\": [\n      \"finance\"\n    ],\n    \"location\": [\n      {\n        \"v\": \"Toronto, Ontario, Canada\",\n        \"b\": \"city\",\n        \"s\": \"i\"\n      }\n    ],\n    \"company_location\": [\n      {\n        \"v\": \"Ontario, Canada\",\n        \"b\": \"state\",\n        \"s\": \"i\"\n      }\n    ],\n    \"company_size\": [\n      \"1-10\",\n      \"11-50\"\n    ],\n    \"company_industry\": [\n      \"financial services\"\n    ],\n    \"year_founded_start\": \"2010\",\n    \"year_founded_end\": \"2024\"\n  },\n  \"list\": {\n    \"name\": \"Test List\",\n    \"max_profiles\": 10\n  }\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "db6ee071-89d5-421b-8ea9-c4acd6bb92f5",
      "name": "Get Lists Contacts",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3200,
        1168
      ],
      "parameters": {
        "url": "=https://wiza.co/api/lists/{{ $json.data.id }}/contacts",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "segment",
              "value": "people"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2c2636e3-5a4f-4aa0-989c-8b7b17af3499",
      "name": "Simple Memory7",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        2176,
        1520
      ],
      "parameters": {
        "sessionKey": "=0",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0b7d3603-80e2-46c9-b0f9-c7ba63565d31",
      "name": "OpenRouter Chat Model7",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        2032,
        1520
      ],
      "parameters": {
        "model": "z-ai/glm-4.5",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "95d19aa7-ab07-4e43-9e3e-aad78220cd5b",
      "name": "Search Prospects [Wiza-API]",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2480,
        1296
      ],
      "parameters": {
        "url": "https://wiza.co/api/prospects/create_prospect_list",
        "method": "POST",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "jsonBody": "={{ JSON.stringify($json.output) }}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "da1380a8-69cb-4d83-b522-8bddd4ab2523",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        4144,
        1168
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "e361899a-ca3a-4191-a053-014ee3d93588",
      "name": "Business Context",
      "type": "n8n-nodes-base.set",
      "position": [
        4736,
        1264
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4ac3e552-bc3d-4f57-bc6b-2f03e83ed009",
              "name": "Our_Offer",
              "type": "string",
              "value": "=\ud83c\udf81 Offers\n\nThe Offer: A \"1-page peer benchmark\" showing what other agencies in their specific vertical (e.g., Performance Creative) are paying for a booked meeting right now.\n\nWhy it works: It appeals to their competitive nature. They want to know if they are overpaying for leads compared to their rivals.\n\nThe Offer: A \"5-point Leakage Audit\" of their current lead intake process (identifying slow response times, ghosted leads, or tech friction).\n\nWhy it works: It feels like a \"security check\" rather than a \"sales pitch.\" People are more motivated to avoid losing $1,000 than they are to make $1,000."
            },
            {
              "id": "ab226a91-8a93-46fa-9a7f-54916d3c09a6",
              "name": "Our Business Profile",
              "type": "string",
              "value": "=otomata.xyz exists to fill the mid-market gap: too small for big consultancies, too strategic for one-off AI agencies. We partner with high growth marketing agencies to help them install powerful growth engines. \n\nWe install an automated follow-up system that prospect highly qualified leads into 5 new paying clients in 60 days or we don\u2019t get paid.\n\n\u2705 Guarantee: 30-Day Results or We Work for Free\n\nIf you don\u2019t get results in 30 days, we\u2019ll work another 30 days for free until you do. Simple as that."
            },
            {
              "id": "98b564d2-a77d-44f6-a072-ec5e4552bd93",
              "name": "Lead's Research Report",
              "type": "string",
              "value": "={{ $json.output }}"
            },
            {
              "id": "e3772e2d-a84d-419b-a768-312d00a75a7a",
              "name": "=lead_info",
              "type": "object",
              "value": "={{ JSON.stringify($json) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "dd876fea-3efd-4429-89f9-77df0eb1f01d",
      "name": "Perplexity Research Tool",
      "type": "n8n-nodes-base.perplexityTool",
      "position": [
        4608,
        1488
      ],
      "parameters": {
        "options": {},
        "messages": {
          "message": [
            {
              "content": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('message0_Text', `Enter any search queries`, 'string') }}"
            }
          ]
        },
        "simplify": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Simplify_Output', ``, 'boolean') }}",
        "requestOptions": {
          "batching": {
            "batch": {
              "batchSize": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Items_per_Batch', ``, 'number') }}"
            }
          }
        }
      },
      "credentials": {
        "perplexityApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "11f6c549-6976-495b-a5e3-de57adbdd29c",
      "name": "Payload aggregator",
      "type": "n8n-nodes-base.code",
      "position": [
        6592,
        1264
      ],
      "parameters": {
        "jsCode": "// 1. Get data from all sources\nconst lead = $('Lead_info').first().json.lead_info;\nconst iceBreaker = $('Ice Breaker Email').first().json;\nconst followUps = $('Follow-up Sequence Generator set').first().json.output.followups;\n\n// 2. Helpers to find specific followup data by sequence number\nconst getBody = (num) => followUps.find(f => f.sequence_number === num)?.email_body || \"\";\nconst getSubject = (num) => followUps.find(f => f.sequence_number === num)?.subject || \"\";\n\n// 3. Construct the full Smartlead Payload\nreturn {\n  \"lead_list\": [\n    {\n      // --- Standard Contact Fields ---\n      \"email\": lead.email,\n      \"first_name\": lead.name ? lead.name.split(' ')[0] : \"there\",\n      \"last_name\": lead.name ? lead.name.split(' ').slice(1).join(' ') : \"\",\n      \"company_name\": lead.company_name || \"\",\n      \"website\": lead.company_domain || \"\",\n      \"linkedin_profile\": lead.linkedin_profile_url || \"\",\n      \"location\": lead.location || \"\",\n      \"phone_number\": lead.phone || \"\",\n\n      // --- Custom Fields (Body & Subjects) ---\n      \"custom_fields\": {\n        // Icebreaker (Step 1)\n        \"icebreaker_subject\": iceBreaker.subject_line,\n        \"icebreaker_body\": iceBreaker.email_body,\n        \n        // Follow-up 1 (Step 2)\n        \"followup_1_subject\": getSubject(2),\n        \"followup_1_body\": getBody(2),\n        \n        // Follow-up 2 (Step 3)\n        \"followup_2_subject\": getSubject(3),\n        \"followup_2_body\": getBody(3),\n        \n        // Follow-up 3 (Step 4)\n        \"followup_3_subject\": getSubject(4),\n        \"followup_3_body\": getBody(4),\n\n        // Mapping to your alternative field names (from screenshot)\n        \"follow_up_3\": getBody(3),\n        \"follow_up_4\": getBody(4)\n      }\n    }\n  ]\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "9e2a01f8-b9db-4de7-9aac-7012c93102dd",
      "name": "Ice Breaker Email",
      "type": "n8n-nodes-base.set",
      "position": [
        5552,
        1264
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "3066d3d0-c2a7-457b-97e9-053d7a1ae6a8",
              "name": "subject_line",
              "type": "string",
              "value": "={{ $json.output.subject_line }}"
            },
            {
              "id": "586f21ae-1d54-4652-82b4-0d50eb74d1d0",
              "name": "email_body",
              "type": "string",
              "value": "={{ $json.output.email_body }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "4d3fca85-50e2-4a26-bec9-0523352eb5f2",
      "name": "Lead_info",
      "type": "n8n-nodes-base.set",
      "position": [
        3840,
        1168
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "96f7aff2-ce0d-4b64-a7b9-93e33c3dd7c1",
              "name": "lead_info",
              "type": "object",
              "value": "={{ $json }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "cc8de5a4-1e76-48a3-8a64-60ea52d3fb85",
      "name": "Schedule Campaign",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1776,
        1296
      ],
      "parameters": {
        "url": "=https://server.smartlead.ai/api/v1/campaigns/{{ $node[\"Create Smartlead Campaign\"].json.id }}/schedule",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"timezone\": \"America/Los_Angeles\",\n  \"days_of_the_week\": [1, 2, 3, 4, 5],\n  \"start_hour\": \"09:00\",\n  \"end_hour\": \"18:00\",\n  \"min_time_btw_emails\": 10,\n  \"max_new_leads_per_day\": 20,\n  \"schedule_start_time\": \"{{ $('Set Campaign Details').first().json['Schedule Campaign'] }}\"\n}",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d354f291-d331-4ab1-9243-ee9d16470e06",
      "name": "Start Campaign",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        4352,
        1056
      ],
      "parameters": {
        "url": "=https://server.smartlead.ai/api/v1/campaigns//status",
        "method": "POST",
        "options": {},
        "jsonBody": "{\"status\": \"START\"}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth"
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.3
    },
    {
      "id": "7c140999-050c-46d5-8c1a-57a3424ac20d",
      "name": "Set Campaign id",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        1296
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "53047fca-4287-4de0-8e41-551de79b036a",
              "name": "id",
              "type": "number",
              "value": "={{ $json.id }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "5e2b4875-dc4e-40b2-99b9-678842f7c7c6",
      "name": "Add Email Account to Campaign",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        1296
      ],
      "parameters": {
        "url": "=https://server.smartlead.ai/api/v1/campaigns/{{ $node[\"Create Smartlead Campaign\"].json.id }}/email-accounts",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"email_account_ids\": [\"{{ $json.email_account_id }}\"]\n}",
        "sendBody": true,
        "sendQuery": true,
        "specifyBody": "json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpQueryAuth",
        "queryParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpQueryAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "57e94504-3e1c-4848-85de-c607815215d1",
      "name": "Campaign Generation Form",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -464,
        1296
      ],
      "parameters": {
        "options": {},
        "formTitle": "Campaign Generation Form",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Campaign Name",
              "placeholder": "e.g Lead Generation Fall Outreach 2025",
              "requiredField": true
            },
            {
              "fieldType": "textarea",
              "fieldLabel": "Ideal Client Description",
              "placeholder": "e.g. SaaS founders with 10\u201350 employees looking to automate lead generation",
              "requiredField": true
            },
            {
              "fieldType": "number",
              "fieldLabel": "Number of Prospects to Add",
              "requiredField": true
            },
            {
              "fieldType": "date",
              "fieldLabel": "Schedule Campaign",
              "requiredField": true
            }
          ]
        },
        "formDescription": "Name your email campaign and describe the ideal client you want to target."
      },
      "typeVersion": 2.2
    },
    {
      "id": "892d6564-639b-4a07-9e29-da0eb30c07e3",
      "name": "Set Campaign Details",
      "type": "n8n-nodes-base.set",
      "position": [
        -240,
        1296
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "230de40a-8939-4ad9-b141-9265c4a464c9",
              "name": "Campaign name",
              "type": "string",
              "value": "={{ $json['Campaign Name'] }}"
            },
            {
              "id": "eabfbaa7-07dd-4fe3-9e37-8658add36a17",
              "name": "Ideal Client Description",
              "type": "string",
              "value": "={{ $json['Ideal Client Description'] }}"
            },
            {
              "id": "d5a0e81e-1d4f-4e39-8c25-d3e39d233cb4",
              "name": "Number of Prospects to Add",
              "type": "number",
              "value": "={{ $json['Number of Prospects to Add'] }}"
            },
            {
              "id": "9a99d14a-4e27-4f91-9bc4-b031ebcdfb16",
              "name": "Schedule Campaign",
              "type": "string",
              "value": "={{ $json[\"Schedule Campaign\"] }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "95d187eb-0f8a-4735-9492-6c3171f25370",
      "name": "Build Sequence Templates",
      "type": "n8n-nodes-base.code",
      "position": [
        1104,
        1296
      ],
      "parameters": {
        "jsCode": "// Build sequence templates with literal Smartlead merge tags\n// These are NOT n8n expressions - they're Smartlead placeholders that will be replaced\n// with custom field values when leads are uploaded\nconst sequences = [\n  {\n    seq_number: 1,\n    seq_delay_details: { delay_in_days: 0 },\n    subject: '{{icebreaker_subject}}',\n    email_body: '{{icebreaker_body}}'\n  },\n  {\n    seq_number: 2,\n    seq_delay_details: { delay_in_days: 3 },\n    subject: '{{followup_1_subject}}',\n    email_body: '{{followup_1_body}}'\n  },\n  {\n    seq_number: 3,\n    seq_delay_details: { delay_in_days: 5 },\n    subject: '{{followup_2_subject}}',\n    email_body: '{{followup_2_body}}'\n  },\n  {\n    seq_number: 4,\n    seq_delay_details: { delay_in_days: 7 },\n    subject: '{{followup_3_subject}}',\n    email_body: '{{followup_3_body}}'\n  }\n];\n\nreturn [{\n  json: {\n    sequences: sequences\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "c621a391-58f1-47ec-9432-c49987c2e3c7",
      "name": "Format Search Parameters",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2112,
        1296
      ],
      "parameters": {
        "text": "=**Now convert this ICP segment description into Wiza API search parameters:**\n\n[Campaign Name]\n{{ $('Set Campaign Details').first().json['Campaign name'] }}\n\n[ICP DESCRIPTION]\n{{ $('Set Campaign Details').first().json['Ideal Client Description'] }}\n\n[max_profiles]\n{{ $('Set Campaign Details').first().json['Number of Prospects to Add'] }}\n\n",
        "options": {
          "systemMessage": "=# ICP Segment to Wiza API Parameters Converter\n\nYou are an expert at translating Ideal Customer Profile (ICP) descriptions into structured search parameters for the Wiza API, a lead enrichment and prospecting tool.\n\n## Your Task\nConvert the provided ICP segment description into a JSON object containing all necessary Wiza API search parameters.\n\n## API Parameter Structure\nThe output should follow this exact format:\n\n```json\n{\n  \"filters\": {\n    \"job_title\": [\n      {\n        \"v\": \"CEO\",\n        \"s\": \"i\"\n      }\n    ],\n    \"job_title_level\": [\n      \"CXO\"\n    ],\n    \"job_role\": [\n      \"finance\"\n    ],\n    \"location\": [\n      {\n        \"v\": \"Toronto, Ontario, Canada\",\n        \"b\": \"city\",\n        \"s\": \"i\"\n      }\n    ],\n    \"company_location\": [\n      {\n        \"v\": \"Ontario, Canada\",\n        \"b\": \"state\",\n        \"s\": \"i\"\n      }\n    ],\n    \"company_size\": [\n      \"1-10\",\n      \"11-50\"\n    ],\n    \"company_industry\": [\n      \"financial services\"\n    ],\n    \"year_founded_start\": \"2010\",\n    \"year_founded_end\": \"2024\"\n  },\n  \"list\": {\n    \"name\": \"Generated Lead List\",\n    \"max_profiles\": 100\n  }\n}\n```\n\n## Parameter Mapping Guidelines\n\n### Job Titles and Roles\n- Extract specific job titles mentioned (CEO, VP, Director, Manager, etc.)\n- Use `job_title` array with `{\"v\": \"title\", \"s\": \"i\"}` format\n- Map seniority levels to `job_title_level`:\n  - \"C-Suite\", \"CXO\" for executives\n  - \"VP\" for vice presidents\n  - \"Director\" for directors\n  - \"Manager\" for managers\n- Use `job_role` for functional areas: \"sales\", \"marketing\", \"finance\", \"operations\", \"hr\", \"engineering\", etc.\n\n### Company Information\n- `company_size` options: \"1-10\", \"11-50\", \"51-200\", \"201-500\", \"501-1000\", \"1001-5000\", \"5001-10000\", \"10000+\"\n- `company_industry`: Use standard industry classifications\n- `year_founded_start` and `year_founded_end`: Extract founding year ranges if mentioned\n\n### Location\n- `location`: Individual location with boundary type\n  - `\"b\": \"city\"` for cities\n  - `\"b\": \"state\"` for states/provinces\n  - `\"b\": \"country\"` for countries\n- `company_location`: Company headquarters location (same format)\n\n### Special Instructions\n1. **Multiple Segments**: If multiple ICP segments are described, create separate parameter objects for each\n2. **Broad Terms**: When terms like \"sales leaders\" or \"RevOps teams\" are mentioned, include relevant specific titles and roles\n3. **Industry Context**: Infer relevant industries from context (e.g., \"B2B software companies\" \u2192 \"software\", \"computer software\")\n4. **Default Values**: \n   - Set `max_profiles` to 100 unless specified\n   - Use descriptive list names based on the segment\n   - Default to inclusive search (`\"s\": \"i\"`) for titles and locations\n\n### Common Role Mappings\n- Sales leaders \u2192 job_titles: \"VP Sales\", \"Sales Director\", \"Head of Sales\"; job_role: \"sales\"\n- RevOps \u2192 job_titles: \"Revenue Operations\", \"RevOps Manager\"; job_role: \"operations\"  \n- Marketing agencies \u2192 company_industry: \"marketing and advertising\"\n- Recruiting agencies \u2192 company_industry: \"staffing and recruiting\"\n\n## Output Format\nProvide only the JSON object(s) with no additional explanation unless clarification is needed. If multiple segments are identified, provide separate JSON objects for each segment with clear labels."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "a6ee0ff5-bcb3-4955-8ba4-37b25c7a326c",
      "name": "Get Lists",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2752,
        1296
      ],
      "parameters": {
        "url": "=https://wiza.co/api/lists/{{ $json.data.id }}",
        "options": {
          "redirect": {
            "redirect": {}
          }
        },
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5b04b4fc-eb48-4fff-9233-83ff23df017f",
      "name": "Check If Finished",
      "type": "n8n-nodes-base.if",
      "position": [
        2976,
        1216
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "34f210cd-4780-4d97-8cde-a36d81e2ca81",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.data.status }}",
              "rightValue": "=finished"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "a2db64ad-b5ea-479d-a2d7-ae873d70b92d",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        3200,
        1392
      ],
      "parameters": {
        "unit": "minutes"
      },
      "typeVersion": 1.1
    },
    {
      "id": "0d209911-7952-439f-a6ca-9df5702eca97",
      "name": "Standardize Data",
      "type": "n8n-nodes-base.code",
      "position": [
        3392,
        1168
      ],
      "parameters": {
        "jsCode": "// Transform Wiza enrichment data to Lead Database table structure\nconst inputData = $input.all();\n\n// Extract the data array from the nested Wiza response\nconst leads = inputData.flatMap(item => {\n  const wizaResponse = item.json;\n  // Handle both direct data array and nested status/data structure\n  if (wizaResponse.data && Array.isArray(wizaResponse.data)) {\n    return wizaResponse.data;\n  }\n  return [wizaResponse];\n});\n\n// Map each lead to the target table structure\nconst transformedLeads = leads.map(lead => ({\n  json: {\n    campaign_name: lead.list_name || null,\n    name: lead.full_name || null,\n    linkedin_profile_url: lead.linkedin_profile_url || lead.linkedin || null,\n    email: lead.email || null,\n    title: lead.title || null,\n    location: lead.location || null,\n    phone: null, // Not provided by Wiza\n    company_name: lead.company || null,\n    company_size: lead.company_size_range || String(lead.company_size) || null,\n    company_type: lead.company_type || null,\n    company_industry: lead.company_industry || null,\n    company_revenue_range: lead.company_revenue || null,\n    company_linkedin: lead.company_linkedin || null,\n    company_location: lead.company_location || null,\n    company_domain: lead.company_domain || lead.domain || null,\n    email_sent: false,\n    research: null,\n    email_icebreaker: null\n  }\n}));\n\nreturn transformedLeads;"
      },
      "typeVersion": 2
    },
    {
      "id": "22fc51c1-9d32-46f6-8b41-3b16e230afc4",
      "name": "Update Leads",
      "type": "n8n-nodes-base.dataTable",
      "position": [
        3616,
        1168
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "campaign_name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "campaign_name",
              "defaultMatch": false
            },
            {
              "id": "name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "name",
              "defaultMatch": false
            },
            {
              "id": "linkedin_profile_url",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "linkedin_profile_url",
              "defaultMatch": false
            },
            {
              "id": "email",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "email",
              "defaultMatch": false
            },
            {
              "id": "title",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "title",
              "defaultMatch": false
            },
            {
              "id": "location",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "location",
              "defaultMatch": false
            },
            {
              "id": "phone",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "phone",
              "defaultMatch": false
            },
            {
              "id": "company_name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "company_name",
              "defaultMatch": false
            },
            {
              "id": "company_size",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "company_size",
              "defaultMatch": false
            },
            {
              "id": "company_type",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "company_type",
              "defaultMatch": false
            },
            {
              "id": "company_industry",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "company_industry",
              "defaultMatch": false
            },
            {
              "id": "company_revenue_range",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "company_revenue_range",
              "defaultMatch": false
            },
            {
              "id": "company_linkedin",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "company_linkedin",
              "defaultMatch": false
            },
            {
              "id": "company_location",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "company_location",
              "defaultMatch": false
            },
            {
              "id": "company_domain",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "company_domain",
              "defaultMatch": false
            },
            {
              "id": "email_sent",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "email_sent",
              "defaultMatch": false
            },
            {
              "id": "research",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "research",
              "defaultMatch": false
            },
            {
              "id": "email_icebreaker",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "email_icebreaker",
              "defaultMatch": false
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "9mbxPeJDNyjq5NKb",
          "cachedResultUrl": "/projects/yzH6t1qmVzBSVjA7/datatables/9mbxPeJDNyjq5NKb",
          "cachedResultName": "Lead Database"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "54f06ac5-c099-4594-816b-341d1bc53f3f",
      "name": "Research agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        4336,
        1264
      ],
      "parameters": {
        "text": "=## INSTRUCTIONS\nYou MUST use the Perplexity Research tool to search for real information. Do NOT make assumptions.\n\nSearch for:\n- Recent funding or growth announcements\n- Sales team hiring or expansion\n- New leadership hires\n- Anything the decision maker has said publicly (blogs, YouTube, tweets, podcasts)\n- Company challenges or initiatives\n- Company reviews on Glassdoor or similar\n- Industry pressure and trends\n- 'About Us' section on site\n\n## RULES\n- You MUST use the **Perplexity tool** for research before responding\n- Only include facts from the tool's response with verifiable sources\n- If nothing found, use \"No recent data found\"\n- Keep each field to 1 sentence max\n\n## INPUTS\n{{ JSON.stringify($json) }}",
        "options": {
          "systemMessage": "=You are a research agent finding organizational intel for cold outreach. You are searching for any strengths, potential weakenesses, oppurtunities and threats in order to generate a research report.\n\n\n",
          "returnIntermediateSteps": true
        },
        "promptType": "define"
      },
      "typeVersion": 3
    },
    {
      "id": "606077bf-8106-4797-bdb0-be798726d564",
      "name": "Ice Breaker Email Generator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        5088,
        1264
      ],
      "parameters": {
        "text": "=# TASK: EXECUTE IN THIS ORDER\nStep 1: Call the 'Get Case Studies' tool to find a match for the lead's industry or the challenges found in the Research Report.\nStep 2: If a case study result is returned, you MUST incorporate one specific metric or result into the \"Social Proof\" section of the email.\nStep 3: If no relevant case study is found after the tool call, only then are you permitted to use a generic industry observation.\nStep 4: Write the final email following the \"Anti-AI\" Style Guide and JSON format.\n\n# Business Context\n{{ $json['Our Business Profile'] }}\n\n# Approved Offers (Choose ONE) \n{{ $json.Our_Offer }}\n\n# Lead Research (SWOT/Report)\n{{ $json['Lead\\'s Research Report'] }}\n\n# Lead Personalization Info\n{{ JSON.stringify($json) }}\n",
        "options": {
          "systemMessage": "=# Role & Persona\nYou are a time-strapped Senior SDR. You write short, surgical emails that sound like they were sent from a phone. Your tone is neutral, direct, and observant.\n\n# Inputs\n* Research Report: SWOT analysis of the leads buisness based on deep research\n* Business Context information on our business and our market positioning\n* Our Offer: Campaign offer tailored to the lead's ICP\n_____________________________________________________________\n\n* Case Studies: You are REQUIRED to use the Get Case Studies tool for every lead. Your goal is to find \"Peer Social Proof.\" If the tool returns a match, condense the result into one punchy sentence (e.g., \"Recently helped [Similar Company] hit [Metric]\").\n* Personalization Data: Search the tool using the 'Industry' or 'Company Description' found in the Personalization Info.\n\n# Variable Mapping Rules\nYou must replace all placeholders with actual data from the \"Personalization Info\" block:\n- Replace 'first_name' with the actual first name.\n- Replace 'company_name' with the actual company name.\n- If a piece of data is missing, reword the sentence to remain natural without using a placeholder.\n\n# The \"Anti-AI\" Writing Style Guide\n* **Zero Enthusiasm:** No \"I\u2019m excited to\" or \"I was impressed by.\" Start immediately with the fact.\n* **Banned AI-isms:** delve, foster, navigate, vibrant, testament, empower, unlock, landscape, comprehensive, align, transformative, leverage.\n* **No Adjectives:** Use actual numbers instead of \"significant\" or \"rapid.\"\n* **Sentence Variety:** Mix one long observation with one very short sentence. Fragments are okay.\n* **Punctuation:** MAbsolutely NO em dash (\u2014) in any emails. No exclamation points.\n* **Formatting:** Lowercase subject lines. No punctuation in subject lines. Use <p> tags for line breaks.\n\n# Email Architecture\n1. Hook: State a neutral observation about their specific initiative. Do not compliment them (e.g., avoid 'stands out' or 'impressive'). Just state the fact and the likely challenge.\n2. The Gap: Why that fact matters to the prospect.\n3. Social Proof (Optional but recommended): Only if a case study is a direct match. Start a new sentence for this. Use the format: \"We helped a similar agency hit [Metric]. This doubled their volume.\" Never use a dash to connect the hook to the proof.\n4. The Offer: Choose a specific offer asset that relates to the gap outlined.\n5. Soft CTA: A low-friction question.\n\n# Constraints\n* Word Count: Aim for 3-4 sentences total. (Strict).\n* Output: Exactly one email.\n* Final Polish: Ensure NO curly braces or variable names remain in the final text.",
          "returnIntermediateSteps": true
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "569f121d-2a0d-41cd-8799-4e762bc64430",
      "name": "Follow-Up Sequence Generator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        5904,
        1264
      ],
      "parameters": {
        "text": "=# TASK: CREATE NARRATIVE FOLLOW-UPS\nStep 1: Identify the asset offered in the Original Outreach (PDF Benchmark or Leakage Audit).\nStep 2: Call 'Get Case Studies 2' to find a relevant story for Email 3.\nStep 3: Once you have the case study, generate exactly 3 follow-ups. \n\n\n# Original Outreach Context\nSubject: {{ $('Ice Breaker Email').item.json.subject_line }}\nBody: {{ $('Ice Breaker Email').item.json.email_body }}\n\n\n# DATA SOURCES\nLead: {{ JSON.stringify($('Standardize Data').first().json) }}\nResearch: {{ $('Research agent').item.json.output }}\nOffer: {{ $('Business Context').item.json.Our_Offer }}\n\n# FORMATTING CRITICAL RULES\n1. NO EM DASHES EVER. Use periods.\n2. SUBJECTS: For emails 2 and 3, use \"re: \" followed by the original subject line. For email 4, use a new \"breakup\" subject like \"closing the loop.\"\n3. VARIABLE REPLACEMENT: Ensure [Name] and [company_name] are replaced with real data.\n\n",
        "options": {
          "systemMessage": "=# Role & Persona\nYou are a Senior SDR writing from a phone. Short, blunt, helpful.\n\n# Sequence Narrative\n- Email 2 (Day 3): Mention the specific asset from the first email. Ask if it was received.\n- Email 3 (Day 8): Call the 'Get Case Studies' tool. Share one specific metric. Connect it to the lead's research.\n- Email 4 (Day 15): The Breakup. Direct and professional. Leave the door open to re-engagement if the prospect wishes in the future\n\n# Style Guardrails\n- NO EM DASHES.\n- Banned: delve, foster, navigate, vibrant, testament, empower, unlock, landscape, comprehensive, align, transformative, leverage.\n- Max word counts: Email 2 (30), Email 3 (50), Email 4 (25).",
          "returnIntermediateSteps": false
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "4eb2f4e2-5d2c-4e00-8d99-46f203c3ae3f",
      "name": "LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        4224,
        1488
      ],
      "parameters": {
        "model": "=openai/gpt-4o",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "351b2761-e498-42c6-98ff-0218ddbedf71",
      "name": "LLM1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        4912,
        1488
      ],
      "parameters": {
        "model": "=openai/gpt-4o",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "eedca925-46e3-451a-91d1-d6f05a5264ac",
      "name": "Memory 1",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        4400,
        1488
      ],
      "parameters": {
        "sessionKey": "=1",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "a542cc22-43ab-4301-8585-09abf476aafc",
      "name": "Memory 2",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        5088,
        1488
      ],
      "parameters": {
        "sessionKey": "=2",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "0e6337b0-688c-4ea2-85cd-d3ac11655385",
      "name": "Get Case Studies",
      "type": "n8n-nodes-base.dataTableTool",
      "position": [
        5216,
        1488
      ],
      "parameters": {
        "operation": "get",
        "returnAll": true,
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "1KC5NTZRhEZ3BXOm",
          "cachedResultUrl": "/projects/yzH6t1qmVzBSVjA7/datatables/1KC5NTZRhEZ3BXOm",
          "cachedResultName": "Case Study Database"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "38b70f9e-98ce-432b-b5d3-7676e81a85f2",
      "name": "Structured Output Parser - 1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        5392,
        1488
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"subject_line\": \"1-3 words lowercase no punctuation\",\n  \"email_body\": \"<p>Hi first_name,</p><p>Neutral observation with research stats.</p><p>Bridge to the challenge and the specific offer.</p><p>Soft CTA?</p><p>- Your Name</p>\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "97c24e71-1c89-4037-a0f9-123eb99ac707",
      "name": "LLM2",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        5744,
        1488
      ],
      "parameters": {
        "model": "z-ai/glm-4.6",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "22437547-6ce2-46f3-bf39-973295012b2d",
      "name": "Memory 3",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        5904,
        1488
      ],
      "parameters": {
        "sessionKey": "=3",
        "sessionIdType": "customKey"
      },
      "typeVersion": 1.3
    },
    {
      "id": "fae033ce-7b5e-4e61-a8c8-8dcb69339650",
      "name": "Get Case Studies 2",
      "type": "n8n-nodes-base.dataTableTool",
      "position": [
        6048,
        1488
      ],
      "parameters": {
        "operation": "get",
        "returnAll": true,
        "dataTableId": {
          "__rl": true,
          "mode": "list",
          "value": "1KC5NTZRhEZ3BXOm",
          "cachedResultUrl": "/projects/yzH6t1qmVzBSVjA7/datatables/1KC5NTZRhEZ3BXOm",
          "cachedResultName": "Case Study Database"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "224020ea-7578-4a4c-9c17-0340f6903525",
      "name": "Structured Output Parser - 2",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        6208,
        1488
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"followups\": [\n    {\n      \"sequence_number\": 2,\n      \"delay_days\": 3,\n      \"subject\": \"\",\n      \"email_body\": \"\"\n    },\n    {\n      \"sequence_number\": 3,\n      \"delay_days\": 5,\n      \"subject\": \"\",\n      \"email_body\": \"\"\n    },\n    {\n      \"sequence_number\": 4,\n      \"delay_days\": 7,\n      \"subject\": \"\",\n      \"email_body\": \"\"\n    }\n  ]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "8a66c125-1ab2-4bd1-bd90-6ad99e31ecdb",
      "name": "Follow-up Sequence Generator set",
      "type": "n8n-nodes-base.set",
      "position": [
        6368,
        1264
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f79c7181-43f9-421e-b49d-6624b6b84248",
              "name": "output",
              "type": "object",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "da3520bf-6f1a-420c-a9a4-145522c7941c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        736
      ],
      "parameters": {
        "width": 560,
        "height": 1200,
        "content": "# Wiza Powered Full AI SDR Agent\n\n@[youtube](xkxuuA9velI)\n\n## Workflow Set-Up\nAPIs: \n**- [Smartlead](https://www.smartlead.ai/)**\n**- [Wiza](https://wiza.co/auth/login)**\n**- [OpenRouter](https://openrouter.ai/)**\n**- [Perplexity](https://www.perplexity.ai/)**\n\n## Full Documentation\nFind all downloadable resources including detailed set up information and database template csv in the [Downloadable CSV in Full Notion Documentation](https://freemezie.notion.site/Full-AI-SDR-Workflow-285c8a2a63e0806f9561d4772525d087)\n\n## Workflow Overview\nA 100% automated system that sets up your email campaigns, finds your perfect leads, researches their companies, and writes personalized emails that get more replies.\n\n ### 1\ufe0f\u20e3 Set Up the Campaign & Pick Best Email\n- Automatically creates a new campaign in Smartlead.\n- Smart Selection: It picks the email account with the lowest spam score and best reputation to send from.\n\n### 2\ufe0f\u20e3 Find the Right Leads Automatically\n- AI Search: Describe your target customer, and AI finds them in Wiza.\n- Auto-Save: All lead names and verified emails are saved into your own database.\n\n### 3\ufe0f\u20e3 Research & Write Personal Emails\n- Deep Research: AI searches the web for real news about each lead.\n- Custom Writing: AI writes a unique message for every person using your real results.\n- One-Click Upload: All personalized leads are pushed into the campaign to start sending."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "126c9117-16e6-459c-8588-33b93925523d",
  "connections": {
    "LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Research agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "LLM1": {
      "ai_languageModel": [
        [
          {
            "node": "Ice Breaker Email Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "LLM2": {
      "ai_languageModel": [
        [
          {
            "node": "Follow-Up Sequence Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Get Lists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Memory 1": {
      "ai_memory": [
        [
          {
            "node": "Research agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Memory 2": {
      "ai_memory": [
        [
          {
            "node": "Ice Breaker Email Generator",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Memory 3": {
      "ai_memory": [
        [
          {
            "node": "Follow-Up Sequence Generator",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Get Lists": {
      "main": [
        [
          {
            "node": "Check If Finished",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lead_info": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Leads": {
      "main": [
        [
          {
            "node": "Lead_info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research agent": {
      "main": [
        [
          {
            "node": "Business Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory7": {
      "ai_memory": [
        [
          {
            "node": "Format Search Parameters",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Start Campaign",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Research agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Campaign id": {
      "main": [
        [
          {
            "node": "Fetch Email Accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Business Context": {
      "main": [
        [
          {
            "node": "Ice Breaker Email Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Case Studies": {
      "ai_tool": [
        [
          {
            "node": "Ice Breaker Email Generator",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Standardize Data": {
      "main": [
        [
          {
            "node": "Update Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Finished": {
      "main": [
        [
          {
            "node": "Get Lists Contacts",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Ice Breaker Email": {
      "main": [
        [
          {
            "node": "Follow-Up Sequence Generator",
            "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

Receives campaign parameters via form, creates a Smartlead campaign, sources qualified leads through Wiza based on your ICP description, researches each prospect with Perplexity AI, generates personalized icebreaker emails and follow-up sequences with OpenRouter LLMs, and…

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

The AI-Powered Shopify SEO Content Automation is an enterprise-grade workflow that transforms product content creation for e-commerce stores. This sophisticated multi-agent system integrates GPT-4o, C

Perplexity Tool, Memory Buffer Window, Agent +15
AI & RAG

Deep Research new (fr). Uses outputParserStructured, formTrigger, chainLlm, form. Event-driven trigger; 82 nodes.

Output Parser Structured, Form Trigger, Chain Llm +8
AI & RAG

Who is this for? Agencies, consultants, and service providers who conduct discovery calls and need to quickly turn conversations into professional proposals.

Tool Think, Tool Calculator, Agent Tool +18
AI & RAG

This workflow serves as a comprehensive "Workflow Nodes SEO & Documentation Generator". It uses AI to analyze, rename, and document n8n workflows, offering a streamlined way to optimize workflow reada

Form Trigger, n8n, Output Parser Autofixing +11
AI & RAG

This is an automated blog post generation system that: Researches topics using AI agents and web search tools Writes complete blog posts with proper SEO structure Generates custom images for each post

Output Parser Structured, Google Gemini Chat, HTTP Request Tool +11