{
  "name": "Enroutia · Classify inbound leads",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "enroutia-lead",
        "authentication": "headerAuth",
        "responseMode": "responseNode",
        "options": {}
      },
      "name": "New lead",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "webhookId": "enroutia-lead",
      "credentials": {
        "httpHeaderAuth": {
          "name": "Workflow caller header"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Classify this inbound lead.\n\nName: {{ $json.body.name }}\nCompany: {{ $json.body.company }}\nEmail: {{ $json.body.email }}\nMessage:\n{{ $json.body.message }}",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "You qualify B2B inbound leads. Decide the category (sales, support, partnership, job, spam), a score from 0 to 100 for how likely this is a paying customer, a one-sentence reason and the next step for the team. Answer only in the requested format."
        }
      },
      "name": "Classify lead",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        240,
        0
      ]
    },
    {
      "parameters": {
        "model": "=enroutia/leads",
        "options": {
          "temperature": 0,
          "maxTokens": 400,
          "clientTag": "={{ $json.body.client || '' }}"
        }
      },
      "name": "Enroutia Chat Model",
      "type": "n8n-nodes-enroutia.enroutiaChatModel",
      "typeVersion": 1,
      "position": [
        160,
        220
      ],
      "credentials": {
        "enroutiaApi": {
          "name": "Enroutia account"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"category\": \"sales\",\n  \"score\": 82,\n  \"reason\": \"Asks for pricing for 40 seats and names a deadline.\",\n  \"next_step\": \"Book a demo this week\"\n}"
      },
      "name": "Lead JSON",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        360,
        220
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($json.output) }}",
        "options": {
          "responseCode": 200
        }
      },
      "name": "Answer",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        560,
        0
      ]
    }
  ],
  "connections": {
    "New lead": {
      "main": [
        [
          {
            "node": "Classify lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify lead": {
      "main": [
        [
          {
            "node": "Answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enroutia Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Classify lead",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Lead JSON": {
      "ai_outputParser": [
        [
          {
            "node": "Classify lead",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
