{
  "id": "argosLocalWebhookDemo",
  "name": "Local demonstration - validated webhook to fictional API",
  "nodes": [
    {
      "id": "receive",
      "name": "Receive webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        0
      ],
      "webhookId": "argos-local-demo",
      "parameters": {
        "httpMethod": "POST",
        "path": "argos-local-demo",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "id": "validate",
      "name": "Validate name and status",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        220,
        0
      ],
      "parameters": {
        "conditions": {
          "boolean": [
            {
              "value1": "={{ typeof $json.body.name === 'string' && $json.body.name.trim().length > 0 && $json.body.name.length <= 100 && ['new', 'active'].includes($json.body.status) }}",
              "value2": true,
              "operation": "equal"
            }
          ]
        }
      }
    },
    {
      "id": "post",
      "name": "POST local fictional API",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        450,
        -100
      ],
      "parameters": {
        "method": "POST",
        "url": "http://127.0.0.1:18766/contacts",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ { name: $json.body.name.trim(), status: $json.body.status } }}",
        "options": {
          "timeout": 5000,
          "response": {
            "response": {
              "fullResponse": true,
              "neverError": true,
              "responseFormat": "json"
            }
          }
        }
      }
    },
    {
      "id": "response",
      "name": "Return API result",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        690,
        -100
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ $json.body }}",
        "options": {
          "responseCode": "={{ $json.statusCode }}"
        }
      }
    },
    {
      "id": "invalid",
      "name": "Reject invalid input",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        450,
        150
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\"ok\":false,\"error\":\"invalid_name_or_status\"}",
        "options": {
          "responseCode": 400
        }
      }
    }
  ],
  "connections": {
    "Receive webhook": {
      "main": [
        [
          {
            "node": "Validate name and status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate name and status": {
      "main": [
        [
          {
            "node": "POST local fictional API",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Reject invalid input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "POST local fictional API": {
      "main": [
        [
          {
            "node": "Return API result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false,
  "pinData": {}
}
