{
  "name": "AI Content Idea Generator — Weekly Ideas + Google Sheets",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtDay": 1,
              "triggerAtHour": 7
            }
          ]
        }
      },
      "id": "g1b2c3d4-0001-4000-8000-000000000001",
      "name": "Schedule — Setiap Senin Jam 7",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        250,
        300
      ]
    },
    {
      "parameters": {
        "operation": "read",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "=GANTI_DENGAN_SPREADSHEET_ID"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Published Content"
        },
        "options": {
          "range": "A:B"
        }
      },
      "id": "g1b2c3d4-0002-4000-8000-000000000002",
      "name": "Google Sheets — Ambil Konten Lama",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        500,
        300
      ]
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "Kamu adalah content strategist untuk bisnis [GANTI_NICHE_ANDA]. Tugasmu menghasilkan 10 ide konten untuk minggu depan.\n\nFormat output (JSON array):\n[\n  {\n    \"judul\": \"Judul konten\",\n    \"platform\": \"Instagram/Blog/YouTube/TikTok\",\n    \"format\": \"Carousel/Reels/Artikel/Video\",\n    \"hook\": \"Kalimat pembuka yang menarik\",\n    \"angle\": \"Sudut pandang unik\"\n  }\n]\n\nPastikan tidak ada duplikasi dengan konten yang sudah dipublish."
            },
            {
              "role": "user",
              "content": "=Konten yang sudah ada: {{ JSON.stringify($json) }}\n\nBuatkan 10 ide konten baru untuk minggu depan."
            }
          ]
        },
        "options": {
          "responseFormat": "json_object"
        }
      },
      "id": "g1b2c3d4-0003-4000-8000-000000000003",
      "name": "AI — Generate 10 Ide Konten",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        750,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Parse AI output dan format untuk Sheets\nconst aiOutput = JSON.parse($input.first().json.text);\nconst ideas = Array.isArray(aiOutput) ? aiOutput : aiOutput.ideas || [];\nconst week = new Date().toISOString().split('T')[0];\n\nreturn ideas.map(idea => ({\n  json: {\n    minggu: week,\n    judul: idea.judul,\n    platform: idea.platform,\n    format: idea.format,\n    hook: idea.hook,\n    angle: idea.angle,\n    status: 'idea'\n  }\n}));"
      },
      "id": "g1b2c3d4-0004-4000-8000-000000000004",
      "name": "Code — Format Ide",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1000,
        300
      ]
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "=GANTI_DENGAN_SPREADSHEET_ID"
        },
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Content Ideas"
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {}
        }
      },
      "id": "g1b2c3d4-0005-4000-8000-000000000005",
      "name": "Google Sheets — Simpan Ide",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1250,
        300
      ]
    }
  ],
  "connections": {
    "Schedule — Setiap Senin Jam 7": {
      "main": [
        [
          {
            "node": "Google Sheets — Ambil Konten Lama",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets — Ambil Konten Lama": {
      "main": [
        [
          {
            "node": "AI — Generate 10 Ide Konten",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI — Generate 10 Ide Konten": {
      "main": [
        [
          {
            "node": "Code — Format Ide",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code — Format Ide": {
      "main": [
        [
          {
            "node": "Google Sheets — Simpan Ide",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateId": "mcsyauqi-content-ideas-07"
  }
}