{
  "name": "\ud83d\ude97 ECU Agent \u2014 Chat \u2192 Venta",
  "nodes": [
    {
      "parameters": {
        "path": "ecu-agent",
        "responseMode": "lastNode"
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        240,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "stage"
            },
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "potencia"
            },
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "mejora"
            }
          ]
        },
        "combinator": "or"
      },
      "name": "Detect Stage 1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        460,
        200
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "dpf"
            },
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "filtro"
            },
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "part\u00edcula"
            }
          ]
        },
        "combinator": "or"
      },
      "name": "Detect DPF",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        460,
        400
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "egr"
            },
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "recirculaci\u00f3n"
            },
            {
              "value1": "={{ $json.body.message.toLowerCase() }}",
              "operation": "contains",
              "value2": "humo"
            }
          ]
        },
        "combinator": "or"
      },
      "name": "Detect EGR",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        460,
        600
      ]
    },
    {
      "parameters": {
        "content": "={{ `\u00a1Excelente elecci\u00f3n! \ud83c\udfce\ufe0f\\n\\n*Stage 1* \u2014 Reprogramaci\u00f3n segura sin hardware adicional.\\n\\n\u2705 +20-30% HP y torque\\n\u2705 Sin riesgos mec\u00e1nicos\\n\u2705 Reversible\\n\\n\ud83d\udcb0 Precio: $150\\n\ud83d\udd50 Entrega: 24h\\n\\n\u00bfQuieres proceder?` }}",
        "jsonOutput": true
      },
      "name": "Response Stage 1",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        700,
        140
      ]
    },
    {
      "parameters": {
        "content": "={{ `\ud83d\udd27 Entiendo tu problema con el DPF.\\n\\n*DPF OFF* \u2014 Soluci\u00f3n definitiva:\\n\\n\u2705 Elimina regeneraciones forzadas\\n\u2705 Recupera potencia\\n\u2705 Mejora consumo\\n\\n\ud83d\udcb0 Precio: $120\\n\ud83d\udd50 Entrega: 24h\\n\\n\u00bfQuieres solucionarlo?` }}",
        "jsonOutput": true
      },
      "name": "Response DPF",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        700,
        340
      ]
    },
    {
      "parameters": {
        "content": "={{ `\u2699\ufe0f Problemas de EGR son muy comunes.\\n\\n*EGR OFF* \u2014 Eliminaci\u00f3n definitiva:\\n\\n\u2705 Elimina humo negro\\n\u2705 Mejora ralent\u00ed\\n\u2705 Mayor vida del motor\\n\\n\ud83d\udcb0 Precio: $100\\n\ud83d\udd50 Entrega: 24h\\n\\n\u00bfTe interesa?` }}",
        "jsonOutput": true
      },
      "name": "Response EGR",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        700,
        540
      ]
    },
    {
      "parameters": {
        "content": "={{ `Hola \ud83d\udc4b No estoy seguro de tu consulta espec\u00edfica.\\n\\nNuestros servicios:\\n\ud83c\udfce\ufe0f Stage 1 \u2014 +20-30% potencia ($150)\\n\ud83d\udd27 DPF OFF \u2014 Soluci\u00f3n filtro ($120)\\n\u2699\ufe0f EGR OFF \u2014 Eliminaci\u00f3n v\u00e1lvula ($100)\\n\\n\u00bfCu\u00e1l te interesa?` }}",
        "jsonOutput": true
      },
      "name": "Response Default",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        700,
        740
      ]
    },
    {
      "parameters": {
        "response": {
          "response": "={{ { response: $json.content, actions: [] } }}"
        }
      },
      "name": "Format Response",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        920,
        400
      ]
    },
    {
      "parameters": {
        "response": {
          "response": "={{ { response: $json.content, actions: [{text: '\ud83d\udcb3 Comprar', action: 'buy'}, {text: '\ud83d\udcc1 Subir archivo', action: 'upload'}] } }}"
        }
      },
      "name": "Format Response with Actions",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        920,
        340
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Detect Stage 1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect Stage 1": {
      "main": [
        [
          {
            "node": "Response Stage 1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Detect DPF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect DPF": {
      "main": [
        [
          {
            "node": "Response DPF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Detect EGR",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect EGR": {
      "main": [
        [
          {
            "node": "Response EGR",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Response Default",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Response Stage 1": {
      "main": [
        [
          {
            "node": "Format Response with Actions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Response DPF": {
      "main": [
        [
          {
            "node": "Format Response with Actions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Response EGR": {
      "main": [
        [
          {
            "node": "Format Response with Actions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Response Default": {
      "main": [
        [
          {
            "node": "Format Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true
  },
  "tags": [
    "ecu-tuning",
    "chat-agent",
    "sales"
  ]
}