{
  "name": "LinkedFlow · 2 · Respuesta clasificada → CRM y agenda",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "linkedflow-respuesta",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "b2000000-0000-4000-8000-000000000001",
      "name": "Webhook de LinkedFlow",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -520,
        0
      ],
      "webhookId": "b2000000-0000-4000-8000-0000000000aa",
      "notes": "Pega la URL de PRODUCCIÓN (/webhook/…, no /webhook-test/…) en el nodo «Webhook saliente» de LinkedFlow, con la query: ?s=TU-SECRETO&cat={{previous.classification}} — y activa este workflow, o la URL de producción devuelve 404."
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "c-int",
                    "leftValue": "={{ $json.query.cat }}",
                    "rightValue": "INTERESTED",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "INTERESTED"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "c-q",
                    "leftValue": "={{ $json.query.cat }}",
                    "rightValue": "QUESTION",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "QUESTION"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "c-not",
                    "leftValue": "={{ $json.query.cat }}",
                    "rightValue": "NOT_NOW",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "NOT_NOW"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "loose",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "c-dnc",
                    "leftValue": "={{ $json.query.cat }}",
                    "rightValue": "DO_NOT_CONTACT",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "DO_NOT_CONTACT"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "otros"
        }
      },
      "id": "b2000000-0000-4000-8000-000000000003",
      "name": "Switch por categoría",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -40,
        -20
      ],
      "notes": "LinkedFlow manda la categoría en la URL (?cat={{previous.classification}}), no en el cuerpo: su nodo de webhook solo permite configurar método y URL."
    },
    {
      "parameters": {},
      "id": "b2000000-0000-4000-8000-000000000004",
      "name": "Crear negocio + avisar (tu CRM/Slack)",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        240,
        -200
      ],
      "notes": "Sustituye por tus nodos: HubSpot/Pipedrive + Slack + enlace de agenda."
    },
    {
      "parameters": {},
      "id": "b2000000-0000-4000-8000-000000000005",
      "name": "Borrador con IA → Slack para aprobar",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        240,
        -60
      ]
    },
    {
      "parameters": {},
      "id": "b2000000-0000-4000-8000-000000000006",
      "name": "Guardar fecha de recontacto (90 días)",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        240,
        80
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://app.linkedflow.pro/api/v1/suppression",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({\n  linkedin_url: $json.body.prospect.linkedin_url,\n  reason: 'DNC',\n  note: 'Pidió no ser contactado (clasificado por IA en LinkedFlow)'\n}) }}",
        "options": {}
      },
      "id": "b2000000-0000-4000-8000-000000000007",
      "name": "POST /suppression",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        240,
        220
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "REEMPLAZAR",
          "name": "LinkedFlow API (Authorization: Bearer …)"
        }
      }
    }
  ],
  "connections": {
    "Webhook de LinkedFlow": {
      "main": [
        [
          {
            "node": "Switch por categoría",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch por categoría": {
      "main": [
        [
          {
            "node": "Crear negocio + avisar (tu CRM/Slack)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Borrador con IA → Slack para aprobar",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Guardar fecha de recontacto (90 días)",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "POST /suppression",
            "type": "main",
            "index": 0
          }
        ],
        []
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "descripcion": "Recibe el webhook saliente de un workflow de LinkedFlow que clasifica respuestas con IA y reparte por categoría. En LinkedFlow: disparador «Mensaje recibido» → nodo «Clasificar respuesta» → un nodo «Webhook saliente» con la URL de producción de n8n y ?s=TU-SECRETO&cat={{previous.classification}}. OJO: sin nodo que compruebe el secreto, cualquiera que descubra esta URL puede inyectar respuestas falsas; si quieres el filtro, añade un IF con {{ $json.query.s }} igual a tu secreto justo después del Webhook."
  }
}
