AutomationFlowsWeb Scraping › Fechamento Mensal - Automação

Fechamento Mensal - Automação

Fechamento Mensal - Automação. Uses httpRequest, emailSend. Scheduled trigger; 6 nodes.

Cron / scheduled trigger★★☆☆☆ complexity6 nodesHTTP RequestEmail Send
Web Scraping Trigger: Cron / scheduled Nodes: 6 Complexity: ★★☆☆☆ Added:

This workflow follows the Emailsend → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Fechamento Mensal - Automa\u00e7\u00e3o ",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 0 1 * *"
            }
          ]
        }
      },
      "id": "schedule-trigger",
      "name": "Schedule Trigger - Todo dia 1\u00ba do m\u00eas",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1,
      "position": [
        250,
        300
      ],
      "notes": "Executa todo dia 1\u00ba do m\u00eas \u00e0s 00:00 para processar o fechamento do m\u00eas anterior"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "http://app:8000/run",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={ \"month\": \"{{ $now.minus({months: 1}).toFormat('yyyy-MM') }}\" }",
        "options": {
          "timeout": 600000
        }
      },
      "id": "execute-python",
      "name": "Execute Python Script",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        450,
        300
      ],
      "notes": "Chama API HTTP do container da aplica\u00e7\u00e3o para executar o fechamento"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "success-check",
              "leftValue": "={{ $json.exitCode }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "check-success",
      "name": "Check Success",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        650,
        300
      ],
      "notes": "Verifica se o processamento foi bem-sucedido (exitCode = 0)"
    },
    {
      "parameters": {
        "fromEmail": "automacao@company.com",
        "toEmail": "equipe@company.com",
        "subject": "\u2705 Fechamento Mensal {{ $now.minus({months: 1}).toFormat('MM/yyyy') }} - Conclu\u00eddo",
        "emailType": "html",
        "message": "=<h2>\u2705 Fechamento Mensal Conclu\u00eddo com Sucesso</h2>\n<p><strong>M\u00eas de Refer\u00eancia:</strong> {{ $now.minus({months: 1}).toFormat('MMMM/yyyy') }}</p>\n<p><strong>Executado em:</strong> {{ $now.toFormat('dd/MM/yyyy HH:mm:ss') }}</p>\n\n<h3>\ud83d\udcca Relat\u00f3rios Gerados:</h3>\n<ul>\n  <li>\u2705 Relat\u00f3rio Financeiro (relatorio_financeiro.csv)</li>\n  <li>\u2705 Relat\u00f3rio de Qualidade (relatorio_qualidade.csv)</li>\n  <li>\u2705 Relat\u00f3rio de Ocupa\u00e7\u00e3o (relatorio_ocupacao.csv)</li>\n  <li>\u2705 Feedbacks Classificados por IA (feedbacks_classificados.csv)</li>\n  <li>\u2705 Resumo Executivo com IA (resumo_executivo.txt)</li>\n  <li>\u2705 Insights de IA por Propriedade (insights_ia.csv)</li>\n</ul>\n\n<h3>\ud83d\udccb Log de Execu\u00e7\u00e3o:</h3>\n<pre style=\"background: #f5f5f5; padding: 10px; border-left: 3px solid #4caf50;\">{{ $node[\"Execute Python Script\"].json[\"stdout\"] }}</pre>\n\n<p><em>Todos os relat\u00f3rios est\u00e3o dispon\u00edveis em: <code>src/output/</code></em></p>\n<p><em>Banco de dados atualizado: <code>src/data/database.sqlite</code></em></p>",
        "options": {}
      },
      "id": "email-success",
      "name": "Send Success Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        850,
        200
      ],
      "notes": "Envia email de sucesso com resumo da execu\u00e7\u00e3o"
    },
    {
      "parameters": {
        "fromEmail": "automacao@company.com",
        "toEmail": "ti@company.com,operacoes@company.com",
        "subject": "\u274c ERRO - Fechamento Mensal {{ $now.minus({months: 1}).toFormat('MM/yyyy') }}",
        "emailType": "html",
        "message": "=<h2 style=\"color: #d32f2f;\">\u274c Erro no Fechamento Mensal</h2>\n<p><strong>M\u00eas de Refer\u00eancia:</strong> {{ $now.minus({months: 1}).toFormat('MMMM/yyyy') }}</p>\n<p><strong>Tentativa em:</strong> {{ $now.toFormat('dd/MM/yyyy HH:mm:ss') }}</p>\n\n<h3>\ud83d\udd34 Detalhes do Erro:</h3>\n<pre style=\"background: #ffebee; padding: 10px; border-left: 4px solid #d32f2f; color: #c62828;\">{{ $node[\"Execute Python Script\"].json[\"stderr\"] }}</pre>\n\n<h3>\ud83d\udccb Output do Sistema:</h3>\n<pre style=\"background: #f5f5f5; padding: 10px;\">{{ $node[\"Execute Python Script\"].json[\"stdout\"] }}</pre>\n\n<h3>\u26a0\ufe0f A\u00e7\u00e3o Necess\u00e1ria:</h3>\n<ul>\n  <li>Verifique o log completo em: <code>src/output/run.log</code></li>\n  <li>Verifique o banco de dados: <code>src/data/database.sqlite</code></li>\n  <li>Corrija o problema e execute manualmente: <code>python main.py --month={{ $now.minus({months: 1}).toFormat('yyyy-MM') }}</code></li>\n  <li>Se necess\u00e1rio, contate a equipe de desenvolvimento</li>\n</ul>\n\n<p><strong>Exit Code:</strong> {{ $node[\"Execute Python Script\"].json[\"exitCode\"] }}</p>",
        "options": {}
      },
      "id": "email-error",
      "name": "Send Error Email",
      "type": "n8n-nodes-base.emailSend",
      "typeVersion": 2.1,
      "position": [
        850,
        400
      ],
      "notes": "Envia email de erro detalhado para TI e Opera\u00e7\u00f5es"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $env.SLACK_WEBHOOK_URL }}",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"text\": \"\ud83d\udea8 *ERRO no Fechamento Mensal*\",\n  \"blocks\": [\n    {\n      \"type\": \"header\",\n      \"text\": {\n        \"type\": \"plain_text\",\n        \"text\": \"\ud83d\udea8 Erro no Fechamento Mensal\"\n      }\n    },\n    {\n      \"type\": \"section\",\n      \"fields\": [\n        {\n          \"type\": \"mrkdwn\",\n          \"text\": \"*M\u00eas:*\\n{{ $now.minus({months: 1}).toFormat('MM/yyyy') }}\"\n        },\n        {\n          \"type\": \"mrkdwn\",\n          \"text\": \"*Hor\u00e1rio:*\\n{{ $now.toFormat('dd/MM/yyyy HH:mm') }}\"\n        }\n      ]\n    },\n    {\n      \"type\": \"section\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": \"*Erro:*\\n```{{ $node[\\\"Execute Python Script\\\"].json[\\\"stderr\\\"] }}```\"\n      }\n    },\n    {\n      \"type\": \"context\",\n      \"elements\": [\n        {\n          \"type\": \"mrkdwn\",\n          \"text\": \"Exit Code: {{ $node[\\\"Execute Python Script\\\"].json[\\\"exitCode\\\"] }} | Verifique o log em `src/output/run.log`\"\n        }\n      ]\n    }\n  ]\n}",
        "options": {}
      },
      "id": "slack-alert",
      "name": "Send Slack Alert (OPCIONAL)",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        850,
        500
      ],
      "notes": "Envia alerta detalhado para o canal do Slack (Configure SLACK_WEBHOOK_URL nas vari\u00e1veis de ambiente)"
    }
  ],
  "connections": {
    "Schedule Trigger - Todo dia 1\u00ba do m\u00eas": {
      "main": [
        [
          {
            "node": "Execute Python Script",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Python Script": {
      "main": [
        [
          {
            "node": "Check Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Success": {
      "main": [
        [
          {
            "node": "Send Success Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Send Error Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    {
      "createdAt": "2025-11-05T00:00:00.000Z",
      "updatedAt": "2025-11-05T00:00:00.000Z",
      "id": "1",
      "name": "automacao"
    },
    {
      "createdAt": "2025-11-05T00:00:00.000Z",
      "updatedAt": "2025-11-05T00:00:00.000Z",
      "id": "2",
      "name": ""
    },
    {
      "createdAt": "2025-11-05T00:00:00.000Z",
      "updatedAt": "2025-11-05T00:00:00.000Z",
      "id": "3",
      "name": "fechamento-mensal"
    }
  ],
  "triggerCount": 1,
  "updatedAt": "2025-11-05T12:00:00.000Z",
  "versionId": "2"
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Fechamento Mensal - Automação. Uses httpRequest, emailSend. Scheduled trigger; 6 nodes.

Source: https://github.com/Gustavofrb/relatorio-mensal/blob/e99b64596f683cd94c0c5735d09a7e3c897e3db1/workflows/n8n_workflow.json — original creator credit. Request a take-down →

More Web Scraping workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Web Scraping

E-Décor - Support Client. Uses httpRequest, emailSend. Scheduled trigger; 5 nodes.

HTTP Request, Email Send
Web Scraping

CEO_MORNING_REPORT. Uses httpRequest, emailSend, twilioSms. Scheduled trigger; 4 nodes.

HTTP Request, Email Send, Twilio Sms
Web Scraping

29-fluxo-caixa-projecao-semanal. Uses httpRequest, emailSend. Scheduled trigger; 4 nodes.

HTTP Request, Email Send
Web Scraping

Workflow-Api-Health-Check. Uses httpRequest, emailSend. Scheduled trigger; 4 nodes.

HTTP Request, Email Send
Web Scraping

Meal Reminders. Uses httpRequest, emailSend. Scheduled trigger; 3 nodes.

HTTP Request, Email Send