{
  "name": "Flowprep · Validate event payloads",
  "active": false,
  "nodes": [
    {
      "id": "validate-event-payloads-start",
      "name": "Start manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        300
      ],
      "parameters": {}
    },
    {
      "id": "validate-event-payloads-sample",
      "name": "Sample data",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        260,
        300
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    \"event\": \"signup\",\n    \"email\": \"alex@example.com\"\n  },\n  {\n    \"event\": \"signup\",\n    \"email\": \"\"\n  },\n  {\n    \"event\": \"purchase\",\n    \"email\": \"sam@example.com\"\n  }\n].map(json => ({ json }));"
      }
    },
    {
      "id": "validate-event-payloads-transform",
      "name": "Validate event payloads",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        520,
        300
      ],
      "parameters": {
        "jsCode": "return $input.all().map((item, i) => {\n  const issues = [];\n  if (typeof item.json.event !== 'string' || !item.json.event.trim()) issues.push('Missing event');\n  if (typeof item.json.email !== 'string' || !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(item.json.email)) issues.push('Invalid email shape');\n  return { json: { ...item.json, valid: issues.length === 0, issues }, pairedItem: { item: i } };\n});"
      }
    },
    {
      "id": "validate-event-payloads-note",
      "name": "Read first",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -30
      ],
      "parameters": {
        "content": "## Validate event payloads\nMark event rows for review when required fields are missing.\n\n1. Import into n8n.\n2. Execute manually and inspect the output.\n3. Replace Sample data with your source after reviewing the Code node.\n\nThis is a basic field-shape check, not email verification, webhook authentication or a complete business schema.\n\nIndependent example from Flowprep. No credentials or external calls. Sample transformation tested; verify import and execution on your n8n version.",
        "width": 760,
        "height": 230
      }
    }
  ],
  "connections": {
    "Start manually": {
      "main": [
        [
          {
            "node": "Sample data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sample data": {
      "main": [
        [
          {
            "node": "Validate event payloads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "tags": []
}