{
  "name": "Generate workflow JSON files from webhook prompts using Azure OpenAI GPT-4o-mini",
  "nodes": [
    {
      "id": "cb9054f7-a792-4f88-98b7-7f34509d8084",
      "name": "Receive Workflow Prompt",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -112,
        544
      ]
    },
    {
      "id": "6e8c9b64-c8b6-4125-a7ca-4718ea746aff",
      "name": "Sanitize & Normalize Prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        544
      ]
    },
    {
      "id": "78b4c991-ee4d-4376-93e3-711b06b3a21b",
      "name": "Generate Workflow via AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        304,
        544
      ]
    },
    {
      "id": "b719e9dc-bbb5-4945-9ffc-7b81f63efc49",
      "name": "Parse & Validate AI JSON Output",
      "type": "n8n-nodes-base.code",
      "position": [
        656,
        544
      ]
    },
    {
      "id": "ac81bb2e-33a4-4d1c-95b8-44d4afbdef57",
      "name": "Convert Workflow to JSON File",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        864,
        544
      ]
    },
    {
      "id": "450fe5e9-2ae4-4923-9ee8-f295003f0240",
      "name": "Return JSON File to Caller",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1088,
        544
      ]
    },
    {
      "id": "ab863cf3-3f1c-42df-8927-fd1881870ae3",
      "name": "📋 Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        288
      ],
      "parameters": {
        "width": 500,
        "height": 836,
        "content": "## 🧠 AI Workflow Generator\n\n### How it works\nThis workflow accepts a plain-text automation description via a POST webhook and uses an Azure OpenAI-powered AI Agent to generate a fully valid, import-re"
      }
    },
    {
      "id": "d11fd04b-a949-4429-9770-dfd4505ea824",
      "name": "📥 Section: Input & Prompt Prep",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -144,
        352
      ],
      "parameters": {
        "width": 420,
        "height": 200,
        "content": "## 📥 Input & Prompt Preparation\nReceives the raw POST request and extracts the `prompt` field. Normalizes line breaks and trims whitespace so the AI always gets clean, consistent input."
      }
    },
    {
      "id": "0997a823-87c3-48bb-a350-c5f98de409db",
      "name": "🤖 Section: AI Generation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        336
      ],
      "parameters": {
        "width": 420,
        "height": 200,
        "content": "## 🤖 AI Workflow Generation\nThe AI Agent uses Azure OpenAI GPT-4o-mini with a strict system prompt to produce a complete, import-ready n8n workflow JSON. No markdown, no explanations — raw JSON only."
      }
    },
    {
      "id": "107a24ff-7a90-42ae-9f78-9a85f91f9a54",
      "name": "📤 Section: Output Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        752,
        352
      ],
      "parameters": {
        "width": 560,
        "height": 200,
        "content": "## 📤 Output Processing & Response\nParses and validates the AI's raw string output into structured JSON, converts it to a downloadable file, and returns it to the caller as a binary HTTP response."
      }
    },
    {
      "id": "97f124e8-c0ff-406d-8d04-97239f0eb207",
      "name": "⚠️ Warning: Azure OpenAI Credentials",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        896
      ],
      "parameters": {
        "width": 300,
        "height": 150,
        "content": "⚠️ **Azure OpenAI Credentials Required**\nThis node requires a valid `azureOpenAiApi` credential with an active deployment named `gpt-4o-mini`. Misconfiguration will cause all AI generation to fail."
      }
    },
    {
      "id": "ac57db68-8517-4840-b125-4a5a6a634dbf",
      "name": "Azure OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        176,
        752
      ]
    }
  ],
  "connections": {
    "Receive Workflow Prompt": {
      "main": [
        [
          {
            "node": "Sanitize & Normalize Prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Workflow via AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Sanitize & Normalize Prompt": {
      "main": [
        [
          {
            "node": "Generate Workflow via AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Workflow to JSON File": {
      "main": [
        [
          {
            "node": "Return JSON File to Caller",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Workflow via AI Agent": {
      "main": [
        [
          {
            "node": "Parse & Validate AI JSON Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse & Validate AI JSON Output": {
      "main": [
        [
          {
            "node": "Convert Workflow to JSON File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}