{
  "id": "t2yc5xUSEp57OuiN",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "The Content Calendar Manager",
  "tags": [],
  "nodes": [
    {
      "id": "b816fecf-b56c-44dd-a1f9-72430c15b901",
      "name": "Check for New Ideas (Weekly)",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -352,
        176
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "weeks",
              "triggerAtDay": [
                1
              ],
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "60b23928-0d2b-4698-aa2d-0e37a3373b93",
      "name": "Fetch Content Backlog",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -128,
        176
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": [
            {
              "lookupValue": "idea",
              "lookupColumn": "Status"
            },
            {
              "lookupValue": "writing",
              "lookupColumn": "Status"
            }
          ]
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vvFWuf8ZYbAQEdYNZs5__y8X6S9kZz6kafgR8Y8hOYo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vvFWuf8ZYbAQEdYNZs5__y8X6S9kZz6kafgR8Y8hOYo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vvFWuf8ZYbAQEdYNZs5__y8X6S9kZz6kafgR8Y8hOYo/edit?usp=drivesdk",
          "cachedResultName": "Content Ideas"
        },
        "combineFilters": "OR"
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7,
      "alwaysOutputData": false
    },
    {
      "id": "266a0e80-a06d-4100-83ee-8064aa8bf27e",
      "name": "Order by Deadline",
      "type": "n8n-nodes-base.sort",
      "position": [
        96,
        176
      ],
      "parameters": {
        "options": {},
        "sortFieldsUi": {
          "sortField": [
            {
              "fieldName": "Deadline"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "860d4a7f-8fe7-4013-b88a-65dd629176d5",
      "name": "Route by Format (Video/Blog/Social)",
      "type": "n8n-nodes-base.switch",
      "position": [
        320,
        160
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "b985b699-c20c-41a1-b7c6-84e83156eb73",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Type }}",
                    "rightValue": "=video"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "afda9cea-37c2-45fd-8868-2f8a5c13a1bd",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Type }}",
                    "rightValue": "blog"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 3,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "e39e11b7-a403-4bf4-a596-44893b2c47f1",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.Type }}",
                    "rightValue": "social"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.4
    },
    {
      "id": "e9e6e06b-13b2-43cb-b324-f47cd50c690e",
      "name": "Generate Blog Outline",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        544,
        -208
      ],
      "parameters": {
        "text": "=Act as an expert SEO Content Strategist. Create a detailed blog post outline for the topic: '{{ $json.Topic }}'.\n\nStructure required:\n\nWorking Title: Catchy and includes the main keyword.\n\nIntroduction: A hook to grab the reader's attention.\n\nH2/H3 Headings: At least 4 sub-sections with brief bullet points on what to cover under each.\n\nConclusion: A summary and a Call to Action (CTA).\n\nKeywords: Suggest 3-5 secondary keywords to include.\n\nKeep the tone professional and informative.\n\n### REQUIRED OUTPUT FORMAT:\nTitle: [Catchy Headline]\nHook: [1-sentence opening]\nOutline: > - \n[Point 1]\n\n[Point 2]\n\n[Point 3]\nCTA: [Call to Action]\nEstimated Length: [e.g., 800 words / 60 seconds / 280 chars]",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "51db92b2-8170-4c2c-ac0c-1cd5a56d48d9",
      "name": "SEO Strategist LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        592,
        16
      ],
      "parameters": {
        "model": "openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "06e97bf6-8b54-40f9-9561-cfd060202ea7",
      "name": "Generate Video Script",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        544,
        160
      ],
      "parameters": {
        "text": "=Act as a Viral Video Producer. Create a script outline for a video about: '{{ $json.Topic }}'.\n\nStructure required:\n\nThe Hook (0-10s): A high-energy opening statement to prevent scrolling.\n\nThe Problem: Briefly explain why this topic matters to the viewer.\n\nCore Content: 3 main 'scenes' or talking points with key takeaways.\n\nVisual Suggestion: Describe one b-roll or text-overlay idea for the edit.\n\nThe CTA: A specific request for the viewer (e.g., subscribe or comment).\n\nTone: Energetic and punchy.\n\n### REQUIRED OUTPUT FORMAT:\nTitle: [Catchy Headline]\nHook: [1-sentence opening]\nOutline: > - [Point 1]\n\n[Point 2]\n\n[Point 3]\nCTA: [Call to Action]\nEstimated Length: [e.g., 800 words / 60 seconds / 280 chars]",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "5b96d66b-0102-4ce3-912a-5172c9d78f8c",
      "name": "Video Producer LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        592,
        336
      ],
      "parameters": {
        "model": "openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bf28e535-e64f-4319-9a05-f05f70bf8715",
      "name": "Generate Social Post",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        544,
        448
      ],
      "parameters": {
        "text": "=Act as a Social Media Growth Expert. Create a content brief for a social media post about: '{{ $json.Topic }}'.\n\nStructure required:\n\nThe Lead: A scroll-stopping first sentence.\n\nBody Content: Use a 'Problem-Agitate-Solve' framework or a simple 3-bullet list.\n\nEngagement Question: A question at the end to drive comments.\n\nFormatting: Use short sentences and line breaks for readability.\n\nHashtags: Provide 3 niche-specific hashtags.\n\nTone: Relatable and conversational.\n\n### REQUIRED OUTPUT FORMAT:\nTitle: [Catchy Headline]\nHook: [1-sentence opening]\nOutline: > - [Point 1]\n\n[Point 2]\n\n[Point 3]\nCTA: [Call to Action]\nEstimated Length: [e.g., 800 words / 60 seconds / 280 chars]",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "046e966a-5e3d-458c-855f-0c16a9b841e9",
      "name": "Growth Expert LLM",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        608,
        704
      ],
      "parameters": {
        "model": "openai/gpt-oss-120b",
        "options": {}
      },
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a8497d8b-38e0-45f0-8f1f-82dd425ff883",
      "name": "Map Blog Data",
      "type": "n8n-nodes-base.set",
      "position": [
        896,
        -208
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "04fe775b-c39f-4a7d-9bd3-b63af0efac01",
              "name": "row_id",
              "type": "number",
              "value": "={{ $('Fetch Content Backlog').item.json.row_number }}"
            },
            {
              "id": "aaab93dc-2727-4cd2-a608-1b85e9467048",
              "name": "formatted_output",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "32780c08-4fc3-4517-82b6-1149d140efc7",
      "name": "Map Video Data",
      "type": "n8n-nodes-base.set",
      "position": [
        896,
        160
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "04fe775b-c39f-4a7d-9bd3-b63af0efac01",
              "name": "row_id",
              "type": "number",
              "value": "={{ $('Fetch Content Backlog').item.json.row_number }}"
            },
            {
              "id": "aaab93dc-2727-4cd2-a608-1b85e9467048",
              "name": "formatted_output",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "9209ef0a-b7c6-41b1-9d27-3c09d0c655a1",
      "name": "Map Social Data",
      "type": "n8n-nodes-base.set",
      "position": [
        896,
        448
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "04fe775b-c39f-4a7d-9bd3-b63af0efac01",
              "name": "row_id",
              "type": "number",
              "value": "={{ $('Fetch Content Backlog').item.json.row_number }}"
            },
            {
              "id": "aaab93dc-2727-4cd2-a608-1b85e9467048",
              "name": "formatted_output",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "3ff8eeaf-44fe-4cb0-8ed3-7c1e67f9164d",
      "name": "Sync Parallel Branches",
      "type": "n8n-nodes-base.merge",
      "position": [
        1120,
        144
      ],
      "parameters": {
        "numberInputs": 3
      },
      "typeVersion": 3.2
    },
    {
      "id": "3176ddd9-6b8c-4e35-b9cb-bff6aa8c1d77",
      "name": "Bundle Results into List",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        1344,
        160
      ],
      "parameters": {
        "include": "specifiedFields",
        "options": {},
        "aggregate": "aggregateAllItemData",
        "fieldsToInclude": "row_id, , formatted_output",
        "destinationFieldName": "final_results"
      },
      "typeVersion": 1
    },
    {
      "id": "9bbfe81e-4d79-4ea5-beed-8238bee0ab7d",
      "name": "Format Slack Report Layout",
      "type": "n8n-nodes-base.code",
      "position": [
        1568,
        272
      ],
      "parameters": {
        "jsCode": "// Access the list of results\nconst results = $input.first().json.final_results;\n\n// Function to clean AI text for Slack's specific Markdown\nconst cleanForSlack = (text) => {\n  return text\n    .replace(/\\*\\*(.*?)\\*\\*/g, '*$1*') // Convert **bold** to *bold*\n    .replace(/^>\\s*-?\\s*/gm, '\u2022 ')     // Convert AI quotes/bullets to clean dots\n    .replace(/\\n{3,}/g, '\\n\\n');      // Remove excessive empty lines\n};\n\n// Format each report with a nice header and divider\nconst formattedReports = results.map((res, i) => {\n  const cleanedText = cleanForSlack(res.formatted_output);\n  return `${cleanedText}`;\n});\n\n// Join everything into one giant message\nconst finalBody = `*WEEKLY CONTENT SUMMARY REPORT*\\n` + \n                  `\u2501`.repeat(15) + `\\n\\n` + \n                  formattedReports.join('\\n\\n' + `\u2501`.repeat(15) + `\\n\\n`);\n\nreturn { final_text: finalBody };"
      },
      "typeVersion": 2
    },
    {
      "id": "57667e7f-475d-4359-b736-5e5dfeb0b0d9",
      "name": "Post Summary to Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1792,
        272
      ],
      "parameters": {
        "text": "={{ $json.final_text }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": "C0ANV53KW4B",
          "cachedResultName": "new-channel"
        },
        "otherOptions": {
          "includeLinkToWorkflow": false
        },
        "authentication": "oAuth2"
      },
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.4
    },
    {
      "id": "1ab7b42c-45aa-4e7f-aa94-81589b134c3d",
      "name": "Unbundle Individual Rows",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1568,
        64
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "final_results"
      },
      "typeVersion": 1
    },
    {
      "id": "b0505a28-cf42-400d-bb19-505d6a94d487",
      "name": "Mark Status as Writing",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1792,
        64
      ],
      "parameters": {
        "columns": {
          "value": {
            "Sr No": "={{ $json.row_id }}",
            "Status": "writing"
          },
          "schema": [
            {
              "id": "Sr No",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Sr No",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Topic",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Topic",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Type",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Deadline",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Deadline",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Asignee",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Asignee",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Sr No"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vvFWuf8ZYbAQEdYNZs5__y8X6S9kZz6kafgR8Y8hOYo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1vvFWuf8ZYbAQEdYNZs5__y8X6S9kZz6kafgR8Y8hOYo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1vvFWuf8ZYbAQEdYNZs5__y8X6S9kZz6kafgR8Y8hOYo/edit?usp=drivesdk",
          "cachedResultName": "Content Ideas"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "98ab21de-2273-46b7-a831-b3730da1e49c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1024,
        -512
      ],
      "parameters": {
        "width": 624,
        "height": 400,
        "content": "## The Content Calendar Manager\n\n### How It Works\nThis workflow runs weekly to process content ideas from Google Sheets. It filters items marked as \"idea\" or \"writing\", sorts them by deadline and routes them based on type (blog, video, social). Each item is sent to a specialized AI agent to generate structured content. All outputs are combined into a Slack report and processed rows are updated to \"writing\" to avoid duplication.\n\n### Setup Steps\n1. Connect Google Sheets, Slack and Groq credentials  \n2. Update Spreadsheet ID and Sheet name  \n3. Ensure columns: Sr No, Topic, Type, Status, Deadline  \n4. Set Slack channel ID  \n5. Test with sample rows  \n6. Activate the workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "76625f48-a7cf-4e36-83f3-1c93520014dc",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -384,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 608,
        "height": 464,
        "content": "## Ingestion & Routing\nFetches ideas from Google Sheets (Status = idea/writing), sorts by deadline and routes items by Type (blog, video, social) to the correct AI branch."
      },
      "typeVersion": 1
    },
    {
      "id": "1a2997b1-c14b-4579-add7-eae951b062bf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        -416
      ],
      "parameters": {
        "color": 7,
        "width": 576,
        "height": 1232,
        "content": "## AI Content Generation\nEach branch uses a Groq-powered AI agent to generate blog outlines, video scripts or social content based on the topic."
      },
      "typeVersion": 1
    },
    {
      "id": "ae300888-f024-4942-8022-2f869fe8e879",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1072,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 864,
        "height": 528,
        "content": "## Reporting & Sync\nMerges all outputs, formats a Slack summary and updates each processed row in Google Sheets to \"writing\"."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "305cfea1-8add-4b31-a84c-632b6df8ab99",
  "connections": {
    "Map Blog Data": {
      "main": [
        [
          {
            "node": "Sync Parallel Branches",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Video Data": {
      "main": [
        [
          {
            "node": "Sync Parallel Branches",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Map Social Data": {
      "main": [
        [
          {
            "node": "Sync Parallel Branches",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Growth Expert LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Social Post",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Order by Deadline": {
      "main": [
        [
          {
            "node": "Route by Format (Video/Blog/Social)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SEO Strategist LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Blog Outline",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Video Producer LLM": {
      "ai_languageModel": [
        [
          {
            "node": "Generate Video Script",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Generate Social Post": {
      "main": [
        [
          {
            "node": "Map Social Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Content Backlog": {
      "main": [
        [
          {
            "node": "Order by Deadline",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Blog Outline": {
      "main": [
        [
          {
            "node": "Map Blog Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Video Script": {
      "main": [
        [
          {
            "node": "Map Video Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post Summary to Slack": {
      "main": [
        []
      ]
    },
    "Sync Parallel Branches": {
      "main": [
        [
          {
            "node": "Bundle Results into List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Bundle Results into List": {
      "main": [
        [
          {
            "node": "Unbundle Individual Rows",
            "type": "main",
            "index": 0
          },
          {
            "node": "Format Slack Report Layout",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Unbundle Individual Rows": {
      "main": [
        [
          {
            "node": "Mark Status as Writing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Slack Report Layout": {
      "main": [
        [
          {
            "node": "Post Summary to Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check for New Ideas (Weekly)": {
      "main": [
        [
          {
            "node": "Fetch Content Backlog",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Route by Format (Video/Blog/Social)": {
      "main": [
        [
          {
            "node": "Generate Blog Outline",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Video Script",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Generate Social Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}