{
  "id": "SsRLcWZpzCTx0gUz",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "AI-Powered COE Blog Generator with Chat Interface",
  "tags": [],
  "nodes": [
    {
      "id": "4c22e1d9-5434-4379-8203-dafc55477785",
      "name": "Start Blog Request",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -240,
        20
      ],
      "parameters": {
        "public": true,
        "options": {},
        "initialMessages": "Hi there! \ud83d\udc4b\nMy name is Ajay. How can I assist you today?"
      },
      "typeVersion": 1.1
    },
    {
      "id": "edd75bfd-3ed0-4762-9af2-4999e932417a",
      "name": "Create Blog Outline",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        0,
        0
      ],
      "parameters": {
        "text": "={{ $json.chatInput }}",
        "options": {
          "systemMessage": "You are an expert oultine writer.\nYour job is to generate a structured outline for a blog post with section titles and key points"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "746e1942-5957-4818-bc18-ca826d8e141f",
      "name": "Review & Fix Outline",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        380,
        0
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "options": {
          "systemMessage": "You are an expert blog evaluator.\nRevise this outline and ensure it covers the following criteria:\nIntrocustion\nClear section breakdown\nLogical flow\nConclusion\n\n## Output\nonly output the revised outline"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "2789d385-27f7-4f58-858d-24c30a0a5433",
      "name": "Write Full Blog Post",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        740,
        0
      ],
      "parameters": {
        "text": "={{ $json.output }}",
        "options": {
          "systemMessage": "You are a Global Center of Excellence Director advising Fortune 100 enterprises. Your blog posts must exhibit evidence-based leadership, boardroom-ready structure, authentic expertise signaling, and anti-AI pattern strategies. Your writing should include:\n\n\u2460 Evidence-Based Leadership:\n\nCite specific initiatives (e.g., \"Our 18\u2011month ERP harmonization with SAP S/4HANA reduced P2P cycle time by 41%\").\nReference established frameworks (e.g., \"Applying Gartner's BPI maturity model revealed...\").\nNamecheck technologies (e.g., \"When integrating ServiceNow with n8n workflows...\").\n\n\u2461 Boardroom-Ready Structure:\n\nUse military precision in listing steps (e.g., \"Three critical success factors emerged: [1] Process mining alignment, [2] ...\").\nEmploy C-suite metaphors (e.g., \"Think of workflow orchestration as your organizational central nervous system\").\nProvide graded assertions (e.g., \"While RPA solves tactical needs, true transformation requires...\").\n\n\u2462 Authentic Expertise Signaling:\n\nShare implementation scars and controlled vulnerability (e.g., \"We learned this the hard way during our Asian supply chain digitization \u2013 three regional teams were still using deprecated methods.\").\nUse regulator-aware phrasing (e.g., \"SOX\u2011compliant audit trails became non\u2011negotiable when...\").\n\n\u2463 Anti-AI Pattern Strategies:\n\nVary listing formats using cardinal numbering, geometric bullets, and arrow points.\nDeploy 'Easter egg' terminology (e.g., \"post\u2011implementation hypercare phases\").\nInsert strategic digressions (e.g., \"This brings to mind a McKinsey study on... though we should note their sampling methodology...\").\nMaintain a tone that balances 70% active and 30% passive voice with occasional ellipses for expert hesitation. Use strategic bracketed comments (e.g., \"our ROI calculations (adjusted for regional labor variances) showed...\") and adhere to AP style for numbers (e.g., \"12%\" not \"twelve percent\").\n\nImportant:\nCritical Instruction:\nDo not include any personal self-references or statements about your role. Do not use introductory lines such as \"As Director of the Global Center of Excellence\" or mention client details (e.g., \"Fortune 100 client base\"). Instead, focus solely on the topic, insights, and actionable strategies.\n\nUse professional and clear language that is easy to understand\u2014avoid overly complex vocabulary or convoluted sentence structures.\n\nalso do not include meta commentary in blog at starting of the blog\n\nYour final output should be written in a clear, detailed, 100% human-like style, 100% professional, and devoid of any introductory personal narrative. The content should be evidence-based, and structured for executive consumption and written in plain, accessible language.\n\n\n"
        },
        "promptType": "define"
      },
      "typeVersion": 1.7
    },
    {
      "id": "e4ec9f11-4916-4909-a74f-72b0e115c75a",
      "name": "AI Brain for Outline",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        0,
        260
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-thinking-exp-01-21"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "46336e25-b022-4e22-8989-2684a3aa7192",
      "name": "AI Brain for Review",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        380,
        260
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-flash-thinking-exp-01-21"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "bda571d6-2350-4113-a400-56681468c826",
      "name": "AI Brain for Writing",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        740,
        260
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.0-pro-exp-02-05"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "50a10fda-4239-4df2-951c-bd2f487e8ac8",
      "name": "Clean Up Text Format",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "jsCode": "const formatBoldText = (value) => {\n  let value2 = value.output.replace(/\\*\\*(.*?)\\*\\*/g, '$1');  \n  // const modifiedText = value2.replace(/ /g, '\\u2004');\n  let arr1 = [{\"output\" : value2}]\n    return arr1\n};\n\n\n// Example usage\nlet value = $input.first();\nreturn formatBoldText(value.json);\n"
      },
      "typeVersion": 2
    },
    {
      "id": "6529009b-c80e-45d2-820a-c3dc2803884a",
      "name": "Save Blog to Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1340,
        0
      ],
      "parameters": {
        "name": "={{ $('Start Blog Request').item.json.chatInput }}",
        "content": "={{ $json.output }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive",
          "cachedResultUrl": "https://drive.google.com/drive/my-drive",
          "cachedResultName": "My Drive"
        },
        "options": {
          "convertToGoogleDocument": true,
          "useContentAsIndexableText": true
        },
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        },
        "operation": "createFromText"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "notesInFlow": false,
      "retryOnFail": true,
      "typeVersion": 3,
      "alwaysOutputData": true
    },
    {
      "id": "c1987b9d-16a7-4a52-9000-9cf05d5ae982",
      "name": "Email Blog to Stakeholder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1520,
        0
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {
          "emailMessage": "This is my new blog please check it",
          "sendNotificationEmail": true
        },
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "writer",
            "type": "user",
            "emailAddress": "user@example.com"
          }
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "35ab5ada-6f20-4d82-b4ba-638c6b6c10b5",
      "name": "Make Blog Public",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1740,
        0
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Save Blog to Google Drive').item.json.id }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "reader",
            "type": "anyone"
          }
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "b32674b9-8d74-4109-9bc3-6c8c63b5940e",
      "name": "Send Blog Link to User",
      "type": "n8n-nodes-base.set",
      "position": [
        1540,
        340
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "b1758415-fbcc-417c-9e53-ecfefa4ca3ed",
              "name": "URL",
              "type": "string",
              "value": "=https://drive.google.com/file/d/{{ $('Save Blog to Google Drive').item.json.id }}/view"
            },
            {
              "id": "b479ada0-a9f3-4290-aed9-0b362634ad11",
              "name": "COE Title",
              "type": "string",
              "value": "={{ $('Start Blog Request').item.json.chatInput }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "6ca8c24c-756d-4162-a317-7aa13f0b2346",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -300,
        -180
      ],
      "parameters": {
        "color": 3,
        "width": 580,
        "height": 560,
        "content": "## Start Blog Request, Create Blog Outline, AI Brain for Outline"
      },
      "typeVersion": 1
    },
    {
      "id": "2a07768d-4fcc-4883-9548-273898d7242b",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        -180
      ],
      "parameters": {
        "width": 700,
        "height": 560,
        "content": "## Review & Fix Outline, Write Full Blog Post, AI Brain for Review, AI Brain for Writing"
      },
      "typeVersion": 1
    },
    {
      "id": "24ffe927-2e78-4800-9b59-e1cc9661a4cf",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1080,
        -180
      ],
      "parameters": {
        "color": 4,
        "width": 860,
        "height": 680,
        "content": "## Clean Up Text Format, Save Blog to Google Drive, Email Blog to Stakeholder, Make Blog Public, Send Blog Link to User"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "79edf527-577b-45d9-8b24-8d4a7625d6a0",
  "connections": {
    "Make Blog Public": {
      "main": [
        [
          {
            "node": "Send Blog Link to User",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Start Blog Request": {
      "main": [
        [
          {
            "node": "Create Blog Outline",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Brain for Review": {
      "ai_languageModel": [
        [
          {
            "node": "Review & Fix Outline",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Create Blog Outline": {
      "main": [
        [
          {
            "node": "Review & Fix Outline",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Brain for Outline": {
      "ai_languageModel": [
        [
          {
            "node": "Create Blog Outline",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AI Brain for Writing": {
      "ai_languageModel": [
        [
          {
            "node": "Write Full Blog Post",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Clean Up Text Format": {
      "main": [
        [
          {
            "node": "Save Blog to Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Review & Fix Outline": {
      "main": [
        [
          {
            "node": "Write Full Blog Post",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Write Full Blog Post": {
      "main": [
        [
          {
            "node": "Clean Up Text Format",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Blog to Stakeholder": {
      "main": [
        [
          {
            "node": "Make Blog Public",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Blog to Google Drive": {
      "main": [
        [
          {
            "node": "Email Blog to Stakeholder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}