{
  "name": "Free n8n Topic Intake Validator",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [0, 0],
      "name": "When clicking 'Execute workflow'"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            { "name": "topic", "value": "How to automate content research with n8n", "type": "string" },
            { "name": "audience", "value": "Small teams building AI-powered content operations", "type": "string" },
            { "name": "search_intent", "value": "learn", "type": "string" },
            { "name": "content_pillar", "value": "n8n Workflows", "type": "string" },
            { "name": "primary_cta", "value": "Explore the workflow library", "type": "string" }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [260, 0],
      "name": "Sample Topic Input"
    },
    {
      "parameters": {
        "jsCode": "const input = $input.first().json;\nconst required = ['topic', 'audience', 'search_intent', 'content_pillar'];\nconst invalidTypes = required.filter((key) =>\n  input[key] !== undefined && input[key] !== null && typeof input[key] !== 'string'\n);\n\nif (invalidTypes.length) {\n  throw new Error('Invalid field types (expected string): ' + invalidTypes.join(', '));\n}\n\nconst missing = required.filter((key) => input[key] == null || !input[key].trim());\n\nif (missing.length) {\n  throw new Error('Missing required fields: ' + missing.join(', '));\n}\n\nreturn [{ json: {\n  ...input,\n  topic: input.topic.trim(),\n  audience: input.audience.trim(),\n  search_intent: input.search_intent.trim().toLowerCase(),\n  content_pillar: input.content_pillar.trim(),\n  primary_cta: String(input.primary_cta ?? '').trim(),\n  status: 'validated',\n  workflow_stage: 'topic_intake'\n} }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [520, 0],
      "name": "Validate and Normalise Input"
    }
  ],
  "connections": {
    "When clicking 'Execute workflow'": {
      "main": [[{ "node": "Sample Topic Input", "type": "main", "index": 0 }]]
    },
    "Sample Topic Input": {
      "main": [[{ "node": "Validate and Normalise Input", "type": "main", "index": 0 }]]
    }
  },
  "pinData": {},
  "active": false,
  "settings": { "executionOrder": "v1" },
  "tags": []
}
