{
  "nodes": [
    {
      "id": "2f8a925b-780c-4d01-a347-e7621d177b1f",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1632,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "phantombusterAgentId",
              "type": "string",
              "value": "$env.PHANTOMBUSTER_AGENT_ID"
            },
            {
              "id": "id-2",
              "name": "personaMatchThreshold",
              "type": "number",
              "value": 0.7
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "890390aa-2a2f-45af-bf25-83eb3b2478a0",
      "name": "Extract Contact Data",
      "type": "n8n-nodes-base.set",
      "position": [
        -864,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "contactName",
              "type": "string",
              "value": "={{ $json.Contact_Name.name }}"
            },
            {
              "id": "id-2",
              "name": "contactEmail",
              "type": "string",
              "value": "={{ $json.Contact_Name.email || $('Workflow Configuration').first().json.body.contact_email }}"
            },
            {
              "id": "id-3",
              "name": "linkedInUrl",
              "type": "string",
              "value": "={{ $json.Next_Step }}"
            },
            {
              "id": "id-4",
              "name": "dealId",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "id": "id-5",
              "name": "dealName",
              "type": "string",
              "value": "={{ $json.Deal_Name }}"
            },
            {
              "id": "id-6",
              "name": "dealAmount",
              "type": "number",
              "value": "={{ $json.Amount }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "f6424b8f-d47f-40f5-bc95-8cbbd7b83bb5",
      "name": "Scrape LinkedIn Profile",
      "type": "n8n-nodes-base.phantombuster",
      "position": [
        -240,
        80
      ],
      "parameters": {
        "agentId": "$env.PHANTOMBUSTER_AGENT_ID",
        "additionalFields": {}
      },
      "credentials": {
        "phantombusterApi": {
          "id": "aTwehZWlds0yKvgt",
          "name": "Phantombuster account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "c97d6918-ae23-488f-b379-65643e62d7a1",
      "name": "Persona Database",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "personas",
              "type": "array",
              "value": "[{\"id\": \"executive_decision_maker\", \"name\": \"Executive Decision Maker\", \"characteristics\": [\"C-level or VP title\", \"10+ years experience\", \"Strategic focus\", \"Budget authority\"], \"communication_style\": \"Direct and results-oriented. Focus on ROI and strategic impact.\", \"talking_points\": [\"Bottom-line impact\", \"Competitive advantage\", \"Long-term strategic value\", \"Risk mitigation\"]}, {\"id\": \"technical_evaluator\", \"name\": \"Technical Evaluator\", \"characteristics\": [\"Engineering or technical role\", \"Hands-on experience\", \"Detail-oriented\", \"Integration concerns\"], \"communication_style\": \"Technical and detailed. Provide specifications and implementation details.\", \"talking_points\": [\"Technical architecture\", \"Integration capabilities\", \"Security features\", \"Scalability and performance\"]}, {\"id\": \"business_analyst\", \"name\": \"Business Analyst\", \"characteristics\": [\"Operations or business role\", \"Process-focused\", \"Data-driven\", \"Efficiency-minded\"], \"communication_style\": \"Process-oriented and analytical. Show workflows and efficiency gains.\", \"talking_points\": [\"Process optimization\", \"Efficiency metrics\", \"Workflow automation\", \"Time savings\"]}]"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "52b6d060-ee88-41a7-a198-b36d67fe7003",
      "name": "Persona Matcher & Outreach Generator",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        624,
        80
      ],
      "parameters": {
        "text": "=LinkedIn Profile Data: {{ JSON.stringify($json) }}\n\nContact Information:\n- Name: {{ $('Extract Contact Data').first().json.contactName }}\n- Email: {{ $('Extract Contact Data').first().json.contactEmail }}\n- Deal: {{ $('Extract Contact Data').first().json.dealName }} (${{ $('Extract Contact Data').first().json.dealAmount }})\n\nAvailable Personas: {{ JSON.stringify($('Persona Database').first().json.personas) }}",
        "options": {
          "systemMessage": "You are an expert sales intelligence analyst specializing in buyer persona matching and personalized outreach strategy.\n\nYour task is to:\n1. Analyze the LinkedIn profile data provided (job title, experience, skills, company, industry)\n2. Match the contact to the most appropriate buyer persona from the available personas\n3. Calculate a confidence score (0-1) for the persona match\n4. Suggest a personalized communication style based on the persona\n5. Recommend 3-5 specific talking points tailored to this contact\n6. Generate a personalized outreach message (2-3 paragraphs)\n\nBe specific and reference actual details from the LinkedIn profile in your recommendations. Focus on what will resonate with this particular individual based on their role, experience and background."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "1bcf9b9b-4cdb-4979-9365-b50282ce4140",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        800,
        272
      ],
      "parameters": {
        "jsonSchemaExample": "{\"matched_persona_id\": \"executive_decision_maker\",\"matched_persona_name\": \"Executive Decision Maker\",\"confidence_score\": 0.85,\"reasoning\": \"Contact has VP title with 12 years experience and strategic focus\",\"communication_style\": \"Direct, results-focused, emphasize ROI and strategic impact\",\"recommended_talking_points\": [\"Revenue growth potential\", \"Competitive market positioning\", \"Strategic partnership value\"],\"personalized_outreach\": \"Hi [Name], I noticed your impressive track record in driving strategic initiatives at [Company]...\"}"
      },
      "typeVersion": 1
    },
    {
      "id": "2aae41f8-3e37-4014-a3bd-99ad77ec7152",
      "name": "Update Zoho CRM Contact",
      "type": "n8n-nodes-base.zohoCrm",
      "position": [
        1072,
        80
      ],
      "parameters": {
        "resource": "contact",
        "contactId": "={{ $('Get Deal Record').first().json.Contact_Name.id }}",
        "operation": "update",
        "updateFields": {
          "Description": "={{ 'Persona: ' + $json.output.matched_persona_name + ' | Confidence: ' + $json.output.confidence_score + ' | Style: ' + $json.output.communication_style + ' | Talking Points: ' + $json.output.recommended_talking_points.join(', ') + ' | Outreach: ' + $json.output.personalized_outreach }}"
        }
      },
      "credentials": {
        "zohoOAuth2Api": {
          "id": "LY66IfPevKWJUYNY",
          "name": "Zoho account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "20e65d4b-1098-41d7-b149-cc33f291211f",
      "name": "Zoho CRM Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1872,
        80
      ],
      "webhookId": "43f8ce89-11ab-4b6a-903e-92b9e741b1cd",
      "parameters": {
        "path": "zoho-crm-contact-deal",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "6e0ac3af-52dd-4fd0-a5a6-05e718588f4a",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        608,
        272
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "yHhrOVnDCqtcJpPu",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "fee7ace1-4e04-4f3f-a7b1-1c15d4e8b066",
      "name": "Get Deal Record",
      "type": "n8n-nodes-base.zohoCrm",
      "position": [
        -1056,
        80
      ],
      "parameters": {
        "dealId": "={{ $json.body.deal_id }}",
        "resource": "deal",
        "operation": "get"
      },
      "credentials": {
        "zohoOAuth2Api": {
          "id": "LY66IfPevKWJUYNY",
          "name": "Zoho account"
        }
      },
      "typeVersion": 1,
      "alwaysOutputData": true
    }
  ],
  "connections": {
    "Get Deal Record": {
      "main": [
        [
          {
            "node": "Extract Contact Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Persona Database": {
      "main": [
        [
          {
            "node": "Persona Matcher & Outreach Generator",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Zoho CRM Webhook": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Persona Matcher & Outreach Generator",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Extract Contact Data": {
      "main": [
        [
          {
            "node": "Scrape LinkedIn Profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Get Deal Record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scrape LinkedIn Profile": {
      "main": [
        [
          {
            "node": "Persona Database",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Persona Matcher & Outreach Generator",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Persona Matcher & Outreach Generator": {
      "main": [
        [
          {
            "node": "Update Zoho CRM Contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}