{
  "name": "AI Product Description Writer",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "product-description",
        "responseMode": "lastNode"
      },
      "id": "a1b2c3d4-1003-4000-8000-000000000001",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1.1,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "set1",
              "name": "productName",
              "value": "={{ $json.body.productName }}",
              "type": "string"
            },
            {
              "id": "set2",
              "name": "features",
              "value": "={{ $json.body.features }}",
              "type": "string"
            },
            {
              "id": "set3",
              "name": "targetAudience",
              "value": "={{ $json.body.targetAudience || 'general consumers' }}",
              "type": "string"
            }
          ]
        }
      },
      "id": "a1b2c3d4-1003-4000-8000-000000000002",
      "name": "Set Product Data",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.2,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "resource": "chat",
        "model": "gpt-4",
        "messages": {
          "values": [
            {
              "content": "Write compelling product descriptions for an e-commerce listing.\n\nProduct: {{ $json.productName }}\nFeatures: {{ $json.features }}\nTarget Audience: {{ $json.targetAudience }}\n\nReturn JSON with keys:\n- shortDescription (50-80 words, punchy and engaging)\n- longDescription (150-250 words, detailed and SEO-friendly)\n- bulletPoints (array of 5 key selling points)\n- seoTitle (max 60 chars)\n- seoDescription (max 160 chars)"
            }
          ]
        },
        "options": {
          "temperature": 0.7,
          "maxTokens": 1500
        }
      },
      "id": "a1b2c3d4-1003-4000-8000-000000000003",
      "name": "OpenAI Generate Description",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.3,
      "position": [
        750,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "const response = JSON.parse($input.first().json.message.content);\nreturn [{\n  json: {\n    productName: $('Set Product Data').first().json.productName,\n    ...response,\n    generatedAt: new Date().toISOString()\n  }\n}];"
      },
      "id": "a1b2c3d4-1003-4000-8000-000000000004",
      "name": "Parse Description",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1000,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "your-product-descriptions-sheet-id"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Descriptions"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Product Name": "={{ $json.productName }}",
            "Short Description": "={{ $json.shortDescription }}",
            "Long Description": "={{ $json.longDescription }}",
            "Bullet Points": "={{ $json.bulletPoints.join(' | ') }}",
            "SEO Title": "={{ $json.seoTitle }}",
            "SEO Description": "={{ $json.seoDescription }}",
            "Generated At": "={{ $json.generatedAt }}"
          }
        }
      },
      "id": "a1b2c3d4-1003-4000-8000-000000000005",
      "name": "Save to Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.2,
      "position": [
        1250,
        300
      ]
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ JSON.stringify($('Parse Description').first().json) }}"
      },
      "id": "a1b2c3d4-1003-4000-8000-000000000006",
      "name": "Respond to Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1500,
        300
      ]
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Set Product Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Product Data": {
      "main": [
        [
          {
            "node": "OpenAI Generate Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Generate Description": {
      "main": [
        [
          {
            "node": "Parse Description",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Description": {
      "main": [
        [
          {
            "node": "Save to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save to Google Sheets": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}