{
  "name": "AI Lead Generation & Outreach Agent",
  "nodes": [
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2b46667b-4e46-48df-a85c-5626f9af67bf",
              "name": "company",
              "value": "Shopify",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        208,
        0
      ],
      "id": "22a5a932-a826-4d04-9ddb-204f9d7b5f1f",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.groq.com/openai/v1/chat/completions",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "YOUR_GROQ_API_KEY"
            }
          ]
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "Bearer YOUR_GROQ_API_KEY"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"model\": \"llama-3.3-70b-versatile\",\n  \"messages\": [\n    {\n      \"role\": \"system\",\n      \"content\": \"You are a business development and AI automation consultant.\"\n    },\n    {\n      \"role\": \"user\",\n      \"content\": \"Research {{$json.company}}.\\n\\nProvide:\\n\\n1. Company Summary\\n\\n2. Potential AI Automation Opportunities\\n\\n3. Estimated Lead Quality Score (1-100)\\n\\n4. Personalized Outreach Email\\n\\nFormat the response clearly using headings.\"\n    }\n  ],\n  \"temperature\": 0.7\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.4,
      "position": [
        416,
        0
      ],
      "id": "ac31a6b5-5f57-49c5-ba72-9123182c2d47",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1YlMW7nyrReZdJNK5W_q5W5pgYpXgv_IkVLNkEHlCYqQ",
          "mode": "list",
          "cachedResultName": "Untitled spreadsheet",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YlMW7nyrReZdJNK5W_q5W5pgYpXgv_IkVLNkEHlCYqQ/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Sheet1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1YlMW7nyrReZdJNK5W_q5W5pgYpXgv_IkVLNkEHlCYqQ/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Company": "={{$node[\"Edit Fields\"].json[\"company\"]}}",
            "Research": "={{$node[\"HTTP Request\"].json[\"choices\"][0][\"message\"][\"content\"]}}",
            "Date": "={{new Date().toISOString()}}",
            "Lead_Score": "={{$node[\"Edit Fields1\"].json[\"lead_score\"]}}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Company",
              "displayName": "Company",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Research",
              "displayName": "Research",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Lead_Score",
              "displayName": "Lead_Score",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Date",
              "displayName": "Date",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        832,
        0
      ],
      "id": "20763f29-9c66-4395-a57f-5444b336161f",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "lead-research",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "id": "e3239d21-7888-443a-88a8-e28f1ae83620",
      "name": "Webhook"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "251b77ec-fda6-4b44-82a5-09c3a84ad3f6",
              "name": "lead_score",
              "value": "={{ $json.choices[0].message.content.match(/(\\d+)\\s*out of\\s*100/i)?.[1] || 80 }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        624,
        0
      ],
      "id": "8de9e28b-99e3-4d39-bbaf-bc5f96674577",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "resource": "draft",
        "subject": "=AI Automation Opportunity - {{$node[\"Edit Fields\"].json.company}}",
        "message": "={{$node[\"HTTP Request\"].json[\"choices\"][0][\"message\"][\"content\"]}}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        1040,
        0
      ],
      "id": "cffe57b0-a796-420e-b291-8bca41602fad",
      "name": "Create a draft",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Edit Fields": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Create a draft",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "a499515b-4ea6-4498-8f14-5e70a096ab88",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "Od7CYGpvXItuVgMw",
  "tags": []
}