AutomationFlowsAI & RAG › Workflow Principal

Workflow Principal

Workflow_Principal. Uses googleGemini, postgres, rabbitmq, stopAndError. Webhook trigger; 16 nodes.

Webhook trigger★★★★☆ complexityAI-powered16 nodesGoogle GeminiPostgresRabbitmqStop And Error
AI & RAG Trigger: Webhook Nodes: 16 Complexity: ★★★★☆ AI nodes: yes 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": "Workflow_Principal",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "08f17bf3-21fe-4308-a6b1-754f98077083",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -1344,
        160
      ],
      "id": "b61c28bc-5acb-4ce7-86ad-9c0c9352d74f",
      "name": "Webhook"
    },
    {
      "parameters": {
        "modelId": {
          "__rl": true,
          "value": "models/gemini-2.5-flash",
          "mode": "list",
          "cachedResultName": "models/gemini-2.5-flash"
        },
        "messages": {
          "values": [
            {
              "content": "=Act\u00faa como un sistema experto de triaje y clasificaci\u00f3n de correos electr\u00f3nicos para un departamento de atenci\u00f3n al cliente. Tu tarea es analizar el correo entrante y estructurar los datos para su procesamiento autom\u00e1tico.\n\nENTRADAS:\n--------------------------------------------------\nEmail del Emisor: {{ $json.body.email.email_from }}\nCuerpo del Correo: {{ $json.body.body }}\n--------------------------------------------------\n\nINSTRUCCIONES DE AN\u00c1LISIS:\n1. Lee detenidamente el cuerpo del correo.\n2. Determina la urgencia bas\u00e1ndote en el tono y palabras clave (ej: \"urgente\", \"ca\u00eddo\", \"error cr\u00edtico\" = Alta).\n3. Clasifica el correo en una de las categor\u00edas permitidas bas\u00e1ndote en la intenci\u00f3n principal.\n4. Genera un resumen conciso de una sola frase.\n\nREGLAS DE FORMATO (ESTRICTO):\n- Tu respuesta debe ser \u00daNICAMENTE un objeto JSON v\u00e1lido.\n- No incluyas bloques de c\u00f3digo markdown (```json ... ```).\n- No incluyas texto introductorio ni conclusiones.\n- Aseg\u00farate de escapar correctamente cualquier car\u00e1cter especial dentro del JSON.\n\nVALORES PERMITIDOS:\n- urgency: \"Alta\", \"Media\", \"Baja\"\n- category: \"Tecnica\", \"Facturacion\", \"Ventas\", \"General\"\n\nESTRUCTURA DEL JSON DE SALIDA:\n{\n  \"summary\": \"Resumen de una frase del problema detectado.\",\n  \"urgency\": \"Nivel de urgencia\",\n  \"category\": \"Categor\u00eda seleccionada\"\n}"
            }
          ]
        },
        "jsonOutput": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "typeVersion": 1,
      "position": [
        -1104,
        160
      ],
      "id": "e5f68c43-ac1c-4f3a-a5df-35d1ddaa4d1f",
      "name": "Message a model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "return JSON.parse($input.first().json.content.parts[0].text);"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -752,
        160
      ],
      "id": "bbb7ba11-a6cf-464b-b3f1-58e198cbb425",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "75e7712e-2aef-436e-958b-17df530d4562",
              "leftValue": "={{ $('EsCliente').item.json }}",
              "rightValue": "undefined",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -336,
        160
      ],
      "id": "ba5f3333-b012-4729-bf54-111c8053aa73",
      "name": "If"
    },
    {
      "parameters": {
        "operation": "select",
        "schema": {
          "__rl": true,
          "value": "public",
          "mode": "list",
          "cachedResultName": "public"
        },
        "table": {
          "__rl": true,
          "value": "customers",
          "mode": "list",
          "cachedResultName": "customers"
        },
        "limit": 10,
        "where": {
          "values": [
            {
              "column": "email",
              "value": "={{ $('Webhook').item.json.body.email.email_from }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        -544,
        160
      ],
      "id": "8a2c4d33-3b57-4049-9612-b26bfc5a2da4",
      "name": "EsCliente",
      "alwaysOutputData": true,
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "tickets",
          "mode": "list",
          "cachedResultName": "tickets"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "customer_email": "={{ $('Webhook').item.json.body.email.email_from }}",
            "summary": "={{ $('Code in JavaScript').item.json.summary }}",
            "category": "={{ $('Code in JavaScript').item.json.category }}",
            "urgency": "={{ $('Code in JavaScript').item.json.urgency }}",
            "status": "Nuevo"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "TIMESTAMP",
              "displayName": "TIMESTAMP",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "customer_email",
              "displayName": "customer_email",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "summary",
              "displayName": "summary",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "category",
              "displayName": "category",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "urgency",
              "displayName": "urgency",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "status",
              "displayName": "status",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "n8n_run_url",
              "displayName": "n8n_run_url",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        0,
        176
      ],
      "id": "980906f3-6a20-4af4-9ea4-b29fd9493f44",
      "name": "A\u00f1adirTicket",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "mode": "expression",
        "output": "={{ $('EsCliente').item.json.vip_status === true && $json.urgency === 'Alta' ? 0 :\n  $json.category === 'Tecnica' && $json.urgency === 'Alta'? 1 :\n  $json.category==='Facturacion' ? 2 : 3}}"
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.3,
      "position": [
        208,
        144
      ],
      "id": "0e390ac7-4319-4359-ad6b-493836c9349b",
      "name": "Switch"
    },
    {
      "parameters": {
        "queue": "queue_technical_urgent",
        "options": {}
      },
      "type": "n8n-nodes-base.rabbitmq",
      "typeVersion": 1.1,
      "position": [
        608,
        160
      ],
      "id": "27f5b6b9-4646-4c5a-b904-7d70d1545cd7",
      "name": "Tecnica_urgente",
      "credentials": {
        "rabbitmq": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.rabbitmq",
      "typeVersion": 1.1,
      "position": [
        608,
        288
      ],
      "id": "bdb28df8-9acc-4032-84c2-c69ceb69ad8e",
      "name": "Facturacion",
      "credentials": {
        "rabbitmq": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.rabbitmq",
      "typeVersion": 1.1,
      "position": [
        608,
        32
      ],
      "id": "64c4a5fd-feab-4024-a4fd-d1e28b91968e",
      "name": "Vip_urgente",
      "credentials": {
        "rabbitmq": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.rabbitmq",
      "typeVersion": 1.1,
      "position": [
        608,
        416
      ],
      "id": "58aa7263-4d7c-4bbf-a3c7-9fb18416717f",
      "name": "Otros",
      "credentials": {
        "rabbitmq": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "254e7565-69c5-47e2-84a9-29205bda8047",
              "name": "message",
              "value": "Se ha recibido el ticket correctamente",
              "type": "string"
            },
            {
              "id": "2951c7dc-9809-4c8a-8696-6e81f4ab8ba3",
              "name": "email",
              "value": "={{ $('Webhook').item.json.body.email.email_from }}",
              "type": "string"
            },
            {
              "id": "7960f589-3456-498d-8693-138243f5a09b",
              "name": "body.summary",
              "value": "={{ $('Code in JavaScript').item.json.summary }}",
              "type": "string"
            },
            {
              "id": "ec38bf69-1bfa-411b-bd00-362f8babad88",
              "name": "body.urgency",
              "value": "={{ $('Code in JavaScript').item.json.urgency }}",
              "type": "string"
            },
            {
              "id": "e5735580-c5eb-48c0-8e44-ff71edaf7acd",
              "name": "body.category",
              "value": "={{ $('Code in JavaScript').item.json.category }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1008,
        176
      ],
      "id": "623876e0-87a1-437d-b283-79832dd50f7d",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "workflowId": {
          "__rl": true,
          "value": "pCPKJvb6n0iKEeDD",
          "mode": "list",
          "cachedResultUrl": "/workflow/pCPKJvb6n0iKEeDD",
          "cachedResultName": "Sub-NotificacionCliente"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {}
        },
        "options": {}
      },
      "type": "n8n-nodes-base.executeWorkflow",
      "typeVersion": 1.3,
      "position": [
        1248,
        176
      ],
      "id": "c7e109e5-dd01-4c03-98f5-bda08cf726ad",
      "name": "Call 'Sub-NotificacionCliente'"
    },
    {
      "parameters": {
        "errorMessage": "=El usuario de correo {{ $('Webhook').item.json.body.email.email_from | \"Anonimo\"}}, necesita registrarte para poder acceder a nuestro servicios"
      },
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        64,
        16
      ],
      "id": "b1ac7ae1-3074-469c-bd76-2f783e3a6408",
      "name": "Stop and Error"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\n  \"message\": \"El usuario necesita registrarse antes de poder acceder a nuestros servicios\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        -144,
        16
      ],
      "id": "9bfa062c-4cf8-4eb0-bf60-7cb14c1c4a9e",
      "name": "Respond to Webhook"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\n  \"message\": \"La solicitud ha sido procesada con \u00e9xito\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        1456,
        176
      ],
      "id": "7582d28e-05f7-4e75-9dac-a66cf79a0193",
      "name": "Respond to Webhook1"
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Message a model",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Message a model": {
      "main": [
        [
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "EsCliente",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "A\u00f1adirTicket",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "EsCliente": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "A\u00f1adirTicket": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Vip_urgente",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Tecnica_urgente",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Facturacion",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Otros",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tecnica_urgente": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Vip_urgente": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Facturacion": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Otros": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Call 'Sub-NotificacionCliente'",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook": {
      "main": [
        [
          {
            "node": "Stop and Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call 'Sub-NotificacionCliente'": {
      "main": [
        [
          {
            "node": "Respond to Webhook1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "callerPolicy": "workflowsFromSameOwner",
    "availableInMCP": false,
    "errorWorkflow": "AsjhtAjlKsLP20Us",
    "executionTimeout": -1
  },
  "versionId": "9058d56f-e43c-4dfa-83fb-6e080e9d7590",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "M3FJjl0OyK9aJ7N9",
  "tags": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

Workflow_Principal. Uses googleGemini, postgres, rabbitmq, stopAndError. Webhook trigger; 16 nodes.

Source: https://github.com/jaimeparra2402/INTEGRACION-DE-TECOLOGIAS/blob/584474df70b0283dac21df41f30b8b5862bde459/n8n/Workflow_Principal.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

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

AI & RAG

Pyragogy AI Village - Orchestrazione Master (Architettura Profonda V2). Uses start, postgres, openAi, emailSend. Webhook trigger; 37 nodes.

Start, Postgres, OpenAI +4
AI & RAG

Pyragogy AI Village - Orchestrazione Master (Architettura Profonda V2). Uses start, postgres, openAi, emailSend. Webhook trigger; 36 nodes.

Start, Postgres, OpenAI +4
AI & RAG

FoodSnap - Unified (Food & Coach). Uses postgres, n8n-nodes-evolution-api, googleGemini. Webhook trigger; 22 nodes.

Postgres, N8N Nodes Evolution Api, Google Gemini
AI & RAG

This workflow is a complete outbound automation system that discovers local businesses, extracts contact emails, generates personalized cold emails using AI, and runs a multi-step follow-up sequence —

Stop And Error, Google Sheets, HTTP Request +2
AI & RAG

Eu Clara – Funil Kiwify Completo. Uses postgres, openAi, httpRequest, gmail. Webhook trigger; 70 nodes.

Postgres, OpenAI, HTTP Request +1