{
  "nodes": [
    {
      "id": "d33856c0-ae76-494d-aa57-39ffe8de3852",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -540,
        -20
      ],
      "parameters": {
        "options": {},
        "formTitle": "Kontaktformular",
        "formFields": {
          "values": [
            {
              "fieldLabel": "Vollständiger Name",
              "placeholder": "z.B. Max Mustermann",
              "requiredField": true
            },
            {
              "fieldType": "email",
              "fieldLabel": "E-Mail-Adresse",
              "placeholder": "z.B. max@beispiel.com",
              "requiredField": true
            },
            {
              "fieldType": "number",
              "fieldLabel": "Telefonnummer",
              "placeholder": "z.B. 0123456789",
              "requiredField": true
            },
            {
              "fieldLabel": "LinkedIn-Profil-URL"
            }
          ]
        },
        "formDescription": "Wir werden uns bei Ihnen melden"
      },
      "typeVersion": 2.2
    },
    {
      "id": "87e4f3a8-8f35-4320-9ddc-218bd8f1ccd0",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -320,
        -20
      ],
      "parameters": {
        "url": "https://api.apollo.io/api/v1/people/match",
        "method": "POST",
        "options": {},
        "sendQuery": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "queryParameters": {
          "parameters": [
            {
              "name": "name",
              "value": "={{ $json['Vollständiger Name'] }}"
            },
            {
              "name": "email",
              "value": "={{ $json['E-Mail-Adresse'] }}"
            },
            {
              "name": "reveal_phone_number",
              "value": "={{ $json['Telefonnummer'] }}"
            },
            {
              "name": "linkedin_url",
              "value": "={{ $json['LinkedIn-Profil-URL'] }}"
            }
          ]
        }
      },
      "credentials": {
        "httpHeaderAuth": {
          "id": "credential-id",
          "name": "httpHeaderAuth Credential"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "5aac3e51-fd45-4f7c-99e1-7b81b1a6ea8b",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        520,
        -40
      ],
      "parameters": {
        "text": "=Sie sind ein professioneller B2B-Vertriebsassistent.\n\nVerfassen Sie eine kurze, professionelle und höfliche E-Mail zur Kontaktaufnahme mit dem folgenden Lead.\n\nTon: prägnant und respektvoll. Ziel ist es, ein Gespräch zu eröffnen und ein Treffen zu vereinbaren.\n\nVerwenden Sie dieses Format:\n---\nE-Mail senden:\nAn: {{ $('HTTP Request').item.json.person.email }}\nBetreff: Zusammenarbeit in KI-Lösungen erkunden\n\nHallo {{ $('HTTP Request').item.json.person.name }},\n\nIch hoffe, es geht Ihnen gut.\n\nIch kontaktiere Sie von ABC Pvt Ltd – wir sind auf maßgeschneiderte IT-Lösungen spezialisiert, einschließlich KI- und Machine-Learning-Diensten. Angesichts Ihrer Rolle bei {{ $('HTTP Request').item.json.person.employment_history[0].organization_name }}, würde ich mich freuen, kurz in Kontakt zu treten und mögliche Synergien zu erkunden.\n\nWären Sie diese Woche für ein kurzes Gespräch verfügbar?\n\nMit freundlichen Grüßen,\nABC XYZ\nABC Pvt Ltd\n---\n\nHier sind die Lead-Details:\nName: {{ $('HTTP Request').item.json.person.name }}\nE-Mail: {{ $('HTTP Request').item.json.person.email }}\nJobtitel: {{ $('HTTP Request').item.json.person.title }}\nOrganisation: {{ $('HTTP Request').item.json.person.employment_history[0].organization_name }}\n\nAnweisungen:\nTools - E-Mail senden in Gmail Tools für den Versand von E-Mails",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "02cd5fdd-1baa-4a03-8832-af83476eec98",
      "name": "Send a message in Gmail",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        600,
        200
      ],
      "parameters": {
        "sendTo": "={{ $('HTTP Request').item.json.person.email }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {},
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "credential-id",
          "name": "gmailOAuth2 Credential"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "cae69208-18b5-493b-8f14-809e0180a868",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        480,
        200
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "id": "credential-id",
          "name": "groqApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fac878f8-18eb-482c-a889-5d694549af6c",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        720,
        200
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "da7ad0ef-87ae-4da0-bee0-d464c7e33d3c",
      "name": "Append row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        920,
        -40
      ],
      "parameters": {
        "columns": {
          "value": {
            "Name": "={{ $('On form submission').item.json[\"Vollständiger Name\"] }}",
            "Email": "={{ $('On form submission').item.json[\"E-Mail-Adresse\"] }}",
            "Phone": "={{ $('On form submission').item.json[\"Telefonnummer\"] }}",
            "Job Title": "={{ $('HTTP Request').item.json.person.title }}",
            "Linkedin URL": "={{ $('On form submission').item.json[\"LinkedIn-Profil-URL\"] }}",
            "Organization": "={{ $('HTTP Request').item.json.person.employment_history[0].organization_name }}"
          },
          "schema": [
            {
              "id": "Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Job Title",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Job Title",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Organization",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Organization",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Linkedin URL",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Linkedin URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Z3BuYjWFsGjCjTmpyCUqtjL_gHPZDBriDzfMUudmArA"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "credential-id",
          "name": "googleSheetsOAuth2Api Credential"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "b0c08c59-1116-44ed-914f-2e71e43d3208",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -100,
        -20
      ],
      "parameters": {
        "text": "=Sie sind ein Experte für die Qualifizierung von Leads.\n\nBewerten Sie den Lead von 1 bis 10 basierend auf diesen beiden Kriterien:\n\n— BRANCHENANPASSUNG (max. 5 Punkte) —\n- 5 Punkte: Branche ist KI, Künstliche Intelligenz, Maschinelles Lernen, Datenwissenschaft\n- 3-4 Punkte: Branche ist eng verwandt (z.B. Analytik, Automatisierung, Unternehmens-KI-Tools)\n- 0-2 Punkte: Unverwandte Branche\n\n— JOBTITELANPASSUNG (max. 5 Punkte) —\n- 5 Punkte: Entscheidungsträger oder Einflussnehmer in der KI (z.B. Leiter KI, KI-Direktor, CTO, KI-Produktmanager)\n- 3-4 Punkte: Mittlere KI-Fachkräfte (z.B. ML-Ingenieur, Datenwissenschaftler)\n- 0-2 Punkte: Nicht mit KI oder Junior-Rollen verwandt\n\nGeben Sie **nur eine einzelne Ziffer zwischen 1 und 10** zurück – keine Erklärung, keine Bezeichnungen, kein zusätzlicher Text.\n\nLead-Details:\nName: {{ $json.person.name }}\nJobtitel: {{ $json.person.title }}\nOrganisation: {{ $json.person.employment_history[0].organization_name }}\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "e4e59a80-4c68-4880-accd-bd3be08cb759",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        260,
        -20
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "eb511082-5f34-4027-993b-a787340fc4ea",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{Number($json.output)}}",
              "rightValue": 6
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "7aeac238-77c1-43ec-a189-2b69e72f745c",
      "name": "Groq Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        -20,
        200
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "id": "credential-id",
          "name": "groqApi Credential"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fa0db3cb-6bdf-46f4-9135-d2b149ca15a1",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -540,
        180
      ],
      "webhookId": "17cfab42-90df-4af6-88ff-6ed925f861cc",
      "parameters": {
        "path": "17cfab42-90df-4af6-88ff-6ed925f861cc",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "e74c132d-0270-4585-ace8-0651fa4d9617",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -560,
        -240
      ],
      "parameters": {
        "event": "rowAdded",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        }
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}