Flujo de trabajo con errores

Intermedio

Este es unautomatización que contiene 11 nodos.Utiliza principalmente nodos como Set, Code, Wait, Gmail, WhatsApp. Alerta de error de flujo de trabajo de doble canal, informado a través de WhatsApp y Gmail

Requisitos previos
  • Cuenta de Google y credenciales de API de Gmail

Categoría

-
Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "id": "kCB3MCZsbPmxhXPU",
  "meta": {
    "instanceId": "eb6cbfb6c4bd3b313715ed380d7ffa3fcf7d4d66f6c9d66152618745dbb0f1ab"
  },
  "name": "Error workflow",
  "tags": [],
  "nodes": [
    {
      "id": "5942fb48-d09f-4403-bc95-d9a11f4a58d9",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "position": [
        32,
        80
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "5dafc2d3-5438-43b0-92e8-236da886f273",
      "name": "Enviar mensaje",
      "type": "n8n-nodes-base.whatsApp",
      "position": [
        592,
        80
      ],
      "webhookId": "75a5527b-46c5-4b18-9540-4aa96c983364",
      "parameters": {
        "textBody": "=The workflow \"{{ $('separate items').item.json.workflow.name }}\" encountered an error in the node \"{{ $('separate items').item.json.execution.lastNodeExecuted }}\"",
        "operation": "send",
        "phoneNumberId": "625419790655867",
        "additionalFields": {},
        "recipientPhoneNumber": "={{ $('separate items').item.json.phone_number }}"
      },
      "credentials": {
        "whatsAppApi": {
          "id": "BYO9ksFrBdPpBKEk",
          "name": "WhatsApp Bfastai"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "ec1a5ea3-4a6c-4ee6-9599-4df44d19f5bc",
      "name": "set_recipient_EMAIL/NUMBER",
      "type": "n8n-nodes-base.set",
      "position": [
        208,
        80
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0be5eb85-afee-4c83-b539-ae5b8e1aa2d2",
              "name": "Email1",
              "type": "string",
              "value": "your_mail_adress"
            },
            {
              "id": "1d396772-cc0c-44a1-8892-16b0cc781a0b",
              "name": "Email2",
              "type": "string",
              "value": "your_mail_adress"
            },
            {
              "id": "5ce4f065-b094-40f7-9255-dd83205f0ff7",
              "name": "phone_number_1",
              "type": "string",
              "value": "your_phone_number"
            },
            {
              "id": "67720331-2a18-4979-b9d5-d7bc2b83bf61",
              "name": "phone_number_2",
              "type": "string",
              "value": "your_phone_number"
            },
            {
              "id": "6fc7fca5-6e41-41c2-a75b-0b8805b47d52",
              "name": "workflow.name",
              "type": "string",
              "value": "={{ $json.workflow.name }}"
            },
            {
              "id": "71a1608b-e841-4f52-a3cf-355bd96255e1",
              "name": "execution.error.message",
              "type": "string",
              "value": "={{ $json.execution.error.message }}"
            },
            {
              "id": "dc94b06f-6b72-4e5c-ba2f-99efcc07f80a",
              "name": "execution.lastNodeExecuted",
              "type": "string",
              "value": "={{ $json.execution.lastNodeExecuted }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7b95c3be-cdef-45d2-8d41-7ef2f4a221d7",
      "name": "separar elementos",
      "type": "n8n-nodes-base.code",
      "position": [
        400,
        80
      ],
      "parameters": {
        "jsCode": "const items = $input.all();\n\n// Check if input is a non-empty array\nif (!Array.isArray(items) || items.length === 0) {\n    throw new Error(\"Input must be a non-empty array.\");\n}\n\nconst result = items.reduce((acc, item) => {\n    // Extract relevant properties from each item\n    const { Email1, Email2, phone_number_1, phone_number_2, ...otherProps } = item.json;\n\n    // Create two new items separating the emails and phone numbers\n    const item1 = {\n        Email: Email1,\n        phone_number: phone_number_1,\n        ...otherProps\n    };\n\n    const item2 = {\n        Email: Email2,\n        phone_number: phone_number_2,\n        ...otherProps\n    };\n\n    // Add the newly created items to the result array\n    acc.push({ json: item1 }, { json: item2 });\n\n    return acc;\n}, []);\n\n// Return the transformed array\nreturn result;"
      },
      "typeVersion": 2
    },
    {
      "id": "303dd47b-8706-4587-b5f7-2cbac46f5b17",
      "name": "Enviar correo electrónico",
      "type": "n8n-nodes-base.gmail",
      "position": [
        928,
        80
      ],
      "webhookId": "f0f407bd-4ffd-4c9e-bb2a-de8e0dcd4754",
      "parameters": {
        "sendTo": "={{ $('separate items').item.json.Email }}\n",
        "message": "=The workflow \"{{ $('separate items').item.json.workflow.name }}\" encountered an error in the node \"{{ $('separate items').item.json.execution.lastNodeExecuted }}\"\n\nError message: {{ $('separate items').item.json.execution.error.message }}",
        "options": {},
        "subject": "=⚠️workflow error\n",
        "emailType": "text"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "GpOYfgaBFveseHPE",
          "name": "Gmail account Client Web N8N AUTO"
        }
      },
      "typeVersion": 2.1,
      "alwaysOutputData": true
    },
    {
      "id": "da6e39b0-e21d-41c1-8e7c-992400aeb2fc",
      "name": "Nota adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        0
      ],
      "parameters": {
        "width": 528,
        "height": 240,
        "content": "## Get informations"
      },
      "typeVersion": 1
    },
    {
      "id": "136a7c06-f581-4efc-933e-687ea6cff618",
      "name": "Esperar",
      "type": "n8n-nodes-base.wait",
      "position": [
        768,
        80
      ],
      "webhookId": "8836c6c1-697c-4d89-a471-fdfc53e9c816",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "4193aaeb-5a50-4d03-b601-a1303209a172",
      "name": "Nota adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        0
      ],
      "parameters": {
        "color": 5,
        "width": 592,
        "height": 240,
        "content": "## Send alert"
      },
      "typeVersion": 1
    },
    {
      "id": "8aca9262-f74c-42c1-8d91-ad731b1373a5",
      "name": "Nota adhesiva2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        256
      ],
      "parameters": {
        "color": 5,
        "width": 528,
        "height": 416,
        "content": "## 1. Triggering and Preparation Phase (\"Get informations\")\n\nThis section ensures the reception of data:\n\n-Error Trigger:\nAutomatic triggering of the workflow by the failure or unhandled error of an external workflow. It ingests detailed metadata of the incident (error message, ID, etc.).\n\n-set_recipient_EMAIL/NUMBER:\nA Set-type node configured in manual mode to establish or format destination variables, such as the recipient's email address and phone number for the alert.\n\n-separate items:\nThis node is used to split a list of recipients for individual sending."
      },
      "typeVersion": 1
    },
    {
      "id": "5ed5e06e-1784-4322-bd83-137a1fc9eec7",
      "name": "Nota adhesiva3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        544,
        256
      ],
      "parameters": {
        "width": 592,
        "height": 416,
        "content": "## 2. Alert and Communication Phase (\"Send alert\")\n\nThis section manages dual notification to the priority communication channels:\n\n-Send message (WhatsApp):\nSends an immediate notification via WhatsApp. This channel is generally preferred for its speed and urgency, quickly alerting the concerned service.\n\n-Wait:\nIntroduces a deliberate delay between notifications. This pause ensures compliance with API rate limits before sending the email.\n\n-Send Email (Gmail):\nSends a formal and potentially more detailed alert via Gmail. The email serves as a written record and archive of the incident, consolidating complete information about the error."
      },
      "typeVersion": 1
    },
    {
      "id": "da5f8b04-8faa-4d68-b030-b3b5b45f6353",
      "name": "Nota adhesiva4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1152,
        0
      ],
      "parameters": {
        "color": 4,
        "width": 320,
        "height": 672,
        "content": "## How to do it?\n\nOpen the workflow you want to monitor, go to Workflow Settings, and select your error workflow in the Error Workflow field.\n\nSave the changes.\n\nFrom now on, if an error occurs in your main workflow, the error workflow will be automatically triggered and you will receive a notification with the error details.\n\nYou can use the same error workflow for several different workflows."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {
    "Error Trigger": [
      {
        "json": {
          "workflow": {
            "id": "KlQqshphUe33wiJP",
            "name": "AGENT IA COMERCIAL WHATSAPP SHC"
          },
          "execution": {
            "id": "17448",
            "url": "https://n8n.tickets-place.net/workflow/KlQqshphUe33wiJP/executions/17448",
            "mode": "webhook",
            "error": {
              "name": "ExpressionError",
              "tags": {},
              "level": "warning",
              "stack": "ExpressionError: Referenced node doesn't exist\n    at createExpressionError (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/workflow-data-proxy.ts:775:11)\n    at Proxy.$ (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/workflow-data-proxy.ts:1056:12)\n    at Proxy.eval (eval at getFunction (/usr/lib/node_modules/n8n/node_modules/@n8n/tournament/src/FunctionEvaluator.ts:13:16), <anonymous>:6:42)\n    at FunctionEvaluator.evaluate (/usr/lib/node_modules/n8n/node_modules/@n8n/tournament/src/FunctionEvaluator.ts:20:13)\n    at Tournament.execute (/usr/lib/node_modules/n8n/node_modules/@n8n/tournament/src/index.ts:45:25)\n    at evaluateExpression (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/expression-evaluator-proxy.ts:20:9)\n    at Expression.renderExpression (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/expression.ts:332:29)\n    at Expression.resolveSimpleParameterValue (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/expression.ts:311:28)\n    at Expression.getParameterValue (/usr/lib/node_modules/n8n/node_modules/n8n-workflow/src/expression.ts:522:16)\n    at RoutingNode.getParameterValue (/usr/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/routing-node.ts:757:31)\n    at RoutingNode.runNode (/usr/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/routing-node.ts:156:18)\n    at ExecuteContext.versionedNodeType.execute (/usr/lib/node_modules/n8n/src/node-types.ts:60:18)\n    at WorkflowExecute.runNode (/usr/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1212:9)\n    at /usr/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1582:27\n    at /usr/lib/node_modules/n8n/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2158:11",
              "context": {
                "runIndex": 0,
                "itemIndex": 0,
                "nodeCause": "AI Agent",
                "descriptionKey": "nodeNotFound"
              },
              "message": "Referenced node doesn't exist",
              "timestamp": 1757160423957,
              "functionality": "regular"
            },
            "lastNodeExecuted": "WhatsApp Business Cloud5"
          }
        }
      }
    ]
  },
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "e21dfb63-7e38-4a7c-ac02-c2a9991562e0",
  "connections": {
    "136a7c06-f581-4efc-933e-687ea6cff618": {
      "main": [
        [
          {
            "node": "303dd47b-8706-4587-b5f7-2cbac46f5b17",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5dafc2d3-5438-43b0-92e8-236da886f273": {
      "main": [
        [
          {
            "node": "136a7c06-f581-4efc-933e-687ea6cff618",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5942fb48-d09f-4403-bc95-d9a11f4a58d9": {
      "main": [
        [
          {
            "node": "ec1a5ea3-4a6c-4ee6-9599-4df44d19f5bc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7b95c3be-cdef-45d2-8d41-7ef2f4a221d7": {
      "main": [
        [
          {
            "node": "5dafc2d3-5438-43b0-92e8-236da886f273",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ec1a5ea3-4a6c-4ee6-9599-4df44d19f5bc": {
      "main": [
        [
          {
            "node": "7b95c3be-cdef-45d2-8d41-7ef2f4a221d7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos11
Categoría-
Tipos de nodos7
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34