{
  "name": "AI-Generated Category Strategy Workflow",
  "nodes": [
    {
      "id": "9c130ef5-ee71-40c9-8176-a97e76086a25",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        720,
        288
      ],
      "parameters": {
        "path": "category-review",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "b058cffe-36ec-4237-8c1b-bc8849fe4114",
      "name": "Fetch Category Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1056,
        288
      ],
      "parameters": {
        "url": "=https://dummyjson.com/c/f739-3e65-4526-8620",
        "options": {}
      },
      "typeVersion": 4.4
    },
    {
      "id": "c6d1bced-e74b-45f1-babd-5a750040d04d",
      "name": "Fetch Supplier + Market Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1376,
        288
      ],
      "parameters": {
        "url": "=https://dummyjson.com/c/37f2-0c73-4cb1-9232",
        "options": {}
      },
      "typeVersion": 4.4
    },
    {
      "id": "8ea022ad-1eb4-4944-8145-3a910d58667d",
      "name": "Generate Category Strategy",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        1664,
        288
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "GPT-4O-MINI"
        },
        "options": {},
        "responses": {
          "values": [
            {
              "role": "system",
              "content": "You are an expert procurement category manager.\n\nYour task is to generate an actionable category strategy based only on the category spend data, supplier data, and market data provided.\n\nDo not invent data.\n\nDo not use Markdown.\nDo not use headings.\nDo not use ```json.\nDo not include any explanation outside the JSON.\n\nThe strategy must identify:\n- Current category situation\n- Strategic objectives\n- Cost-saving opportunities\n- Supplier strategy\n- Negotiation levers\n- Risks\n- Recommended actions\n- Timeline\n- Expected savings\n\nThe output must be practical and suitable for a Category Manager."
            },
            {
              "content": "=Create a category strategy for the following procurement category.\n\nCATEGORY DATA:\n{{ JSON.stringify($node[\"Fetch Category Data\"].json) }}\n\nSUPPLIER AND MARKET DATA:\n{{ JSON.stringify($node[\"Fetch Supplier + Market Data\"].json) }}\n\nGenerate an actionable strategy.\n\nThe strategy must contain:\n\n1. Category\n2. Executive Summary\n3. Current Situation\n4. Strategic Objectives\n5. Opportunities\n6. Supplier Strategy\n7. Negotiation Levers\n8. Risks\n9. Action Plan\n10. Timeline\n11. Expected Savings\n\nDo not use Markdown.\nDo not use headings.\nDo not use ```json.\nDo not include any explanation outside the JSON.\n\nDo not add information that is not supported by the provided data."
            }
          ]
        },
        "builtInTools": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "3be6aec2-fe8a-4991-b521-55ebcbdcd886",
      "name": "Structure Strategy Output",
      "type": "n8n-nodes-base.set",
      "position": [
        2064,
        288
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "ffd083b3-8185-4c61-bf17-c0cf9398c933",
              "name": "category",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).category }}"
            },
            {
              "id": "558384bc-cf7b-4524-ad3e-fbf5fdf416fa",
              "name": "executive_summary",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).executive_summary }}"
            },
            {
              "id": "87e501a8-b417-4f74-adb2-04d80a418d3b",
              "name": "current_situation",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).current_situation }}"
            },
            {
              "id": "7635f5ab-20c9-42fe-8edc-04d1fe7e84cc",
              "name": "strategic_objectives",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).strategic_objectives }}"
            },
            {
              "id": "f979b1d0-da6e-4acb-95e9-9862885588cc",
              "name": "opportunities",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).opportunities }}"
            },
            {
              "id": "8a66d683-f74a-486d-a17e-982c8b04c89c",
              "name": "supplier_strategy",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).supplier_strategy }}"
            },
            {
              "id": "3f6048b9-b3a2-40fe-a3c3-1eb3ffe8bfbf",
              "name": "negotiation_levers",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).negotiation_levers }}"
            },
            {
              "id": "cf1b4eb5-1a9f-4578-9b04-d5d8ae1cac86",
              "name": "risks",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).risks }}"
            },
            {
              "id": "70233ea2-56d1-444c-ac0b-a6eaa38236dc",
              "name": "action_plan",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).action_plan }}"
            },
            {
              "id": "597ca61c-b44a-4964-94ae-770646180357",
              "name": "timeline",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).timeline }}"
            },
            {
              "id": "e17eb0c7-5eb4-4c89-bb6f-d3c65c75cb7f",
              "name": "expected_savings",
              "type": "string",
              "value": "={{ JSON.parse($json.output[0].content[0].text).expected_savings }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "021ecc13-f330-4b84-b8b8-cc5dc219831a",
      "name": "Create Category Strategy Document",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        2400,
        288
      ],
      "parameters": {
        "title": "={{$json.category}} - Category Strategy",
        "folderId": "1FM-kd1_Xi2ikKpK7xAULFWYc_qVH2wwc"
      },
      "typeVersion": 2
    },
    {
      "id": "b6246eaf-1c8f-4fe4-9782-d32bacff4015",
      "name": "Update Category Strategy Document",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        2768,
        288
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "=CATEGORY STRATEGY\n\nCategory: {{ $('Structure Strategy Output').item.json.category }}  \n\nExecutive Summary: {{ $('Structure Strategy Output').item.json.executive_summary }}  \n\nCurrent Situation: {{ $('Structure Strategy Output').item.json.current_situation }}  \n\nStrategic Objectives: {{ $('Structure Strategy Output').item.json.strategic_objectives }}  \n\nOpportunities: {{ $('Structure Strategy Output').item.json.opportunities }}  \n\nSupplier Strategy: {{ $('Structure Strategy Output').item.json.supplier_strategy }}  \n\nNegotiation Levers: {{ $('Structure Strategy Output').item.json.negotiation_levers }}  \n\nRisks: {{ $('Structure Strategy Output').item.json.risks }}  \n\nAction Plan: {{ $('Structure Strategy Output').item.json.action_plan }}  \n\nTimeline: {{ $('Structure Strategy Output').item.json.timeline }}  \n\nExpected Savings: {{ $('Structure Strategy Output').item.json.expected_savings }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "={{ $('Create Category Strategy Document').item.json.id }}"
      },
      "typeVersion": 2
    },
    {
      "id": "5bd87258-b648-4221-a08d-7ab85ded3c26",
      "name": "Notify Category Manager",
      "type": "n8n-nodes-base.gmail",
      "position": [
        3168,
        288
      ],
      "parameters": {
        "sendTo": "user@example.com",
        "message": "=Hello,  \n\nThe AI-generated category strategy has been created successfully.  \n\nCategory:  {{ $('Structure Strategy Output').item.json.category }}\n\nExpected Savings: {{ $('Structure Strategy Output').item.json.expected_savings }}\n\nKey Opportunities: {{ $('Structure Strategy Output').item.json.opportunities }}\n\nKey Risks: {{ $('Structure Strategy Output').item.json.risks }}\n\nThe complete category strategy document has been created and is ready for review.  \n\nRegards, \nProcurement Strategy System",
        "options": {},
        "subject": "=AI Category Strategy Generated - {{ $('Structure Strategy Output').item.json.category }}"
      },
      "typeVersion": 2.2
    },
    {
      "id": "5bd265a9-6b38-4515-8d89-14f51d08ff4e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 384,
        "content": "### Category Review Event\n\nStarts the category strategy workflow when a category review is requested."
      },
      "typeVersion": 1
    },
    {
      "id": "4352e2e7-ddb5-4fbd-a618-f3de5abf35f2",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        944,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 304,
        "height": 384,
        "content": "### Fetch Category Data\n\nRetrieves category spend, historical spend, suppliers, and other procurement data."
      },
      "typeVersion": 1
    },
    {
      "id": "a807469f-155e-4ca5-af05-bd82ec225275",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 288,
        "height": 384,
        "content": "### Fetch Supplier + Market Data\n\nCollects supplier performance, risk, pricing trends, and market conditions"
      },
      "typeVersion": 1
    },
    {
      "id": "b74cf715-79f5-4f84-9c0f-70bd06510cb8",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1600,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 352,
        "height": 384,
        "content": "### Generate Category Strategy — OpenAI\n\nAI analyzes the procurement data and generates an actionable category strategy."
      },
      "typeVersion": 1
    },
    {
      "id": "10a4659c-3e3e-44f1-8757-d144a3cdc4e1",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1984,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 272,
        "height": 384,
        "content": "### Structure Strategy Output\n\nConverts the AI response into structured fields for document generation and downstream use."
      },
      "typeVersion": 1
    },
    {
      "id": "f1a13b6f-3b4a-4ba1-9907-ab0a74f794db",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2288,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 384,
        "content": "### Create Category Strategy Document\n\nCreates a Google Doc using the category name as the strategy document title."
      },
      "typeVersion": 1
    },
    {
      "id": "314af277-286f-4098-b597-012c1cb346ac",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2640,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 336,
        "height": 384,
        "content": "### Update Category Strategy Document\n\nAdds the generated category strategy content to the newly created Google Doc."
      },
      "typeVersion": 1
    },
    {
      "id": "5e87defe-e4e5-40ce-9a57-ed641bb5d5bd",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3024,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 384,
        "height": 384,
        "content": "### Notify Category Manager\n\nNotifies the Category Manager with the completed strategy document for review and action."
      },
      "typeVersion": 1
    },
    {
      "id": "2becf5da-ef29-4a91-b67a-4d35429be63a",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        16
      ],
      "parameters": {
        "width": 752,
        "height": 496,
        "content": "# AI-Generated Category Strategy Workflow (Procurement Industry)**\n\nThis workflow automatically generates an actionable procurement category strategy using category spend data, supplier performance, and market conditions. It uses AI to identify opportunities, supplier strategies, negotiation levers, risks, timelines, and expected savings, then creates a Google Doc and notifies the Category Manager.\n\n### Setup steps\n\n1. Configure the Trigger that starts the workflow.\n2. Connect the required category, supplier, and market data sources.\n3. Configure the AI strategy generation prompt.\n4. Define the required strategy output fields/structure.\n5. Connect and authorize Google Docs for document creation and updates.\n6. Configure the Category Manager notification method.\n7. Test the complete workflow with sample category data."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Fetch Category Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Category Data": {
      "main": [
        [
          {
            "node": "Fetch Supplier + Market Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structure Strategy Output": {
      "main": [
        [
          {
            "node": "Create Category Strategy Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Category Strategy": {
      "main": [
        [
          {
            "node": "Structure Strategy Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Supplier + Market Data": {
      "main": [
        [
          {
            "node": "Generate Category Strategy",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Category Strategy Document": {
      "main": [
        [
          {
            "node": "Update Category Strategy Document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Category Strategy Document": {
      "main": [
        [
          {
            "node": "Notify Category Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "active": false
}
