AutomationFlowsWeb Scraping › Análise Automática De Cnis

Análise Automática De Cnis

Análise Automática de CNIS. Uses googleDriveTrigger, googleDrive, httpRequest. Event-driven trigger; 10 nodes.

Event trigger★★★★☆ complexity10 nodesGoogle Drive TriggerGoogle DriveHTTP Request
Web Scraping Trigger: Event Nodes: 10 Complexity: ★★★★☆ Added:

This workflow follows the Google Drive → Google Drive Trigger 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": "An\u00e1lise Autom\u00e1tica de CNIS",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute",
              "value": 5
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": "={{ $env.GOOGLE_DRIVE_FOLDER_CNIS }}",
        "event": "fileCreated",
        "options": {}
      },
      "id": "trigger-google-drive",
      "name": "Trigger - Novo CNIS no Drive",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "typeVersion": 1,
      "position": [
        260,
        300
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {}
      },
      "id": "download-pdf",
      "name": "Download PDF do CNIS",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        480,
        300
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $env.API_CNIS_URL }}/analisar-cnis",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "X-API-Key",
              "value": "={{ $env.API_CNIS_KEY }}"
            }
          ]
        },
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "parameterType": "formBinaryData",
              "name": "file",
              "inputDataFieldName": "data"
            }
          ]
        },
        "options": {
          "timeout": 60000,
          "fullResponse": false
        }
      },
      "id": "chamar-api-cnis",
      "name": "API - Analisar CNIS",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        700,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "check-sucesso",
              "leftValue": "={{ $json.sucesso }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "verificar-sucesso",
      "name": "Sucesso?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        920,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// Preparar PDF e DOCX como binary para upload no Google Drive\nconst data = $input.first().json;\nconst base64Pdf = data.relatorio_pdf_base64;\nconst base64Docx = data.relatorio_docx_base64;\nconst nomeArquivoPdf = data.nome_arquivo_pdf;\nconst nomeArquivoDocx = data.nome_arquivo_docx;\n\nconst result = {\n  json: {\n    nome_arquivo_pdf: nomeArquivoPdf,\n    nome_arquivo_docx: nomeArquivoDocx,\n    resumo: data.resumo,\n  },\n  binary: {},\n};\n\n// PDF\nif (base64Pdf) {\n  result.binary.pdf = {\n    data: base64Pdf,\n    mimeType: 'application/pdf',\n    fileName: nomeArquivoPdf,\n  };\n}\n\n// DOCX\nif (base64Docx) {\n  result.binary.docx = {\n    data: base64Docx,\n    mimeType: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n    fileName: nomeArquivoDocx,\n  };\n}\n\nreturn [result];"
      },
      "id": "preparar-arquivos",
      "name": "Preparar PDF + DOCX para Upload",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1140,
        200
      ]
    },
    {
      "parameters": {
        "operation": "upload",
        "name": "={{ $json.nome_arquivo_pdf }}",
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $env.GOOGLE_DRIVE_FOLDER_RELATORIOS }}"
        },
        "inputDataFieldName": "pdf",
        "options": {}
      },
      "id": "upload-pdf",
      "name": "Upload PDF no Drive",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1360,
        140
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "upload",
        "name": "={{ $('Preparar PDF + DOCX para Upload').item.json.nome_arquivo_docx }}",
        "folderId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $env.GOOGLE_DRIVE_FOLDER_RELATORIOS }}"
        },
        "inputDataFieldName": "docx",
        "options": {}
      },
      "id": "upload-docx",
      "name": "Upload DOCX no Drive",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1360,
        280
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://graph.facebook.com/v19.0/{{ $env.WHATSAPP_PHONE_NUMBER_ID }}/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $env.WHATSAPP_ACCESS_TOKEN }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"552799185544\",\n  \"type\": \"template\",\n  \"template\": {\n    \"name\": \"analise_cnis_concluida\",\n    \"language\": { \"code\": \"pt_BR\" },\n    \"components\": [\n      {\n        \"type\": \"body\",\n        \"parameters\": [\n          { \"type\": \"text\", \"text\": \"{{ $('Preparar PDF + DOCX para Upload').item.json.resumo.nome }}\" },\n          { \"type\": \"text\", \"text\": \"{{ $('Preparar PDF + DOCX para Upload').item.json.resumo.total_pendencias }}\" },\n          { \"type\": \"text\", \"text\": \"{{ $('Preparar PDF + DOCX para Upload').item.json.resumo.total_alertas }}\" }\n        ]\n      }\n    ]\n  }\n}",
        "options": {}
      },
      "id": "whatsapp-sucesso",
      "name": "WhatsApp - An\u00e1lise Conclu\u00edda",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1580,
        200
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://graph.facebook.com/v19.0/{{ $env.WHATSAPP_PHONE_NUMBER_ID }}/messages",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer {{ $env.WHATSAPP_ACCESS_TOKEN }}"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"messaging_product\": \"whatsapp\",\n  \"to\": \"552799185544\",\n  \"type\": \"template\",\n  \"template\": {\n    \"name\": \"analise_cnis_falha\",\n    \"language\": { \"code\": \"pt_BR\" },\n    \"components\": [\n      {\n        \"type\": \"body\",\n        \"parameters\": [\n          { \"type\": \"text\", \"text\": \"{{ $('Trigger - Novo CNIS no Drive').item.json.name }}\" },\n          { \"type\": \"text\", \"text\": \"{{ $('API - Analisar CNIS').item.json.erro || 'Erro desconhecido' }}\" }\n        ]\n      }\n    ]\n  }\n}",
        "options": {}
      },
      "id": "whatsapp-falha",
      "name": "WhatsApp - Falha na An\u00e1lise",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1360,
        450
      ]
    },
    {
      "parameters": {
        "operation": "move",
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $('Trigger - Novo CNIS no Drive').item.json.id }}"
        },
        "driveId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $env.GOOGLE_DRIVE_FOLDER_MANUAL }}"
        },
        "options": {}
      },
      "id": "mover-para-manual",
      "name": "Mover para An\u00e1lise Manual",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        1140,
        450
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Trigger - Novo CNIS no Drive": {
      "main": [
        [
          {
            "node": "Download PDF do CNIS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download PDF do CNIS": {
      "main": [
        [
          {
            "node": "API - Analisar CNIS",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "API - Analisar CNIS": {
      "main": [
        [
          {
            "node": "Sucesso?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sucesso?": {
      "main": [
        [
          {
            "node": "Preparar PDF + DOCX para Upload",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Mover para An\u00e1lise Manual",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Preparar PDF + DOCX para Upload": {
      "main": [
        [
          {
            "node": "Upload PDF no Drive",
            "type": "main",
            "index": 0
          },
          {
            "node": "Upload DOCX no Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload PDF no Drive": {
      "main": [
        [
          {
            "node": "WhatsApp - An\u00e1lise Conclu\u00edda",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mover para An\u00e1lise Manual": {
      "main": [
        [
          {
            "node": "WhatsApp - Falha na An\u00e1lise",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": ""
  },
  "staticData": null,
  "tags": [
    {
      "name": "CNIS",
      "id": "cnis-tag"
    },
    {
      "name": "Automa\u00e7\u00e3o",
      "id": "automacao-tag"
    }
  ],
  "versionId": "1"
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

Análise Automática de CNIS. Uses googleDriveTrigger, googleDrive, httpRequest. Event-driven trigger; 10 nodes.

Source: https://github.com/advtscardoso-bit/cnis-api/blob/1bf699585d97414d3fcfd1f7cf29324f3e0f11bc/workflow/workflow_analise_cnis.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

Automatically deploy n8n workflows by simply dropping JSON files into a Google Drive folder—this template watches for new exports, cleans and imports them into your n8n instance, applies a tag, and th

HTTP Request, Google Drive, Google Drive Trigger
Web Scraping

This n8n workflow simplifies the process of removing backgrounds from images stored in Google Drive. By leveraging the PhotoRoom API, this template enables automatic background removal, padding adjust

HTTP Request, Google Drive, Edit Image +1
Web Scraping

This template can be used to sync the files in your Google drive to a new or existing InfraNodus knowledge graph.

Google Drive, HTTP Request, Google Drive Trigger
Web Scraping

Stop wasting hours on video captioning. Upload your videos to a Google Drive folder, and ZapCap automatically generates professional subtitles for you. Download the finished video from your Google Dri

Google Drive Trigger, HTTP Request, Google Drive
Web Scraping

Save a .md file to the folder set in the triggers. This workflow will check every hour, convert the md file to HTML, and create a confluence page for it. If the md file is updated or changed in the fo

Google Drive Trigger, Google Drive, HTTP Request