{
  "id": "JUcvvX1RFdicRI8H",
  "name": "GPT-5.2-Pro SME Corporate Tax Filing and Compliance Automation",
  "tags": [],
  "nodes": [
    {
      "id": "740b4fca-3228-404d-acb4-73520ddf047d",
      "name": "Monthly Tax Filing Schedule",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -1808,
        -48
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "months",
              "triggerAtHour": 9
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "805baec3-d7f7-44cf-afe0-a5aab9b2b6e8",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        -1584,
        -48
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "accountingApiUrl",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Accounting Software API Endpoint URL__>"
            },
            {
              "id": "id-2",
              "name": "accountingApiKey",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Accounting Software API Key__>"
            },
            {
              "id": "id-3",
              "name": "taxAgentEmail",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Tax Agent Email Address__>"
            },
            {
              "id": "id-4",
              "name": "complianceVaultFolderId",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Google Drive Compliance Vault Folder ID__>"
            },
            {
              "id": "id-5",
              "name": "taxRate",
              "type": "number",
              "value": 0.21
            },
            {
              "id": "id-6",
              "name": "standardDeductions",
              "type": "number",
              "value": 5000
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "b01407a9-9976-4f92-a122-1755d12c1e02",
      "name": "Tax Calculation Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1088,
        -48
      ],
      "parameters": {
        "text": "={{ 'Financial data for tax calculation: ' + JSON.stringify($json) }}",
        "options": {
          "systemMessage": "You are a corporate tax calculation assistant for SMEs.\n\nYour task is to:\n1. Analyze the monthly financial data provided (revenue, expenses, cost of goods sold)\n2. Calculate the gross profit (revenue - cost of goods sold)\n3. Calculate the net profit (gross profit - operating expenses)\n4. Determine taxable income by applying standard deductions\n5. Calculate the tax liability using the applicable tax rate\n6. Use the Calculator tool for all arithmetic operations\n7. Return the results in the structured format defined by the output parser\n\nBe precise with calculations and show your work step by step."
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 3.1
    },
    {
      "id": "5f3cdf95-50cd-4387-98d2-d3d340ffb96b",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -1136,
        176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5.2-pro",
          "cachedResultName": "gpt-5.2-pro"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "a5fdb56c-396d-4037-8747-f364893e01ad",
      "name": "Calculator Tool",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        -1008,
        176
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "1377b25c-9e22-41db-944b-eed2d83c0eda",
      "name": "Tax Report Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -880,
        176
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"grossProfit\": {\"type\": \"number\"},\n    \"netProfit\": {\"type\": \"number\"},\n    \"taxableIncome\": {\"type\": \"number\"},\n    \"taxLiability\": {\"type\": \"number\"},\n    \"effectiveTaxRate\": {\"type\": \"number\"},\n    \"calculationSteps\": {\"type\": \"string\"}\n  },\n  \"required\": [\"grossProfit\", \"netProfit\", \"taxableIncome\", \"taxLiability\", \"effectiveTaxRate\", \"calculationSteps\"]\n}"
      },
      "typeVersion": 1.3
    },
    {
      "id": "1d6a99f1-a64b-4c63-928a-602c997ec3f7",
      "name": "Format Pre-Filing Report",
      "type": "n8n-nodes-base.set",
      "position": [
        -672,
        -96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "reportTitle",
              "type": "string",
              "value": "={{ 'Corporate Tax Pre-Filing Report - ' + $now.format('MMMM yyyy') }}"
            },
            {
              "id": "id-2",
              "name": "companyName",
              "type": "string",
              "value": "<__PLACEHOLDER_VALUE__Company Name__>"
            },
            {
              "id": "id-3",
              "name": "reportDate",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "id-4",
              "name": "reportSummary",
              "type": "string",
              "value": "={{ 'Gross Profit: $' + $json.grossProfit + '\\nNet Profit: $' + $json.netProfit + '\\nTaxable Income: $' + $json.taxableIncome + '\\nTax Liability: $' + $json.taxLiability + '\\nEffective Tax Rate: ' + ($json.effectiveTaxRate * 100) + '%' }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "c5c5e407-db06-4558-835a-f38c8c29cd61",
      "name": "Gmail Send Tool",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        -320,
        128
      ],
      "parameters": {
        "sendTo": "={{ $fromAI('recipient_email') }}",
        "message": "={{ $fromAI('email_body') }}",
        "options": {},
        "subject": "={{ $fromAI('email_subject') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "3070253b-eaab-4bd9-a589-493dec337579",
      "name": "Google Drive Archive Tool",
      "type": "n8n-nodes-base.googleDriveTool",
      "position": [
        -192,
        128
      ],
      "parameters": {
        "name": "={{ $fromAI('file_name') }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $fromAI('folder_id') }}"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "aeb85643-7a75-4306-94f8-c5ee042e4335",
      "name": "Submission Coordinator Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -400,
        -96
      ],
      "parameters": {
        "text": "={{ 'Tax report data: ' + JSON.stringify($json) }}",
        "options": {
          "systemMessage": "You are a tax filing submission coordinator for SMEs.\n\nYour task is to:\n1. Send the pre-filing tax report to the tax agent via email using the Gmail Send Tool\n   - Recipient: Use the taxAgentEmail from the workflow data\n   - Subject: \"Monthly Tax Pre-Filing Report - [Company Name] - [Month Year]\"\n   - Body: Include the report summary and all calculation details in a professional format\n2. Archive the report in the compliance vault using the Google Drive Archive Tool\n   - File name: \"Tax_Report_[Company]_[YYYY-MM].json\"\n   - Folder ID: Use the complianceVaultFolderId from the workflow data\n   - Content: Full JSON report with all tax calculations\n3. Confirm both actions were completed successfully\n\nUse the tools to execute these tasks and report the results."
        },
        "promptType": "define"
      },
      "typeVersion": 3.1
    },
    {
      "id": "284298ac-f243-463c-baff-79595e81c769",
      "name": "OpenAI Chat Model for Coordinator",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -448,
        128
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5.2-pro",
          "cachedResultName": "gpt-5.2-pro"
        },
        "options": {},
        "builtInTools": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "fc669dba-7b4d-451d-9d62-3b34ebc8af02",
      "name": "Check for Feedback",
      "type": "n8n-nodes-base.if",
      "position": [
        16,
        -96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "id-1",
              "operator": {
                "type": "boolean",
                "operation": "true"
              },
              "leftValue": "={{ $json.feedbackReceived }}"
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "7d10ecfd-5e01-4649-9a5a-f7be2f7ed3e3",
      "name": "Process Feedback and Corrections",
      "type": "n8n-nodes-base.code",
      "position": [
        240,
        -96
      ],
      "parameters": {
        "jsCode": "// Process feedback and corrections from tax agent\n// This node would typically parse email responses or form submissions\n// For now, it extracts correction data and prepares it for recalculation\n\nconst items = $input.all();\nconst processedItems = [];\n\nfor (const item of items) {\n  // Extract feedback data (placeholder logic)\n  const feedback = item.json.feedback || 'No specific feedback';\n  const corrections = item.json.corrections || {};\n  \n  // Merge corrections with original financial data\n  const updatedData = {\n    ...item.json,\n    correctionApplied: true,\n    feedbackNotes: feedback,\n    ...corrections\n  };\n  \n  processedItems.push({\n    json: updatedData\n  });\n}\n\nreturn processedItems;"
      },
      "typeVersion": 2
    },
    {
      "id": "405ceb2c-20e5-4a98-bbcf-87912424acec",
      "name": "Finalize Submission Data",
      "type": "n8n-nodes-base.set",
      "position": [
        240,
        96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "id-1",
              "name": "submissionStatus",
              "type": "string",
              "value": "Finalized"
            },
            {
              "id": "id-2",
              "name": "finalizedDate",
              "type": "string",
              "value": "={{ $now.toISO() }}"
            },
            {
              "id": "id-3",
              "name": "submittedBy",
              "type": "string",
              "value": "Automated Tax Filing System"
            },
            {
              "id": "id-4",
              "name": "archiveConfirmation",
              "type": "string",
              "value": "Report archived in compliance vault"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "a5874508-8b18-4823-9b28-1b4e0818dc41",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        -512
      ],
      "parameters": {
        "color": 5,
        "width": 624,
        "height": 288,
        "content": "## Prerequisites\nAccounting system access; OpenAI API key; Gmail account; Google Drive\n## Use Cases\nTax firms managing multi-client monthly filings with partner review  \n## Customization\nModify tax calculation prompts for jurisdictions, adjust feedback collection fields \n## Benefits\nEliminates manual filing coordination, reduces submission errors"
      },
      "typeVersion": 1
    },
    {
      "id": "c4e3ec14-0ad6-4d49-9201-0e5589f27ede",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        -464
      ],
      "parameters": {
        "width": 368,
        "height": 208,
        "content": "## Setup Steps\n1. Connect accounting system and configure financial data fetch parameters.\n2. Set up OpenAI GPT-5 API for tax calculations and reasoning extraction.\n3. Configure Gmail, Chat Model, and Google Drive credentials.\n4. Define submission coordinator contacts and configure feedback."
      },
      "typeVersion": 1
    },
    {
      "id": "9dd542bc-45f5-4272-b7a4-034342afc316",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1856,
        -480
      ],
      "parameters": {
        "width": 608,
        "height": 256,
        "content": "## How It Works\nThis workflow automates monthly tax filing processes by retrieving financial data, performing AI-driven tax calculations, coordinating pre-filing reviews with key stakeholders, incorporating feedback, and managing overall submission readiness. It pulls accounting records, executes GPT-5\u2013based tax calculations with transparent reasoning, formats comprehensive pre-filing reports, and routes them to a submission coordinator via email for review. The system captures reviewer feedback through structured prompts, intelligently applies necessary corrections, archives finalized records in Google Drive, and continuously tracks filing status. It is designed for accounting firms, tax practices, and finance departments that require coordinated, multi-stakeholder tax filing with minimal manual intervention."
      },
      "typeVersion": 1
    },
    {
      "id": "ca98a233-8e1e-4f60-8307-8e15557bcc6b",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -512,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 944,
        "height": 576,
        "content": "## Incorporate Feedback &  Stores Finalized Submission\nWhat: Captures coordinator feedback\nWhy: Ensures filing accuracy through collaborative review and maintains compliance"
      },
      "typeVersion": 1
    },
    {
      "id": "29d0fead-915f-4881-97ce-050e4f8fd88f",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 656,
        "height": 576,
        "content": "## Calculate Tax Obligations\nWhat: Applies GPT-5 tax calculation with structured reasoning and detailed logic explanation.\nWhy: Delivers accurate, explainable tax figures with documented methodology.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bfc1209a-0842-4411-8683-51ac269467b6",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1872,
        -192
      ],
      "parameters": {
        "color": 7,
        "width": 672,
        "height": 496,
        "content": "## Fetch Financial Data\nWhat: Retrieves accounting records and financial statements from source systems.\nWhy: Ensures tax calculations are based on current.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "927309a5-4ea1-47fd-a0b3-bb3af2bcf160",
      "name": "Fetch Financial Data from Accounting Software",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -1360,
        -48
      ],
      "parameters": {
        "url": "={{ $('Workflow Configuration').first().json.accountingApiUrl }}",
        "options": {
          "response": {
            "response": {
              "responseFormat": "json"
            }
          }
        },
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "={{ 'Bearer ' + $('Workflow Configuration').first().json.accountingApiKey }}"
            }
          ]
        }
      },
      "typeVersion": 4.3
    }
  ],
  "active": false,
  "settings": {
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "8621df17-8a9e-4d92-a83b-1a6632c9cfb1",
  "connections": {
    "Calculator Tool": {
      "ai_tool": [
        [
          {
            "node": "Tax Calculation Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Send Tool": {
      "ai_tool": [
        [
          {
            "node": "Submission Coordinator Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Tax Calculation Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Check for Feedback": {
      "main": [
        [
          {
            "node": "Process Feedback and Corrections",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Finalize Submission Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tax Calculation Agent": {
      "main": [
        [
          {
            "node": "Format Pre-Filing Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Fetch Financial Data from Accounting Software",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Pre-Filing Report": {
      "main": [
        [
          {
            "node": "Submission Coordinator Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Tax Report Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Tax Calculation Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Archive Tool": {
      "ai_tool": [
        [
          {
            "node": "Submission Coordinator Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Monthly Tax Filing Schedule": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Submission Coordinator Agent": {
      "main": [
        [
          {
            "node": "Check for Feedback",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Feedback and Corrections": {
      "main": [
        [
          {
            "node": "Tax Calculation Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model for Coordinator": {
      "ai_languageModel": [
        [
          {
            "node": "Submission Coordinator Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Financial Data from Accounting Software": {
      "main": [
        [
          {
            "node": "Tax Calculation Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}