{
  "id": "JSbfaa3mtNzMLYXT",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Data Engineer Hiring Personalized Email with PredictLeads",
  "tags": [],
  "nodes": [
    {
      "id": "0994f250-29af-4dba-b32c-0616c6818b05",
      "name": "About This Workflow",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 420,
        "height": 400,
        "content": "ABOUT THIS WORKFLOW\n\nFinds companies hiring data engineers, enriches them with tech stack data from PredictLeads, and sends AI-personalized service offering emails.\n\nSetup: PredictLeads API, OpenAI API key, Gmail OAuth2.\n\nUse case: A data consultancy finds companies that posted data engineer roles, then sends them a tailored pitch referencing their current stack (e.g., \"I see you're on Snowflake and looking for pipeline engineers\").\n\nPredictLeads API: https://predictleads.com\nQuestions: https://www.linkedin.com/in/yaronbeen"
      },
      "typeVersion": 1
    },
    {
      "id": "09f381c9-4081-49fc-8454-f6e89ee47de8",
      "name": "\ud83d\udccb Trigger & Discovery",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -336
      ],
      "parameters": {
        "color": 5,
        "width": 640,
        "height": 712,
        "content": "## \u23f0 Trigger & Job Discovery\n\n**Nodes:**  \n\u23f0 Daily Schedule \u2192 set domain \u2192 \ud83d\udd0d Fetch Data Engineer Job Openings\n\n**Description:**  \nThe workflow starts on a daily schedule that automatically triggers the process.\n\nA domain is defined and used to query the PredictLeads API for **job openings related to \u201cData Engineer\u201d roles**.  \nThis step identifies companies that are actively investing in data infrastructure or analytics capabilities.\n\nThese hiring signals act as strong indicators that the company may require external **data engineering services or support**."
      },
      "typeVersion": 1
    },
    {
      "id": "422c5e63-31e9-44ba-aebb-0e25eb8ac5a4",
      "name": "\ud83d\udd2c Enrichment",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -384
      ],
      "parameters": {
        "color": 5,
        "width": 700,
        "height": 792,
        "content": "## \ud83d\udd0d Company Enrichment\n\n**Nodes:**  \n\ud83d\udd00 Split by Company \u2192 \ud83c\udfe2 Get Company Info \u2192 \ud83d\udcbb Get Technology Stack\n\n**Description:**  \nEach company identified in the job discovery step is processed individually.\n\nThe workflow enriches the company using PredictLeads data sources to gather additional context including:\n- Company profile information  \n- Industry and company size  \n- Current technology stack  \n\nThis enrichment step helps build a deeper understanding of the company\u2019s technical environment and hiring needs, enabling more relevant outreach."
      },
      "typeVersion": 1
    },
    {
      "id": "864a20ec-1360-4c35-a123-56866a2b6490",
      "name": "\ud83e\udd16 AI Personalization",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1904,
        -368
      ],
      "parameters": {
        "color": 5,
        "width": 748,
        "height": 776,
        "content": "## \ud83e\udd16 AI Personalization & Outreach\n\n**Nodes:**  \n\u2699\ufe0f Build Personalized Prompt \u2192 \ud83e\udd16 Generate Personalized Email \u2192 \ud83d\udce7 Send Personalized Email\n\n**Description:**  \nA detailed prompt is created by combining company information, industry context, and the detected technology stack.\n\nOpenAI then generates a **personalized outreach email** tailored to the company\u2019s hiring activity and current technical environment.  \nThe message references their tools (for example Snowflake or other data platforms) and proposes relevant services such as data pipeline development, data warehouse optimization, or analytics infrastructure support.\n\nFinally, the AI-generated email is automatically sent via Gmail with a personalized subject line, delivering targeted outreach to companies actively hiring data engineers."
      },
      "typeVersion": 1
    },
    {
      "id": "92932612-99c4-4825-af59-821ada8f828d",
      "name": "\u23f0 Daily Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        480,
        160
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 8
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "9e6b96ec-d5f9-4569-b12a-4d03babd6baa",
      "name": "\ud83d\udd0d Fetch Data Engineer Job Openings",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        880,
        160
      ],
      "parameters": {
        "url": "=https://predictleads.com/api/v3/companies/{{ $json.domain }}/job_openings",
        "options": {},
        "sendQuery": true,
        "sendHeaders": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "title",
              "value": "data engineer"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "YOUR_PREDICTLEADS_API_KEY"
            },
            {
              "name": "X-Api-Token",
              "value": "YOUR_PREDICTLEADS_API_TOKEN"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "74d79b87-8988-4bb1-8840-8bb1f097a027",
      "name": "\ud83d\udd00 Split by Company",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        1216,
        160
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "70587664-5c2e-4e57-aca4-c0c2a2a06641",
      "name": "\ud83c\udfe2 Get Company Info",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1424,
        176
      ],
      "parameters": {
        "url": "=https://predictleads.com/api/v3/companies/{{ $('set domain').item.json.domain }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "YOUR_PREDICTLEADS_API_KEY"
            },
            {
              "name": "X-Api-Token",
              "value": "YOUR_PREDICTLEADS_API_TOKEN"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "dbc36738-26bc-41a5-bbcc-85dbd00a5458",
      "name": "\ud83d\udcbb Get Technology Stack",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1632,
        176
      ],
      "parameters": {
        "url": "=https://predictleads.com/api/v3/companies/{{ $('set domain').item.json.domain }}/technology_detections",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-Api-Key",
              "value": "YOUR_PREDICTLEADS_API_KEY"
            },
            {
              "name": "X-Api-Token",
              "value": "YOUR_PREDICTLEADS_API_TOKEN"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d54afd86-8349-4075-af47-50adc5517d54",
      "name": "\u2699\ufe0f Build Personalized Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        2000,
        176
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\nconst results = [];\n\n// domain from Set Domain node\nconst domain = $('set domain').first().json.domain || '';\n\nfor (const item of items) {\n\n  const companyData = item.json.data || {};\n\n  // company name from domain (remove .com or any TLD)\n  const companyName = domain.split('.')[0];\n\n  const industry =\n    companyData.industry ||\n    'technology';\n\n  const size =\n    companyData.employee_count ||\n    'unknown';\n\n  const description =\n    companyData.description ||\n    '';\n\n  const technologies = item.json.data || [];\n\n  const techList = technologies\n    .map(t => t.name || t.technology_name)\n    .filter(Boolean)\n    .join(', ');\n\n  const cleanTech =\n    techList.length ? techList : 'not available';\n\n  const prompt = `You are a B2B sales expert specializing in data engineering services. Draft a personalized outreach email.\n\nContext:\nCompany: ${companyName}\nDomain: ${domain}\nIndustry: ${industry}\nCompany size: ${size}\nCompany description: ${description}\nTheir current tech stack includes: ${cleanTech}\n\nRequirements:\n- Subject line included\n- Mention their tech stack and how your services add value\n- Offer solutions like data pipelines, warehouse optimization etc.\n- Professional but friendly tone\n- Clear call-to-action for a short intro call`;\n\n  results.push({\n    json: {\n      company: companyName,\n      domain: domain,\n      industry: industry,\n      tech_stack: cleanTech,\n      prompt: prompt\n    }\n  });\n\n}\n\nreturn results;"
      },
      "typeVersion": 2
    },
    {
      "id": "2b8624a1-b5cf-4c54-bc5a-5e52c4b417f2",
      "name": "\ud83e\udd16 Generate Personalized Email",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2224,
        176
      ],
      "parameters": {
        "url": "https://api.openai.com/v1/chat/completions",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"model\": \"gpt-4o-mini\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are a B2B sales expert specializing in data engineering services. Write concise, personalized outreach emails that demonstrate deep understanding of the prospect's needs.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": {{ JSON.stringify($json.prompt) }}\n    }\n  ],\n  \"temperature\": 0.7,\n  \"max_tokens\": 500\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_TOKEN_HERE"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9435379a-ff57-40e0-9e36-446d7bd48bbb",
      "name": "\ud83d\udce7 Send Personalized Email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        2464,
        176
      ],
      "parameters": {
        "sendTo": "={{ $('\u2699\ufe0f Build Personalized Prompt').item.json.domain.replace(/\\..*/, '') }}@example.com",
        "message": "={{ $json.choices[0].message.content }}",
        "options": {},
        "subject": "=Data Engineering Services for {{ $('\u2699\ufe0f Build Personalized Prompt').item.json.company }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "d7a8f631-9e7f-44c7-b10a-c82b0f5f7e18",
      "name": "set domain",
      "type": "n8n-nodes-base.set",
      "position": [
        688,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "cc8d791d-6d76-4fca-96a7-ed1977ccd338",
              "name": "domain",
              "type": "string",
              "value": "stripe.com"
            }
          ]
        }
      },
      "typeVersion": 3.4
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "9042a879-c419-4493-b7d9-1275ac8b2360",
  "connections": {
    "set domain": {
      "main": [
        [
          {
            "node": "\ud83d\udd0d Fetch Data Engineer Job Openings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u23f0 Daily Schedule": {
      "main": [
        [
          {
            "node": "set domain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83c\udfe2 Get Company Info": {
      "main": [
        [
          {
            "node": "\ud83d\udcbb Get Technology Stack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd00 Split by Company": {
      "main": [
        [],
        [
          {
            "node": "\ud83c\udfe2 Get Company Info",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udcbb Get Technology Stack": {
      "main": [
        [
          {
            "node": "\u2699\ufe0f Build Personalized Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udce7 Send Personalized Email": {
      "main": [
        [
          {
            "node": "\ud83d\udd00 Split by Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u2699\ufe0f Build Personalized Prompt": {
      "main": [
        [
          {
            "node": "\ud83e\udd16 Generate Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83e\udd16 Generate Personalized Email": {
      "main": [
        [
          {
            "node": "\ud83d\udce7 Send Personalized Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\ud83d\udd0d Fetch Data Engineer Job Openings": {
      "main": [
        [
          {
            "node": "\ud83d\udd00 Split by Company",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}