{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "304b9395-be61-49c6-b010-13ee255a8a6f",
      "name": "New File in Client Briefs Folder",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        5856,
        2432
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "unit": "minutes",
              "value": 5
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "id",
          "value": "<__PLACEHOLDER_VALUE__Google Drive Folder ID for Client Briefs__>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "d279c77a-41db-436e-9ed6-8d5639b8e366",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        6080,
        2432
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "clientSummariesFolderId",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Google Drive Folder ID for Client Summaries__>"
            },
            {
              "id": "id-2",
              "name": "accountManagerEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Account Manager Email Address__>"
            },
            {
              "id": "id-3",
              "name": "trackingSheetId",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Google Sheets ID for Tracking__>"
            },
            {
              "id": "id-4",
              "name": "errorNotificationEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Error Notification Email__>"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "cdd0ab79-5686-4727-8141-a649251d6e25",
      "name": "Check File Type",
      "type": "n8n-nodes-base.if",
      "position": [
        6304,
        2432
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.mimeType }}",
              "rightValue": "application/pdf"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "1e9e4465-66c4-43b6-a882-0976c0407439",
      "name": "Extract Text from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        6528,
        2240
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "typeVersion": 1.1
    },
    {
      "id": "46f6667b-a85d-452a-9141-ba0b2fa895eb",
      "name": "Extract Text from DOCX",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        6528,
        2432
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1.1
    },
    {
      "id": "8aca214f-7d5e-4279-9a59-a0adaa85fd7e",
      "name": "Extract Text from TXT",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        6528,
        2624
      ],
      "parameters": {
        "options": {},
        "operation": "text"
      },
      "typeVersion": 1.1
    },
    {
      "id": "15fb48a0-988c-47b2-8cc1-21a44296864b",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        7392,
        2704
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "16747e9e-ea44-4598-be75-707fc4cff1f9",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        7520,
        2704
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"summary\": \"Comprehensive overview of the client brief\",\n\t\"clientName\": \"Name of the client or company\",\n\t\"industry\": \"Industry sector\",\n\t\"projectType\": \"Type of project (e.g., branding, website, campaign)\",\n\t\"clientNeeds\": [\"Need 1\", \"Need 2\"],\n\t\"clientGoals\": [\"Goal 1\", \"Goal 2\"],\n\t\"targetAudience\": \"Description of target audience\",\n\t\"budget\": \"Budget information if mentioned\",\n\t\"timeline\": \"Timeline or deadline information\",\n\t\"challenges\": [\"Challenge 1\", \"Challenge 2\"],\n\t\"risks\": [\"Risk 1\", \"Risk 2\"],\n\t\"recommendations\": [\"Recommendation 1\", \"Recommendation 2\"],\n\t\"keyQuestions\": [\"Question 1\", \"Question 2\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "54624ede-52d6-402a-8430-0e1bcaff8dc7",
      "name": "Analyze Client Brief",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        7536,
        2416
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are an elite strategic business analyst with 15+ years of experience in client brief analysis across multiple industries.\n\nYour task is to perform a comprehensive, deep analysis of the client brief document.\n\nExtract and analyze:\n1. Executive Summary (3-4 sentences capturing the essence)\n2. Client Information (name, industry sector)\n3. Project Type and Scope\n4. Client Needs (be specific and detailed)\n5. Client Goals (short-term and long-term)\n6. Target Audience (demographics, psychographics)\n7. Budget Information (extract any budget mentions or constraints)\n8. Timeline and Deadlines (identify all time-related requirements)\n9. Challenges and Obstacles (technical, market, resource-based)\n10. Risk Assessment (potential risks to project success)\n11. Strategic Recommendations (actionable, prioritized)\n12. Key Questions (critical questions that need clarification)\n\nBe thorough, analytical, and strategic. Identify implicit needs and unstated assumptions."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "a68cfad7-9c20-4cc3-a4cc-a88c354ef491",
      "name": "Create Google Doc Report",
      "type": "n8n-nodes-base.googleDocs",
      "position": [
        8592,
        2432
      ],
      "parameters": {
        "title": "=\ud83d\udcca Client Brief Analysis - {{ $('New File in Client Briefs Folder').item.json.name }}",
        "folderId": "={{ $('Workflow Configuration').item.json.clientSummariesFolderId }}"
      },
      "typeVersion": 2
    },
    {
      "id": "08ac97f4-b533-4313-8604-73470de5a3ef",
      "name": "Send Email to Account Manager",
      "type": "n8n-nodes-base.gmail",
      "position": [
        8992,
        2432
      ],
      "parameters": {
        "sendTo": "={{ $('Workflow Configuration').item.json.accountManagerEmail }}",
        "message": "=<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;\">\n  <h2 style=\"color: #2563eb;\">\ud83d\udcca Comprehensive Client Brief Analysis Complete</h2>\n  \n  <div style=\"background-color: #f3f4f6; padding: 20px; border-radius: 8px; margin: 20px 0;\">\n    <h3 style=\"margin-top: 0;\">\ud83d\udcc4 Document Details</h3>\n    <p><strong>File:</strong> {{ $('New File in Client Briefs Folder').item.json.name }}</p>\n    <p><strong>Client:</strong> {{ $json.briefAnalysis.clientName }}</p>\n    <p><strong>Industry:</strong> {{ $json.briefAnalysis.industry }}</p>\n    <p><strong>Project Type:</strong> {{ $json.briefAnalysis.projectType }}</p>\n    <p><strong>Analysis Date:</strong> {{ $now.toFormat(\"MMMM dd, yyyy HH:mm\") }}</p>\n  </div>\n\n  <div style=\"background-color: #ecfdf5; padding: 20px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #10b981;\">\n    <h3 style=\"margin-top: 0; color: #059669;\">\ud83d\udcc8 Analysis Summary</h3>\n    <ul style=\"line-height: 1.8;\">\n      <li><strong>Client Needs Identified:</strong> {{ $json.stats.needsCount }}</li>\n      <li><strong>Strategic Goals:</strong> {{ $json.stats.goalsCount }}</li>\n      <li><strong>Challenges Flagged:</strong> {{ $json.stats.challengesCount }}</li>\n      <li><strong>Recommendations Provided:</strong> {{ $json.stats.recommendationsCount }}</li>\n      <li><strong>Industry Trends Researched:</strong> {{ $json.stats.trendsCount }}</li>\n    </ul>\n  </div>\n\n  <div style=\"background-color: #fff; padding: 20px; border: 2px solid #e5e7eb; border-radius: 8px; margin: 20px 0;\">\n    <h3 style=\"margin-top: 0;\">\ud83d\udca1 Executive Summary</h3>\n    <p style=\"line-height: 1.6;\">{{ $json.briefAnalysis.summary }}</p>\n  </div>\n\n  <div style=\"text-align: center; margin: 30px 0;\">\n    <a href=\"{{ $('Create Google Doc Report').item.json.documentUrl }}\" style=\"display: inline-block; background-color: #2563eb; color: white; padding: 12px 30px; text-decoration: none; border-radius: 6px; font-weight: bold;\">\ud83d\udcd6 View Full Analysis Report</a>\n  </div>\n\n  <div style=\"background-color: #fef3c7; padding: 15px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #f59e0b;\">\n    <h4 style=\"margin-top: 0; color: #d97706;\">\u26a1 Next Steps</h4>\n    <ol style=\"line-height: 1.8; margin: 10px 0;\">\n      <li>Review the comprehensive analysis document</li>\n      <li>Schedule client meeting to clarify key questions</li>\n      <li>Develop detailed proposal based on recommendations</li>\n      <li>Prepare budget breakdown and timeline</li>\n    </ol>\n  </div>\n\n  <hr style=\"border: none; border-top: 1px solid #e5e7eb; margin: 30px 0;\">\n  \n  <p style=\"color: #6b7280; font-size: 12px; text-align: center;\">\n    <em>This analysis was automatically generated by the AI-powered Client Brief Analyzer workflow.<br>\n    Powered by Groq AI \u2022 Google Drive \u2022 n8n Automation</em>\n  </p>\n</div>",
        "options": {},
        "subject": "=\ud83c\udfaf Comprehensive Client Brief Analysis Ready: {{ $('New File in Client Briefs Folder').item.json.name }}"
      },
      "typeVersion": 2.2
    },
    {
      "id": "ca655b1a-8d98-40cb-a497-fccf4486a406",
      "name": "Deep Industry Research",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        7840,
        2640
      ],
      "parameters": {
        "text": "=Research the following industry and project context:\n\nIndustry: {{ $('Analyze Client Brief').item.json.industry }}\nProject Type: {{ $('Analyze Client Brief').item.json.projectType }}\nClient: {{ $('Analyze Client Brief').item.json.clientName }}\n\nProvide comprehensive research on current industry trends, competitor insights, market opportunities, and best practices relevant to this brief.",
        "options": {
          "systemMessage": "You are an expert industry researcher and market analyst.\n\nYour task is to conduct deep research on the industry, market, and competitive landscape relevant to the client brief.\n\nResearch and provide:\n1. Current Industry Trends (latest developments, shifts, innovations)\n2. Competitor Insights (what competitors are doing, their strategies)\n3. Market Opportunities (gaps, emerging needs, growth areas)\n4. Best Practices (proven approaches in this industry/project type)\n5. Technological Factors (relevant technologies, tools, platforms)\n6. Regulatory Considerations (compliance, legal requirements)\n7. Budget Benchmarks (typical budget ranges for similar projects)\n8. Timeline Estimates (realistic timelines based on industry standards)\n\nUse Wikipedia and web search tools to gather current, accurate information. Be thorough and cite-worthy."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3
    },
    {
      "id": "e94be687-457e-413c-8130-518c152e1e18",
      "name": "Research Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        8112,
        2928
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"industryTrends\": [\"Trend 1\", \"Trend 2\"],\n\t\"competitorInsights\": [\"Insight 1\", \"Insight 2\"],\n\t\"marketOpportunities\": [\"Opportunity 1\", \"Opportunity 2\"],\n\t\"bestPractices\": [\"Practice 1\", \"Practice 2\"],\n\t\"technologicalFactors\": [\"Factor 1\", \"Factor 2\"],\n\t\"regulatoryConsiderations\": [\"Consideration 1\"],\n\t\"budgetBenchmarks\": \"Industry budget benchmarks\",\n\t\"timelineEstimates\": \"Typical project timelines in this industry\"\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "c977dbc9-eda7-4759-8373-7da986001479",
      "name": "Wikipedia Research Tool",
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "position": [
        7856,
        2928
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "f6b41953-d7e4-4cad-bb8e-f27466732099",
      "name": "Groq Research Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        7728,
        2928
      ],
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a75e43dc-ca65-49b4-810c-d1f62b60b3a4",
      "name": "Combine Analysis and Research",
      "type": "n8n-nodes-base.merge",
      "position": [
        8112,
        2432
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "9bab9de2-40ca-48d7-9673-4f2d95bff273",
      "name": "Generate Comprehensive Report",
      "type": "n8n-nodes-base.code",
      "position": [
        8400,
        2432
      ],
      "parameters": {
        "jsCode": "// Generate comprehensive report combining analysis and research\nconst analysisData = $input.first().json;\nconst researchData = $input.last().json;\n\n// Build the comprehensive report content\nlet reportContent = `# Client Brief Analysis - ${$('New File in Client Briefs Folder').item.json.name}\\n\\n`;\nreportContent += `**Analysis Date:** ${new Date().toISOString().split('T')[0]}\\n\\n`;\nreportContent += `---\\n\\n`;\n\n// Executive Summary Section\nreportContent += `## Executive Summary\\n\\n`;\nreportContent += `${analysisData.summary || 'No summary available.'}\\n\\n`;\n\n// Client Information Section\nreportContent += `## Client Information\\n\\n`;\nreportContent += `**Client Name:** ${analysisData.clientName || 'Not specified'}\\n\\n`;\nreportContent += `**Industry:** ${analysisData.industry || 'Not specified'}\\n\\n`;\nreportContent += `**Project Type:** ${analysisData.projectType || 'Not specified'}\\n\\n`;\n\n// Target Audience Section\nif (analysisData.targetAudience) {\n  reportContent += `## Target Audience\\n\\n`;\n  reportContent += `${analysisData.targetAudience}\\n\\n`;\n}\n\n// Budget Section\nif (analysisData.budget) {\n  reportContent += `## Budget Information\\n\\n`;\n  reportContent += `${analysisData.budget}\\n\\n`;\n  if (researchData && researchData.budgetBenchmarks) {\n    reportContent += `**Industry Benchmarks:** ${researchData.budgetBenchmarks}\\n\\n`;\n  }\n}\n\n// Timeline Section\nif (analysisData.timeline) {\n  reportContent += `## Timeline & Deadlines\\n\\n`;\n  reportContent += `${analysisData.timeline}\\n\\n`;\n  if (researchData && researchData.timelineEstimates) {\n    reportContent += `**Industry Standards:** ${researchData.timelineEstimates}\\n\\n`;\n  }\n}\n\n// Client Needs Section\nreportContent += `## Client Needs\\n\\n`;\nif (analysisData.clientNeeds && analysisData.clientNeeds.length > 0) {\n  analysisData.clientNeeds.forEach(need => {\n    reportContent += `- ${need}\\n`;\n  });\n} else {\n  reportContent += `No specific client needs identified.\\n`;\n}\nreportContent += `\\n`;\n\n// Client Goals Section\nreportContent += `## Client Goals\\n\\n`;\nif (analysisData.clientGoals && analysisData.clientGoals.length > 0) {\n  analysisData.clientGoals.forEach(goal => {\n    reportContent += `- ${goal}\\n`;\n  });\n} else {\n  reportContent += `No specific client goals identified.\\n`;\n}\nreportContent += `\\n`;\n\n// Challenges Section\nreportContent += `## Challenges & Obstacles\\n\\n`;\nif (analysisData.challenges && analysisData.challenges.length > 0) {\n  analysisData.challenges.forEach(challenge => {\n    reportContent += `- ${challenge}\\n`;\n  });\n} else {\n  reportContent += `No significant challenges identified.\\n`;\n}\nreportContent += `\\n`;\n\n// Risks Section\nif (analysisData.risks && analysisData.risks.length > 0) {\n  reportContent += `## Risk Assessment\\n\\n`;\n  analysisData.risks.forEach(risk => {\n    reportContent += `- ${risk}\\n`;\n  });\n  reportContent += `\\n`;\n}\n\n// Industry Research Section\nif (researchData) {\n  reportContent += `## Industry Research & Market Analysis\\n\\n`;\n  \n  // Industry Trends\n  if (researchData.industryTrends && researchData.industryTrends.length > 0) {\n    reportContent += `### Current Industry Trends\\n\\n`;\n    researchData.industryTrends.forEach(trend => {\n      reportContent += `- ${trend}\\n`;\n    });\n    reportContent += `\\n`;\n  }\n  \n  // Competitor Insights\n  if (researchData.competitorInsights && researchData.competitorInsights.length > 0) {\n    reportContent += `### Competitor Insights\\n\\n`;\n    researchData.competitorInsights.forEach(insight => {\n      reportContent += `- ${insight}\\n`;\n    });\n    reportContent += `\\n`;\n  }\n  \n  // Market Opportunities\n  if (researchData.marketOpportunities && researchData.marketOpportunities.length > 0) {\n    reportContent += `### Market Opportunities\\n\\n`;\n    researchData.marketOpportunities.forEach(opportunity => {\n      reportContent += `- ${opportunity}\\n`;\n    });\n    reportContent += `\\n`;\n  }\n  \n  // Best Practices\n  if (researchData.bestPractices && researchData.bestPractices.length > 0) {\n    reportContent += `### Industry Best Practices\\n\\n`;\n    researchData.bestPractices.forEach(practice => {\n      reportContent += `- ${practice}\\n`;\n    });\n    reportContent += `\\n`;\n  }\n  \n  // Technological Factors\n  if (researchData.technologicalFactors && researchData.technologicalFactors.length > 0) {\n    reportContent += `### Technological Considerations\\n\\n`;\n    researchData.technologicalFactors.forEach(factor => {\n      reportContent += `- ${factor}\\n`;\n    });\n    reportContent += `\\n`;\n  }\n  \n  // Regulatory Considerations\n  if (researchData.regulatoryConsiderations && researchData.regulatoryConsiderations.length > 0) {\n    reportContent += `### Regulatory & Compliance Considerations\\n\\n`;\n    researchData.regulatoryConsiderations.forEach(consideration => {\n      reportContent += `- ${consideration}\\n`;\n    });\n    reportContent += `\\n`;\n  }\n}\n\n// Strategic Recommendations Section\nreportContent += `## Strategic Recommendations\\n\\n`;\nif (analysisData.recommendations && analysisData.recommendations.length > 0) {\n  analysisData.recommendations.forEach((rec, index) => {\n    reportContent += `${index + 1}. ${rec}\\n`;\n  });\n} else {\n  reportContent += `No specific recommendations at this time.\\n`;\n}\nreportContent += `\\n`;\n\n// Key Questions Section\nif (analysisData.keyQuestions && analysisData.keyQuestions.length > 0) {\n  reportContent += `## Key Questions for Client Clarification\\n\\n`;\n  analysisData.keyQuestions.forEach((question, index) => {\n    reportContent += `${index + 1}. ${question}\\n`;\n  });\n  reportContent += `\\n`;\n}\n\n// Calculate statistics\nconst stats = {\n  needsCount: (analysisData.clientNeeds && analysisData.clientNeeds.length) || 0,\n  goalsCount: (analysisData.clientGoals && analysisData.clientGoals.length) || 0,\n  challengesCount: (analysisData.challenges && analysisData.challenges.length) || 0,\n  risksCount: (analysisData.risks && analysisData.risks.length) || 0,\n  recommendationsCount: (analysisData.recommendations && analysisData.recommendations.length) || 0,\n  questionsCount: (analysisData.keyQuestions && analysisData.keyQuestions.length) || 0,\n  trendsCount: (researchData && researchData.industryTrends && researchData.industryTrends.length) || 0\n};\n\n// Footer\nreportContent += `---\\n\\n`;\nreportContent += `*This comprehensive report was automatically generated by the AI-powered Client Brief Analysis workflow.*\\n`;\nreportContent += `*Powered by Groq AI \u2022 Google Drive \u2022 n8n Automation*\\n`;\n\nreturn {\n  json: {\n    reportContent: reportContent,\n    originalFileName: $('New File in Client Briefs Folder').item.json.name,\n    analysisDate: new Date().toISOString(),\n    briefAnalysis: analysisData,\n    industryResearch: researchData,\n    stats: stats\n  }\n};"
      },
      "typeVersion": 2
    },
    {
      "id": "a2c393ff-2da9-4d77-b3b8-224cf9f4f10c",
      "name": "Log to Tracking Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        8784,
        2432
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $now.toFormat('yyyy-MM-dd HH:mm') }}",
            "Status": "Completed",
            "Doc URL": "={{ $('Create Google Doc Report').item.json.documentUrl }}",
            "Industry": "={{ $json.briefAnalysis.industry }}",
            "File Name": "={{ $('New File in Client Briefs Folder').item.json.name }}",
            "Client Name": "={{ $json.briefAnalysis.clientName }}",
            "Goals Count": "={{ $json.stats.goalsCount }}",
            "Needs Count": "={{ $json.stats.needsCount }}",
            "Project Type": "={{ $json.briefAnalysis.projectType }}",
            "Challenges Count": "={{ $json.stats.challengesCount }}",
            "Recommendations Count": "={{ $json.stats.recommendationsCount }}"
          },
          "schema": [
            {
              "id": "Date",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "File Name",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "File Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Client Name",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Client Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Industry",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Industry",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Project Type",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Project Type",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Needs Count",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Needs Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Goals Count",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Goals Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Challenges Count",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Challenges Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Recommendations Count",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Recommendations Count",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Doc URL",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Doc URL",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Date"
          ]
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "name",
          "value": "Brief Analysis Log"
        },
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Workflow Configuration').item.json.trackingSheetId }}"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "826927fc-7dd9-471a-a51e-8ac974b07009",
      "name": "Check Extraction Success",
      "type": "n8n-nodes-base.if",
      "position": [
        6752,
        2432
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.text }}"
            },
            {
              "id": "id-2",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ $json.text.length }}",
              "rightValue": "50"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "0468b9c1-c4b0-4c7c-bd6e-1d8ebf56e1c1",
      "name": "Send Error Notification",
      "type": "n8n-nodes-base.gmail",
      "position": [
        7008,
        2544
      ],
      "parameters": {
        "sendTo": "={{ $('Workflow Configuration').item.json.errorNotificationEmail }}",
        "message": "=<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;\">\n  <h2 style=\"color: #dc2626;\">\u26a0\ufe0f Client Brief Analysis Error</h2>\n  \n  <div style=\"background-color: #fee2e2; padding: 20px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #dc2626;\">\n    <h3 style=\"margin-top: 0; color: #991b1b;\">Text Extraction Failed</h3>\n    <p><strong>File:</strong> {{ $('New File in Client Briefs Folder').item.json.name }}</p>\n    <p><strong>File Type:</strong> {{ $('New File in Client Briefs Folder').item.json.mimeType }}</p>\n    <p><strong>Time:</strong> {{ $now.toFormat(\"MMMM dd, yyyy HH:mm\") }}</p>\n  </div>\n\n  <div style=\"background-color: #fff; padding: 20px; border: 2px solid #e5e7eb; border-radius: 8px; margin: 20px 0;\">\n    <h3 style=\"margin-top: 0;\">\ud83d\udd0d Possible Causes</h3>\n    <ul style=\"line-height: 1.8;\">\n      <li>The file may be a scanned image (requires OCR)</li>\n      <li>The file may be corrupted or password-protected</li>\n      <li>The file format may not be supported</li>\n      <li>The file may be empty or contain only images</li>\n    </ul>\n  </div>\n\n  <div style=\"background-color: #fef3c7; padding: 15px; border-radius: 8px; margin: 20px 0; border-left: 4px solid #f59e0b;\">\n    <h4 style=\"margin-top: 0; color: #d97706;\">\ud83d\udccb Required Actions</h4>\n    <ol style=\"line-height: 1.8;\">\n      <li>Check the original file in Google Drive</li>\n      <li>Verify the file is not corrupted</li>\n      <li>If scanned, consider using OCR preprocessing</li>\n      <li>Re-upload the file or provide an alternative format</li>\n    </ol>\n  </div>\n\n  <hr style=\"border: none; border-top: 1px solid #e5e7eb; margin: 30px 0;\">\n  \n  <p style=\"color: #6b7280; font-size: 12px; text-align: center;\">\n    <em>Automated error notification from Client Brief Analyzer workflow</em>\n  </p>\n</div>",
        "options": {},
        "subject": "=\u26a0\ufe0f Client Brief Analysis Failed: {{ $('New File in Client Briefs Folder').item.json.name }}"
      },
      "typeVersion": 2.2
    },
    {
      "id": "3192d63e-e56f-4f35-902f-384c954c3f42",
      "name": "SerpAPI Google Search",
      "type": "@n8n/n8n-nodes-langchain.toolSerpApi",
      "position": [
        7984,
        2928
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "40b04520-7c13-48da-9fdf-3e9028978cc3",
      "name": "Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        6224,
        1360
      ],
      "parameters": {
        "width": 888,
        "height": 620,
        "content": "## Auto Client Brief Analyzer\n\n### How it works\nThis workflow automatically analyzes client brief documents uploaded to Google Drive. When a new file is detected, it extracts text, performs deep AI-powered analysis using Groq, conducts industry research, generates a comprehensive Google Doc report, logs to a tracking sheet, and notifies the account manager via email.\n\n### Setup steps\n1. Create a Groq API account at console.groq.com\n2. Set up Google Drive folders:\n   - **Client Briefs folder**: Where clients upload documents\n   - **Client Summaries folder**: Where reports are saved\n3. Create a Google Sheet with **\"Brief Analysis Log\"** tab containing columns:\n   `Date | File Name | Client Name | Industry | Project Type | Needs Count | Goals Count | Challenges Count | Recommendations Count | Doc URL | Status`\n4. Configure the **Workflow Configuration** node with:\n   - Folder IDs (Briefs & Summaries)\n   - Manager email address\n   - Tracking sheet ID\n   - Error notification email\n5. Connect your credentials:\n   - Google (Drive, Docs, Sheets, Gmail)\n   - Groq API\n   - SerpAPI (optional, for research)\n6. Activate the workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "914d8dbb-914e-4bbe-affc-9e136d8e76dc",
      "name": "Stage 1: Input & Preparation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5808,
        2016
      ],
      "parameters": {
        "color": 4,
        "width": 1448,
        "height": 876,
        "content": "## \ud83d\udce5 1. Input & Preparation\n\n**Nodes:** Google Drive Trigger \u2192 Workflow Configuration \u2192 Check File Type \u2192 Extract Text (PDF/DOCX/TXT) \u2192 Check Extraction Success\n\n**Description:**\nThis stage handles the initial input and document preparation:\n\n\u2022 **Google Drive Trigger** monitors a specific folder every 5 minutes for new client brief uploads\n\u2022 **Workflow Configuration** stores all settings (folder IDs, emails, sheet ID) in one place for easy maintenance\n\u2022 **Check File Type** routes documents based on MIME type (PDF vs DOCX/TXT)\n\u2022 **Extract Text** nodes pull text content from binary files using appropriate extractors\n\u2022 **Validation** ensures extracted text is not empty and has minimum 50 characters\n\n**Supported Formats:** PDF, DOCX, TXT\n**Error Path:** Failed extractions trigger email notification with troubleshooting steps"
      },
      "typeVersion": 1
    },
    {
      "id": "e1a10ca1-f1a6-4198-a208-b60aa1b34297",
      "name": "Stage 2: AI Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        7280,
        1840
      ],
      "parameters": {
        "color": 5,
        "width": 984,
        "height": 1316,
        "content": "## \ud83e\udd16 2. AI Processing & Research\n\n**Nodes:** Analyze Client Brief \u2192 Deep Industry Research \u2192 Merge Node\n\n**Description:**\nThe core intelligence layer of this workflow:\n\n\u2022 **Analyze Client Brief** uses Groq Llama 3.3 70B to perform deep strategic analysis:\n  - Executive summary & client information\n  - Client needs, goals & target audience\n  - Budget & timeline extraction\n  - Challenges, risks & recommendations\n  - Key questions for clarification\n\n\u2022 **Deep Industry Research** conducts market research using:\n  - SerpAPI for Google Search results\n  - Wikipedia for reference data\n  - Analysis of trends, competitors & best practices\n\n\u2022 **Merge Node** combines both AI outputs into unified data structure\n\n**AI Model:** Groq Llama 3.3 70B Versatile\n**Output Format:** Structured JSON with defined schema"
      },
      "typeVersion": 1
    },
    {
      "id": "f134a951-9dfd-467c-b7f8-e733ff238c9b",
      "name": "Stage 3: Output & Delivery",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        8288,
        1840
      ],
      "parameters": {
        "color": 6,
        "width": 1000,
        "height": 808,
        "content": "## \ud83d\udce4 3. Output & Delivery\n\n**Nodes:** Generate Report (Code) \u2192 Create Google Doc \u2192 Log to Sheets \u2192 Send Email\n\n**Description:**\nFinal stage transforms AI insights into actionable deliverables:\n\n\u2022 **Generate Comprehensive Report** (JavaScript) formats all data into structured markdown with:\n  - Executive summary & client info\n  - Detailed needs, goals & challenges\n  - Industry research findings\n  - Strategic recommendations\n  - Statistics & metrics\n\n\u2022 **Create Google Doc** saves the formatted report to the Client Summaries folder\n\n\u2022 **Log to Tracking Sheet** records analysis metadata:\n  - Date, filename, client info\n  - Analysis stats & document URL\n  - Processing status\n\n\u2022 **Send Email** delivers professional HTML notification to account manager with summary & report link\n\n**Output:** Google Doc report + Sheet log + Email notification"
      },
      "typeVersion": 1
    },
    {
      "id": "7451900d-4330-4e1b-9fa6-2cfdc6d0d3f1",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5824,
        1360
      ],
      "parameters": {
        "color": 6,
        "width": 368,
        "height": 616,
        "content": "## Author\n![Digimetalab](https://gravatar.com/avatar/8238cf8143845ac216cad8b70057892b?size=256?r=pg&d=retro&size=100)\n## Digimetalab\nAutomation consultant from Bali, with 3+ years helping Sales & Marketing streamline processes. We offer custom n8n solutions to boost efficiency. Book an initial consultation via our link for tailored automation.\n\nFor business inquiries, email we at digimetalab@gmail.com\nOr message me on [Telegram](https://t.me/digimetalab) for a faster response.\n\n### Check out my other templates\n### \ud83d\udc49 https://n8n.io/creators/digimetalab/\n"
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Check File Type": {
      "main": [
        [
          {
            "node": "Extract Text from PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract Text from DOCX",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Text from TXT",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Analyze Client Brief",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Groq Research Model": {
      "ai_languageModel": [
        [
          {
            "node": "Deep Industry Research",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Analyze Client Brief": {
      "main": [
        [
          {
            "node": "Deep Industry Research",
            "type": "main",
            "index": 0
          },
          {
            "node": "Combine Analysis and Research",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from PDF": {
      "main": [
        [
          {
            "node": "Check Extraction Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from TXT": {
      "main": [
        [
          {
            "node": "Check Extraction Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Log to Tracking Sheet": {
      "main": [
        [
          {
            "node": "Send Email to Account Manager",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SerpAPI Google Search": {
      "ai_tool": [
        [
          {
            "node": "Deep Industry Research",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Deep Industry Research": {
      "main": [
        [
          {
            "node": "Combine Analysis and Research",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Extract Text from DOCX": {
      "main": [
        [
          {
            "node": "Check Extraction Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Deep Industry Research",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Check File Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia Research Tool": {
      "ai_tool": [
        [
          {
            "node": "Deep Industry Research",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Check Extraction Success": {
      "main": [
        [
          {
            "node": "Analyze Client Brief",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Error Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Google Doc Report": {
      "main": [
        [
          {
            "node": "Log to Tracking Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Analyze Client Brief",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Combine Analysis and Research": {
      "main": [
        [
          {
            "node": "Generate Comprehensive Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Comprehensive Report": {
      "main": [
        [
          {
            "node": "Create Google Doc Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New File in Client Briefs Folder": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}