{
  "name": "Outreach Email Openers: n8n, Perplexity, Claude (free JSON)",
  "nodes": [
    {
      "id": "33074582-e6ea-4ba4-be34-a6f4695b5958",
      "name": "Sticky Note - Data Source",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 452,
        "height": 508,
        "content": "## Data source: Google Sheets\n\nGet Leads reads your Leads tab. The columns used are id, first_name, last_name, title, organization_name, Icebreaker and company_name_cleanup. The id must be unique for every row, because the update matches rows by id.\n\nSet Icebreaker to exactly no data for every lead you want processed. Rows with any other value, including an empty cell, are skipped."
      },
      "typeVersion": 1
    },
    {
      "id": "7f8ff355-6c3a-4bdf-ae3a-2339cec3c289",
      "name": "Sticky Note - Batch Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -928,
        -80
      ],
      "parameters": {
        "color": 6,
        "width": 264,
        "height": 508,
        "content": "## Batches\n\nLoop Over Leads takes 25 leads at a time. All 25 go through each step before the next step starts, and the sheet is updated only at the end of the batch. There is no pause between calls."
      },
      "typeVersion": 1
    },
    {
      "id": "0bd311ec-7e5c-42ab-bfaf-d7765ba7ca84",
      "name": "Sticky Note - Company Name Cleanup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -672,
        -80
      ],
      "parameters": {
        "color": 7,
        "width": 348,
        "height": 512,
        "content": "## Company name cleanup\n\nAn OpenAI model shortens the company name so it sounds natural, for example Lantern Agency becomes Lantern. It returns a JSON field named CompanyNameCleanUp, which is read by the next steps and saved in the sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "65c388ac-5d75-4ee3-8886-31208aba6725",
      "name": "Sticky Note - Research",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -336,
        -80
      ],
      "parameters": {
        "color": 3,
        "width": 372,
        "height": 520,
        "content": "## Research\n\nPerplexity Sonar, reached through OpenRouter, is asked about the lead's first name, last name, job title, company and today's date. Its answer is web research written by an AI. It can describe the wrong person or the wrong company, and it can be out of date."
      },
      "typeVersion": 1
    },
    {
      "id": "38c666f7-d9a3-4888-9626-6aec78a6fd7c",
      "name": "Sticky Note - Icebreaker Generation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        32,
        -80
      ],
      "parameters": {
        "color": 3,
        "width": 376,
        "height": 512,
        "content": "## Icebreaker\n\nClaude Sonnet, reached through OpenRouter, writes the opener from the research. It is told to use a casual tone, mention only facts that appear in the research, and end with the sentence that points to your company. Read every opener before you use it."
      },
      "typeVersion": 1
    },
    {
      "id": "89b9858e-2ef6-448a-8e06-b0b734f35311",
      "name": "Sticky Note - Update",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -80
      ],
      "parameters": {
        "color": 5,
        "width": 300,
        "height": 512,
        "content": "## Update the sheet\n\nUpdate Icebreaker writes company_name_cleanup and Icebreaker into the row with the same id, then sends the loop to the next batch."
      },
      "typeVersion": 1
    },
    {
      "id": "715bd285-c8a7-4520-9571-8e2c3db18511",
      "name": "Sticky Note - Quick Start",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1680,
        -336
      ],
      "parameters": {
        "color": 4,
        "width": 304,
        "height": 772,
        "content": "## Quick start\n\n1. Create a Google Sheet with a tab named Leads and the columns id, first_name, last_name, title, organization_name, Icebreaker and company_name_cleanup.\n2. Put no data in Icebreaker for two or three test leads.\n3. Connect Google Sheets, OpenAI and OpenRouter.\n4. Replace YOUR_GOOGLE_SHEET_ID in Get Leads and Update Icebreaker, and check the tab name.\n5. Run it on the test leads and read each opener."
      },
      "typeVersion": 1
    },
    {
      "id": "9ec50fca-839f-446d-87b9-1d03e7a0baff",
      "name": "Sticky Note - Cost Analysis",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        688,
        -80
      ],
      "parameters": {
        "color": 4,
        "width": 280,
        "height": 512,
        "content": "## Cost and limits\n\nEach lead uses three AI calls: the name cleanup, the research and the opener. Prices depend on your providers and change, so check them and set spending limits before a large run."
      },
      "typeVersion": 1
    },
    {
      "id": "e47f3da6-f275-4de1-8cda-d9f6e8bbb09f",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1600,
        256
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "55f0d612-d933-42c0-9724-23a9ade26fb1",
      "name": "Loop Over Leads",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        -880,
        256
      ],
      "parameters": {
        "options": {},
        "batchSize": 25
      },
      "typeVersion": 3
    },
    {
      "id": "1ac1c796-fb63-4505-aab2-e03bf331bd19",
      "name": "Company Name Clean Up",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        -608,
        256
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {
          "topP": 1,
          "maxTokens": 250,
          "temperature": 0.6
        },
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "You are a helpful, intelligent writing assistant."
            },
            {
              "content": "=Your task is to clean up a company name.\n\n\nTo clean up company name paraphrase {{ $('Get Leads').item.json.organization_name }}\ne.g.:\n\"The Lantern Agency\" MUST be \"Lantern\"\n\"Oakfield Branding Solutions\" MUST be \"Oakfield\"\n\"Cedar Collective Agency\" MUST be \"Cedar Collective\"\n\"RG Agency\" MUST be \"RG\"\n\"Pinewood Web Design and Digital Marketing Agency\" MUST be \"Pinewood\"\n\nAlways output a cleaned up company name!\n\nReturn JSON:\n{\nCompanyNameCleanUp: \"\"\n}"
            },
            {
              "content": "Shorten company names so they sound natural in a message, the way a person would say them.\n\nExamples:\n\"Lantern Agency\" or \"Lantern\" NOT \"THE LANTERN AGENCY\"; \"Oakfield\" NOT \"Oakfield Branding Solutions\"; \"RG\" or \"RG agency\" NOT \"RG Digital Agency\"; \"Cedar\" NOT \"Cedar Marketing Agency\". If a company name contains the word \"Agency\" like this: \"Lantern Agency\", use only the name, for example \"Lantern\". If a company has \"Inc.\" or \"Group\" in the name, avoid using these words in the text."
            }
          ]
        },
        "jsonOutput": true
      },
      "retryOnFail": true,
      "typeVersion": 1.6
    },
    {
      "id": "d3fc0e7f-aa5c-4371-9320-8464732f974a",
      "name": "Perplexity Sonar",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -256,
        352
      ],
      "parameters": {
        "model": "perplexity/sonar",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "b995242f-530f-4ab0-8aa6-805cb02ccac7",
      "name": "Claude Sonnet",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        112,
        352
      ],
      "parameters": {
        "model": "anthropic/claude-sonnet-4",
        "options": {
          "topP": 0.8,
          "maxTokens": 300
        }
      },
      "typeVersion": 1
    },
    {
      "id": "107c9bc9-0ed5-4513-9312-b287705e1842",
      "name": "Parse JSON",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        256,
        352
      ],
      "parameters": {
        "jsonSchemaExample": "{\"icebreaker\":\"\"}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "9433978e-fbcc-4c33-8366-285ff7a7ae17",
      "name": "Generate Icebreaker",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        112,
        256
      ],
      "parameters": {
        "text": "=You are a helpful, intelligent assistant",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "message": "=You are a helpful, intelligent assistant"
            },
            {
              "type": "HumanMessagePromptTemplate",
              "message": "=Write an icebreaker—a one line, customized introduction—for a cold email campaign.\n\nUse the provided data (from a Google Search) as context.\n\nGuidelines:\n1. Your tone of voice should be \"casual bar conversation\" and very spartan. No fancy language.\n2. Look for a real connection between the context and the reader's business. If the context contains nothing specific, keep the line plain and do not invent one.\n3. Do not lie & stretch the truth. For example, if one was a poker pro player, do not mention that I was as well!\n4. Only mention facts that appear in the context.\n5. After \"Hey [firstName],\"  always put \\n\\n\n6. End the icebreaker with \"I wanted to share something that could be relevant for {{ $('Company Name Clean Up').item.json.message.content.CompanyNameCleanUp }}\".\n\nExample icebreakers:\n\n\"Hey Maya,\\n\\nReally like the way Lantern started out printing menus for local cafes - pretty cool how you've grown that into packaging for small food brands, I wanted to share something that could be relevant for Lantern\""
            },
            {
              "type": "HumanMessagePromptTemplate",
              "message": "={\"first_name\":\"{{ $('Get Leads').item.json.first_name }}\",\"context\":\"{{ $json.text }}\"}"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.7
    },
    {
      "id": "5442e9b6-32a4-4c7d-9502-e444f3d3e8dd",
      "name": "Perplexity Research",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -256,
        256
      ],
      "parameters": {
        "text": "=Find information",
        "batching": {},
        "messages": {
          "messageValues": [
            {
              "type": "HumanMessagePromptTemplate",
              "message": "={{ $('Get Leads').item.json.first_name }} {{ $('Get Leads').item.json.last_name }} {{ $('Get Leads').item.json.title }} {{ $('Get Leads').item.json.organization_name }} at {{ $now.toFormat('dd.MM.yyyy') }}"
            }
          ]
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "1489908c-e151-416e-93df-9c56ba8e7d92",
      "name": "Update Icebreaker",
      "type": "n8n-nodes-base.googleSheets",
      "maxTries": 2,
      "position": [
        496,
        256
      ],
      "parameters": {
        "columns": {
          "value": {
            "id": "={{ $('Get Leads').item.json.id }}",
            "Icebreaker": "={{ $json.output.icebreaker }}",
            "row_number": 0,
            "company_name_cleanup": "={{ $('Company Name Clean Up').item.json.message.content.CompanyNameCleanUp }}"
          },
          "schema": [
            {
              "id": "id",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "id",
              "defaultMatch": true,
              "canBeUsedToMatch": true
            },
            {
              "id": "company_name_cleanup",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "company_name_cleanup",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Icebreaker",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Icebreaker",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "id"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "retryOnFail": false,
      "typeVersion": 4.6
    },
    {
      "id": "ae2616ec-c0e4-4267-ace9-523e475c9f8d",
      "name": "Check If Unprocessed",
      "type": "n8n-nodes-base.if",
      "position": [
        -1104,
        256
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "ebb9dbd8-0616-4a42-a4c2-1aa2532f8b15",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.Icebreaker }}",
              "rightValue": "no data"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "b92cd82b-8276-48a6-b99f-c9cc5351492a",
      "name": "Get Leads",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -1328,
        256
      ],
      "parameters": {
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "YOUR_GOOGLE_SHEET_ID"
        }
      },
      "executeOnce": false,
      "typeVersion": 4.6
    },
    {
      "id": "5a1e8c37-2d94-4b6f-9e03-6c7b4f1a8d52",
      "name": "Before you turn it on",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        480
      ],
      "parameters": {
        "color": 3,
        "width": 1100,
        "height": 380,
        "content": "## Before you turn it on\n\n1. Test on two or three leads you know. Check that the research describes the right person.\n2. The research step names real people. Make sure you have a lawful reason to research and email them.\n3. Read every opener. Delete any that mention something you cannot verify.\n4. The workflow does not send emails. If you add sending, you are responsible for the rules on unsolicited email.\n5. Lead names, job titles and companies go to OpenRouter, Perplexity, Anthropic and OpenAI.\n6. Not tested on live APIs."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Get Leads": {
      "main": [
        [
          {
            "node": "Check If Unprocessed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse JSON": {
      "ai_outputParser": [
        [
          {
            "node": "Generate Icebreaker",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Claude Sonnet": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Icebreaker",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Leads": {
      "main": [
        [],
        [
          {
            "node": "Company Name Clean Up",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity Sonar": {
      "ai_languageModel": [
        [
          {
            "node": "Perplexity Research",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Update Icebreaker": {
      "main": [
        [
          {
            "node": "Loop Over Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Icebreaker": {
      "main": [
        [
          {
            "node": "Update Icebreaker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Perplexity Research": {
      "main": [
        [
          {
            "node": "Generate Icebreaker",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Company Name Clean Up": {
      "main": [
        [
          {
            "node": "Perplexity Research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check If Unprocessed": {
      "main": [
        [
          {
            "node": "Loop Over Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}