AutomationFlowsWeb Scraping › Chatbot Con Memoria

Chatbot Con Memoria

Chatbot con Memoria. Uses httpRequest. Webhook trigger; 6 nodes.

Webhook trigger★★★★☆ complexity6 nodesHTTP Request
Web Scraping Trigger: Webhook Nodes: 6 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
{
  "name": "Chatbot con Memoria",
  "nodes": [
    {
      "parameters": {
        "path": "/chat",
        "options": {}
      },
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "get",
        "url": "http://qdrant:6333/collections/chat_history/points/search",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "api-key",
              "value": "={{$env.N8N_QDRANT_API_KEY}}"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "vector": "={{$node.Webhook.json.question}}",
          "limit": 10,
          "with_payload": true
        },
        "options": {}
      },
      "name": "Buscar Historial",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        450,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "const historial = $input.all()[0].json.result || [];\nlet contexto = 'Historial de la conversaci\u00f3n:\\n';\nhistorial.forEach(m => { contexto += `${m.payload?.role || 'usuario'}: ${m.payload?.content || ''}\\n`; });\ncontexto += `\\nPregunta actual: ${$input.all()[1].json.question}`;\nreturn { contexto };\n"
      },
      "name": "Preparar Contexto",
      "type": "n8n-nodes-base.function",
      "typeVersion": 1,
      "position": [
        650,
        300
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://ollama:11434/api/generate",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "model",
              "value": "gemma4:latest"
            },
            {
              "name": "prompt",
              "value": "={{ $node['Preparar Contexto'].json.contexto }}"
            },
            {
              "name": "stream",
              "value": false
            }
          ]
        },
        "options": {}
      },
      "name": "Generar Respuesta",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        850,
        300
      ]
    },
    {
      "parameters": {
        "method": "PUT",
        "url": "http://qdrant:6333/collections/chat_history/points",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "api-key",
              "value": "={{$env.N8N_QDRANT_API_KEY}}"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "points": [
            {
              "id": "={{ $now + '-user' }}",
              "payload": {
                "sesion_id": "={{$node.Webhook.json.session_id}}",
                "rol": "usuario",
                "contenido": "={{$node.Webhook.json.question}}"
              }
            },
            {
              "id": "={{ $now + '-assistant' }}",
              "payload": {
                "sesion_id": "={{$node.Webhook.json.session_id}}",
                "rol": "asistente",
                "contenido": "={{$node['Generar Respuesta'].json.response}}"
              }
            }
          ]
        },
        "options": {}
      },
      "name": "Guardar Historial",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        1050,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": {
          "respuesta": "={{$node['Generar Respuesta'].json.response}}",
          "sesion_id": "={{$node.Webhook.json.session_id}}"
        }
      },
      "name": "Responder",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1250,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Buscar Historial",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buscar Historial": {
      "main": [
        [
          {
            "node": "Preparar Contexto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Preparar Contexto": {
      "main": [
        [
          {
            "node": "Generar Respuesta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generar Respuesta": {
      "main": [
        [
          {
            "node": "Guardar Historial",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Guardar Historial": {
      "main": [
        [
          {
            "node": "Responder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "saveDataErrorExecution": "all",
    "saveDataSuccessExecution": "all",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner"
  },
  "tags": [
    "ia",
    "chatbot",
    "memoria"
  ],
  "triggerCount": 1
}
Pro

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

About this workflow

Chatbot con Memoria. Uses httpRequest. Webhook trigger; 6 nodes.

Source: https://github.com/EdissonGirald0/laboratorioAI/blob/be2698cafb4ca44e80e2a07682ac36c70b2511f6/n8n/workflows/chatbot.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

eek-Go v2 (Batch-Then-Review). Uses httpRequest. Webhook trigger; 75 nodes.

HTTP Request
Web Scraping

This workflow receives webhook requests from a content calendar and uses the X API v2 to publish text posts, threads, image/video posts, and polls, as well as delete existing posts and run a credentia

HTTP Request
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