{
  "name": "Alerta de errores (seguro 3)",
  "nodes": [
    {
      "parameters": {},
      "id": "91c73dfe-95b5-4cea-a481-5756c4f4d807",
      "name": "Error Trigger",
      "type": "n8n-nodes-base.errorTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ]
    },
    {
      "parameters": {
        "mode": "manual",
        "assignments": {
          "assignments": [
            {
              "id": "13ae5727-292a-44a6-a133-2730ca7ce8da",
              "name": "phoneNumberId",
              "value": "TU_PHONE_NUMBER_ID",
              "type": "string"
            },
            {
              "id": "c9cbd6ac-ad2d-4e50-ac76-9712c0a4d104",
              "name": "tuWhatsApp",
              "value": "50688887777",
              "type": "string"
            },
            {
              "id": "88db2248-8681-4d36-ac49-27f3c7e141a2",
              "name": "idiomaPlantillas",
              "value": "es",
              "type": "string"
            },
            {
              "id": "a127955f-f0fa-4600-aa4d-43b16c5aa121",
              "name": "flujo",
              "value": "={{ $json.workflow.name }}",
              "type": "string"
            },
            {
              "id": "ec2d0b05-3109-4159-a955-1dcdb66b2e56",
              "name": "nodo",
              "value": "={{ $json.execution.lastNodeExecuted || \"-\" }}",
              "type": "string"
            },
            {
              "id": "ebbde804-0669-43c6-a172-20d8a5b836f8",
              "name": "error",
              "value": "={{ ($json.execution.error?.message || \"Error desconocido\").slice(0, 600) }}",
              "type": "string"
            },
            {
              "id": "d1fd0372-d563-46af-aab9-931de1bacfa8",
              "name": "enlace",
              "value": "={{ $json.execution.url || \"-\" }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      },
      "id": "0fc41c26-e40c-4966-a624-e6a0fcfadcd7",
      "name": "Tus datos",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ]
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "sendTemplate",
        "phoneNumberId": "={{ $json.phoneNumberId }}",
        "recipientPhoneNumber": "={{ $json.tuWhatsApp }}",
        "template": "=alerta_error|{{ $json.idiomaPlantillas }}",
        "components": {
          "component": [
            {
              "type": "body",
              "bodyParameters": {
                "parameter": [
                  {
                    "type": "text",
                    "text": "={{ $json.flujo }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.nodo }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.error }}"
                  },
                  {
                    "type": "text",
                    "text": "={{ $json.enlace }}"
                  }
                ]
              }
            }
          ]
        }
      },
      "id": "23af752b-437e-4378-aff3-426ffe236929",
      "name": "Alerta al builder",
      "type": "n8n-nodes-base.whatsApp",
      "typeVersion": 1.1,
      "position": [
        440,
        0
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 5000
    },
    {
      "parameters": {
        "content": "## Alerta de errores\nSe dispara cuando falla cualquier flujo que lo tenga elegido en *Settings → Error Workflow*.\nLlena **Tus datos** y crea en Meta la plantilla *alerta_error* (texto en LEEME.md).",
        "height": 300,
        "width": 760,
        "color": 5
      },
      "id": "44b6ff74-8d65-450b-ab14-8fc8be4e79fb",
      "name": "Nota",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -200
      ]
    }
  ],
  "connections": {
    "Error Trigger": {
      "main": [
        [
          {
            "node": "Tus datos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tus datos": {
      "main": [
        [
          {
            "node": "Alerta al builder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
