{
  "name": "WhatsApp Gateway - Message Failed Alert",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "whatsapp-gateway-message-failed",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "webhook-message-failed",
      "name": "WhatsApp Gateway Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [240, 300]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{$json.body.event}}",
              "operation": "equals",
              "value2": "message.failed"
            }
          ]
        }
      },
      "id": "only-message-failed",
      "name": "Only message.failed",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [500, 300]
    },
    {
      "parameters": {
        "url": "https://alerts.example.com/replace-with-admin-alert-endpoint",
        "method": "POST",
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {"name": "event", "value": "={{$json.body.event}}"},
            {"name": "instance", "value": "={{$json.body.instance_name}}"},
            {"name": "error", "value": "={{$json.body.error}}"},
            {"name": "timestamp", "value": "={{$json.body.timestamp}}"}
          ]
        }
      },
      "id": "notify-admin-placeholder",
      "name": "Notify Admin Placeholder",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4,
      "position": [780, 220],
      "notes": "Replace the example alert URL with your own internal alert endpoint."
    }
  ],
  "connections": {
    "WhatsApp Gateway Webhook": {
      "main": [[{"node": "Only message.failed", "type": "main", "index": 0}]]
    },
    "Only message.failed": {
      "main": [[{"node": "Notify Admin Placeholder", "type": "main", "index": 0}], []]
    }
  },
  "active": false,
  "settings": {},
  "tags": ["WhatsApp Gateway", "starter-template"]
}
