{
  "name": "ezgpt-webhook-json-demo",
  "active": false,
  "nodes": [
    {
      "id": "5907d959-8de0-48bc-abcb-51f41babaa29",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        0,
        0
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "ezgpt-json-demo",
        "responseMode": "responseNode",
        "options": {}
      }
    },
    {
      "id": "cf7de0b8-7d83-4d52-a15d-e8732e05d6b3",
      "name": "Validate Input",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        260,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "4b80ab0b-f705-4dd6-b67a-0feedcf12946",
              "leftValue": "={{ typeof $json.body?.request_id === 'string' && $json.body.request_id.trim().length > 0 && $json.body.request_id.trim().length <= 80 && typeof $json.body?.message === 'string' && $json.body.message.trim().length > 0 && $json.body.message.trim().length <= 1000 }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "66ae01dd-e92a-430b-b02b-d47ee1ea285a",
      "name": "Build Reply",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        520,
        -120
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ca708793-25fb-4650-893f-84d576dfe41a",
              "name": "status",
              "value": "received",
              "type": "string"
            },
            {
              "id": "549cf0d3-bfc9-4e6f-8b45-d9943009def3",
              "name": "request_id",
              "value": "={{ $json.body.request_id.trim() }}",
              "type": "string"
            },
            {
              "id": "fb5fd801-998e-480b-871f-2dd0a4b43988",
              "name": "message",
              "value": "={{ $json.body.message.trim() }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": false,
        "options": {}
      }
    },
    {
      "id": "ebc0fac8-0387-4647-976d-1feb2242f056",
      "name": "Respond OK",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        780,
        -120
      ],
      "parameters": {
        "respondWith": "firstIncomingItem",
        "options": {
          "responseCode": 200
        }
      }
    },
    {
      "id": "6e240dec-90ff-4b56-bc03-076385911f57",
      "name": "Respond Invalid",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.4,
      "position": [
        520,
        140
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\"status\":\"rejected\",\"error\":\"request_id must be a nonempty string up to 80 characters; message must be a nonempty string up to 1000 characters\"}",
        "options": {
          "responseCode": 422
        }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Validate Input",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validate Input": {
      "main": [
        [
          {
            "node": "Build Reply",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond Invalid",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Reply": {
      "main": [
        [
          {
            "node": "Respond OK",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
