{
  "name": "04 · Weekly Blog Publisher from Content Calendar",
  "nodes": [
    {
      "name": "Every Monday 9am",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        128
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 9
            }
          ]
        }
      }
    },
    {
      "name": "Read Content Calendar",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        224,
        128
      ],
      "parameters": {
        "resource": "sheet",
        "operation": "read",
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0"
        },
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "detectAutomatically"
            }
          }
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "r85NdSPIckoWBdlR",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "name": "Filter Pending",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        448,
        128
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "f1",
              "leftValue": "={{ $json.status }}",
              "rightValue": "pending",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "Build Batch Items",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        672,
        128
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "a1",
              "name": "items",
              "value": "={{ JSON.stringify($input.all().map(i => ({ prompt: \"Write a comprehensive, SEO-optimised blog post about: \" + i.json.topic, website_id: i.json.website_id }))) }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Batch Create Blogs",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        896,
        128
      ],
      "parameters": {
        "resource": "blog",
        "operation": "batchCreate",
        "websiteId": "={{ JSON.parse($json.items)[0]?.website_id || \"\" }}",
        "items": "={{ $json.items }}"
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Persist Workflow IDs",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1120,
        128
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "b1",
              "name": "workflow_ids",
              "value": "={{ JSON.stringify(($json.items || []).filter(i => i.success).map(i => i.workflow_id)) }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Batch Check Blog Status",
      "type": "n8n-nodes-lindo.lindo",
      "typeVersion": 1,
      "position": [
        1344,
        128
      ],
      "parameters": {
        "resource": "workflow",
        "operation": "batchCheckBlog",
        "workflowIds": "={{ $(\"Persist Workflow IDs\").first().json.workflow_ids }}"
      },
      "credentials": {
        "lindoApi": {
          "id": "EZiHryOUuVuxcDYQ",
          "name": "Lindo account"
        }
      }
    },
    {
      "name": "Carry Forward",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1568,
        48
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c1",
              "name": "done",
              "value": "={{ $json.done }}",
              "type": "boolean"
            },
            {
              "id": "c2",
              "name": "status",
              "value": "={{ $json.status }}",
              "type": "string"
            },
            {
              "id": "c3",
              "name": "message",
              "value": "={{ $json.message }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "name": "Done?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        1792,
        48
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "d1",
              "leftValue": "={{ $json.done }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "name": "Slack Digest",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.4,
      "position": [
        2016,
        0
      ],
      "parameters": {
        "resource": "message",
        "operation": "post",
        "channel": "#content",
        "text": "=📝 Weekly blog batch complete: {{ $json.message }}"
      },
      "webhookId": "bde72408-9561-40e5-bb4d-abcdcd63d989",
      "credentials": {
        "slackApi": {
          "id": "sXUjiMVMx3RPbSTG",
          "name": "Slack account"
        }
      }
    },
    {
      "name": "Wait 60s",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        2016,
        224
      ],
      "parameters": {
        "amount": 60
      },
      "webhookId": "b1a4a423-9231-4e2e-a7ae-d90ce3e14115"
    },
    {
      "name": "Sticky Note f1e91457",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1008,
        288
      ],
      "parameters": {
        "content": "### 04 · Weekly Blog Publisher from Content Calendar\n\n**How it works:** Every Monday at 9am → reads Google Sheet content calendar → filters rows with status \"pending\" → batch-creates blog posts via Lindo → polls build status every 60s → posts Slack digest when all blogs are published.\n\n**Setup:** Create a Google Sheet with columns: topic, website_id, status. Set status to \"pending\" for posts to publish. Connect Google Sheets and Slack credentials.\n\n**Customisation:** Change schedule day/time. Adjust the blog prompt template in Build Batch Items. Add a step to update the sheet status to \"published\" after completion. Change Slack channel from #content.",
        "color": 2,
        "width": 2316,
        "height": 424
      }
    },
    {
      "name": "Sticky Note 1e5b5d06",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1008,
        288
      ],
      "parameters": {
        "content": "## Schedule & Filter\nRuns weekly Monday 9am. Reads sheet and filters only \"pending\" rows for publishing.",
        "color": 1,
        "width": 748,
        "height": 200
      }
    },
    {
      "name": "Sticky Note 8e28054b",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1008,
        288
      ],
      "parameters": {
        "content": "## Batch Blog Creation\nBuilds batch payload from filtered items and creates all blogs in one Lindo API call.",
        "color": 1,
        "width": 524,
        "height": 200
      }
    },
    {
      "name": "Sticky Note 8122122c",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1008,
        288
      ],
      "parameters": {
        "content": "## Status Polling\nPolls batch status every 60s. Once all done, posts summary to Slack #content channel.",
        "color": 1,
        "width": 972,
        "height": 424
      }
    }
  ],
  "connections": {
    "Every Monday 9am": {
      "main": [
        [
          {
            "node": "Read Content Calendar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Content Calendar": {
      "main": [
        [
          {
            "node": "Filter Pending",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Pending": {
      "main": [
        [
          {
            "node": "Build Batch Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build Batch Items": {
      "main": [
        [
          {
            "node": "Batch Create Blogs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Create Blogs": {
      "main": [
        [
          {
            "node": "Persist Workflow IDs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Persist Workflow IDs": {
      "main": [
        [
          {
            "node": "Batch Check Blog Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Check Blog Status": {
      "main": [
        [
          {
            "node": "Carry Forward",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Carry Forward": {
      "main": [
        [
          {
            "node": "Done?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Done?": {
      "main": [
        [
          {
            "node": "Slack Digest",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait 60s",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 60s": {
      "main": [
        [
          {
            "node": "Batch Check Blog Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}