AutomationFlowsWeb Scraping › Chat Ia Refactored

Chat Ia Refactored

Chat Ia Refactored. Uses httpRequest. Webhook trigger; 11 nodes.

Webhook trigger★★★★☆ complexity11 nodesHTTP Request
Web Scraping Trigger: Webhook Nodes: 11 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "ventas-chat",
        "responseMode": "responseNode",
        "options": {}
      },
      "id": "webhook-ventas-chat",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        -1020,
        0
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "prompt",
              "value": "={{ $json.body.prompt || $json.body.message }}"
            }
          ]
        }
      },
      "id": "normalize-input",
      "name": "Normalize Input",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        -800,
        0
      ]
    },
    {
      "parameters": {
        "url": "https://api-vapers.onrender.com/api/ventas",
        "responseFormat": "json",
        "options": {
          "retryOnFail": true,
          "maxRetries": 3
        }
      },
      "id": "fetch-sales",
      "name": "Fetch Sales",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        -600,
        120
      ]
    },
    {
      "parameters": {
        "url": "https://api-vapers.onrender.com/api/vapers",
        "responseFormat": "json",
        "options": {
          "retryOnFail": true,
          "maxRetries": 3
        }
      },
      "id": "fetch-vapers",
      "name": "Fetch Inventory",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        -600,
        -120
      ]
    },
    {
      "parameters": {
        "url": "https://api-vapers.onrender.com/api/finanzas",
        "responseFormat": "json",
        "options": {
          "retryOnFail": true,
          "maxRetries": 3
        }
      },
      "id": "fetch-finanzas",
      "name": "Fetch Finance",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        -600,
        -240
      ]
    },
    {
      "parameters": {
        "functionCode": "const prompt = $json.prompt;\nconst ventas = $items('Fetch Sales')[0].json || [];\nconst vapers = $items('Fetch Inventory')[0].json || [];\nconst finanzas = $items('Fetch Finance')[0].json || [];\n\nreturn [{ json: { prompt, ventas, vapers, finanzas } }];"
      },
      "id": "aggregate-context",
      "name": "Aggregate Context",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        -360,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "const text = ($json.prompt || '').toLowerCase();\nlet intent = 'ventas';\nif (/(inventario|stock|producto|vaper)/.test(text)) intent = 'vapers';\nif (/(finanza|gasto|beneficio)/.test(text)) intent = 'finanzas';\nreturn [{ json: { ...$json, intent } }];"
      },
      "id": "detect-intent",
      "name": "Detect Intent",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        -120,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "const {prompt, intent, ventas, vapers, finanzas} = $json;\nconst ctx = { ventas, vapers, finanzas };\nconst sistema = 'Eres un asistente que responde en espa\u00f1ol usando solo el contexto proporcionado';\nreturn [{ json: { model: 'llama-3.3-70b-versatile', messages: [ {role: 'system', content: sistema}, {role: 'user', content: prompt}, {role: 'user', content: `CONTEXTO ${intent.toUpperCase()}: ${JSON.stringify(ctx[intent]||{})}`} ] } }];"
      },
      "id": "build-messages",
      "name": "Build Messages",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        120,
        0
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "https://api.groq.com/openai/v1/chat/completions",
        "jsonParameters": true,
        "options": {
          "retryOnFail": true,
          "maxRetries": 2
        },
        "bodyParametersJson": "={{ { model: $json.model, messages: $json.messages, temperature: 0.2, max_tokens: 900 } }}",
        "headerParametersJson": "={{ { 'Authorization': 'Bearer env.GROQ_API_KEY', 'Content-Type': 'application/json' } }}"
      },
      "id": "groq-chat",
      "name": "Groq Chat",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        360,
        0
      ]
    },
    {
      "parameters": {
        "functionCode": "const r = $json; const content = r.choices?.[0]?.message?.content || 'Sin respuesta'; return [{ json: { answer: content } }];"
      },
      "id": "extract-answer",
      "name": "Extract Answer",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        600,
        0
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "respond",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        840,
        0
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Normalize Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Input": {
      "main": [
        [
          {
            "node": "Fetch Sales",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Inventory",
            "type": "main",
            "index": 0
          },
          {
            "node": "Fetch Finance",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Sales": {
      "main": [
        [
          {
            "node": "Aggregate Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Inventory": {
      "main": [
        [
          {
            "node": "Aggregate Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Finance": {
      "main": [
        [
          {
            "node": "Aggregate Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Context": {
      "main": [
        [
          {
            "node": "Detect Intent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Detect Intent": {
      "main": [
        [
          {
            "node": "Build Messages",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Messages": {
      "main": [
        [
          {
            "node": "Groq Chat",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat": {
      "main": [
        [
          {
            "node": "Extract Answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Answer": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Chat Ia Refactored. Uses httpRequest. Webhook trigger; 11 nodes.

Source: https://github.com/Rruubeenn23/Vapers/blob/53d90f273b2d0172d72c0351e38e6199d0a65d27/n8n/chat_ia_refactored.json — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di

n8n, Execute Workflow Trigger, HTTP Request +1
Web Scraping

This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .

HTTP Request, Ssh
Web Scraping

This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c

HTTP Request
Web Scraping

Sign PDF documents with legally-compliant digital signatures using X.509 certificates. Supports multiple PAdES signature levels (B, T, LT, LTA) with optional visible stamps.

Execute Command, HTTP Request, Read Write File +1
Web Scraping

📡 This workflow serves as the central Alpha Vantage API fetcher for Tesla trading indicators, delivering cleaned 20-point JSON outputs for three timeframes: , , and . It is required by the following a

HTTP Request