{
  "name": "My workflow",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "3b0e8521-a2cf-4f57-a3fc-16bfdd0e6fdb",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -384,
        -80
      ],
      "id": "c77d578c-443b-4989-86ba-63a9562359b2",
      "name": "Webhook"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA",
          "mode": "list",
          "cachedResultName": "Leads Test AEG",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "P\u00e1gina1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Status": "={{ $json.Status }}",
            "Vendedor": "={{ $json.VendedorDesignado }}",
            "Qualifica\u00e7\u00e3o": "={{ $json.Qualificacao }}",
            "ID": "={{ $json.ID }}",
            "Nome": "={{ $json.Nome }}",
            "Telefone": "={{ $json.Telefone}}",
            "Cidade": "={{ $json.Cidade }}",
            "Data de Captura": "={{ $json['Data de Captura'] }}",
            "Ano": "={{ $json.Ano }}",
            "Fonte": "={{ $json.Fonte }}"
          },
          "matchingColumns": [
            "ID"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Nome",
              "displayName": "Nome",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Telefone",
              "displayName": "Telefone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Cidade",
              "displayName": "Cidade",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Data de Captura",
              "displayName": "Data de Captura",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Ano",
              "displayName": "Ano",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Fonte",
              "displayName": "Fonte",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Vendedor",
              "displayName": "Vendedor",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Qualifica\u00e7\u00e3o",
              "displayName": "Qualifica\u00e7\u00e3o",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        416,
        -80
      ],
      "id": "41c6d866-0b00-4d39-8997-c08cc92b584c",
      "name": "Append or update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA",
          "mode": "list",
          "cachedResultName": "Leads Test AEG",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "P\u00e1gina1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Nome": "={{ $json.body.name }}",
            "Telefone": "= {{ $json.body.tel }}",
            "Cidade": "={{ $json.body.city }}",
            "Data de Captura": "={{$now}}",
            "Status": "Novo Lead - N\u00e3o Contactado",
            "ID": "={{ $json.body.id }}",
            "Ano": "={{ $json.body.vehicleYear }}",
            "Fonte": "={{ $json.body.trafficSource }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "ID",
              "displayName": "ID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Nome",
              "displayName": "Nome",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Telefone",
              "displayName": "Telefone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Cidade",
              "displayName": "Cidade",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Data de Captura",
              "displayName": "Data de Captura",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Status",
              "displayName": "Status",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Ano",
              "displayName": "Ano",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Fonte",
              "displayName": "Fonte",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Vendedor",
              "displayName": "Vendedor",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Qualifica\u00e7\u00e3o",
              "displayName": "Qualifica\u00e7\u00e3o",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        -112,
        -80
      ],
      "id": "ef4ac563-72f8-4286-aecd-3fd92429aea7",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "amount": 1
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        624,
        -80
      ],
      "id": "f561c454-23bb-48c7-a779-a3c440c1d2b7",
      "name": "Wait"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.twilio.com/2010-04-01/Accounts/ACf84f333660ad6c71e171577922b20d35/Messages.json",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth",
        "sendBody": true,
        "contentType": "multipart-form-data",
        "bodyParameters": {
          "parameters": [
            {
              "name": "To",
              "value": "=whatsapp:{{ $json.telefoneFormatado }}"
            },
            {
              "name": "From",
              "value": "whatsapp:+14155238886"
            },
            {
              "name": "Body",
              "value": "=\"Ol\u00e1 {{ $json.body.Nome }}, somos da AEG Prote\u00e7\u00e3o. Seu consultor, {{$json.body.Vendedor}}, j\u00e1 recebeu seus dados e entrar\u00e1 em contato em breve para apresentar a melhor prote\u00e7\u00e3o veicular para voc\u00ea! \ud83d\udcde\""
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        1088,
        -80
      ],
      "id": "b63a7459-db2c-40e6-acfb-6f70d0638dc9",
      "name": "HTTP Request",
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpBasicAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "20520bba-2688-4a63-aaec-0c451785485c",
              "name": "telefoneFormatado",
              "value": "={{ '+55' + $json.Telefone.replace(/[^\\d]/g, \"\") }}",
              "type": "string"
            },
            {
              "id": "c4666644-097b-4242-8c57-65577fe76cfe",
              "name": "body",
              "value": "={{ $json }}",
              "type": "object"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        848,
        -80
      ],
      "id": "32111b52-0215-40ae-88c9-84eee2c96f88",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "sendTo": "zalisonkiller777@gmail.com",
        "subject": "=NOVA LEAD CAPTURADA\ud83d\udea8 -- {{ $json.VendedorDesignado }} \u2013 {{ $json.Nome }} ({{ $json.Qualificacao }})",
        "message": "=<h1>ALERTA: NOVO LEAD PARA CONTATO IMEDIATO</h1>\n<p><b>Vendedor:</b> {{ $json.VendedorDesignado }}</p>\n<p><b>Qualifica\u00e7\u00e3o:</b> <span style=\"color: red;\">{{ $json.Qualificacao }}</span></p>\n\n<hr>\n<ul>\n    <li><b>Nome:</b> {{ $json.Nome }}</li>\n    <li><b>Telefone:</b> {{ $json.Telefone }}</li>\n    <li><b>Cidade:</b> {{ $json.Cidade }}</li>\n    <li><b>Ano do Veiculo:</b> {{ $json.Ano }}</li>\n    <li><b>Fonte do trafego:</b> {{ $json.Fonte }}</li>\n</ul>\n<hr>\n<p>Inicie o contato o mais r\u00e1pido poss\u00edvel.</p>\n<p>ID da lead: {{ $json.ID }}</p>",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        432,
        -288
      ],
      "id": "d53f7775-3872-4525-8af5-affb1eb72826",
      "name": "Send a message1",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const leadData = $input.all()[0].json;\n\n// --- 1. CONFIGURA\u00c7\u00c3O E VARI\u00c1VEIS DE SCORES ---\nconst vendedoresPool = [\n  \"Ana (Vendedor A)\",\n  \"Bruno (Vendedor B)\",\n  \"Carla (Vendedor C)\",\n];\nlet designatedVendedor;\nlet pontuacaoTotal = 0;\n\n// Listas de Prioridade (usadas para pontua\u00e7\u00e3o)\nconst altaPrioridade = [\n  \"S\u00c3O PAULO\",\n  \"RIO DE JANEIRO\",\n  \"BRAS\u00cdLIA\",\n  \"BELO HORIZONTE\",\n];\nconst mediaPrioridade = [\"RECIFE\", \"SALVADOR\", \"CARUARU\", \"TACAIMB\u00d3\"];\n\n// Vari\u00e1veis de Entrada (Assumindo que est\u00e3o mapeadas no LeadData)\nconst cidade = leadData.Cidade;\nconst fonte = leadData.Fonte || \"\";\nconst anoVeiculo = parseInt(leadData.AnoVeiculo) || 0;\nconst leadID = leadData.LeadID;\n\n// Fun\u00e7\u00e3o de Padroniza\u00e7\u00e3o\nconst padronizar = (text) => {\n  if (!text) return null;\n  return text\n    .toUpperCase()\n    .normalize(\"NFD\")\n    .replace(/[\\u0300-\\u036f]/g, \"\")\n    .trim();\n};\nconst cidadePadronizada = padronizar(cidade);\n\n// Defina trafficSource com base em 'fonte'\nconst trafficSource = fonte.toLowerCase();\n\n// --- 2. C\u00c1LCULO DE PONTUA\u00c7\u00c3O (LEAD SCORING MULTI-FATORIAL) ---\n\n// A. PONTOS PELA CIDADE (Potencial Alto)\nif (\n  cidadePadronizada &&\n  altaPrioridade.some((p) => cidadePadronizada.includes(padronizar(p)))\n) {\n  pontuacaoTotal += 10;\n} else if (\n  cidadePadronizada &&\n  mediaPrioridade.some((p) => cidadePadronizada.includes(padronizar(p)))\n) {\n  pontuacaoTotal += 5;\n}\n\n// B. PONTOS POR INTERESSE/URG\u00caNCIA (Fonte de Tr\u00e1fego)\nswitch (trafficSource) {\n  case \"seo\":\n  case \"indicacao\":\n    // Alto interesse e inten\u00e7\u00e3o de compra\n    pontuacaoTotal += 5;\n    break;\n\n  case \"whatsapp\":\n    // Contato direto e imediato\n    pontuacaoTotal += 4;\n    break;\n\n  case \"email-marketing\":\n    // J\u00e1 passou por nutri\u00e7\u00e3o\n    pontuacaoTotal += 3;\n    break;\n\n  case \"google-ads\":\n    // Inten\u00e7\u00e3o de busca no momento\n    pontuacaoTotal += 2;\n    break;\n\n  case \"facebook-ads\":\n  case \"instagram-ads\":\n  case \"youtube-ads\":\n  case \"tiktok-ads\":\n  case \"linkedin-ads\":\n    // Baixa Inten\u00e7\u00e3o (An\u00fancios de interrup\u00e7\u00e3o)\n    pontuacaoTotal += 1;\n    break;\n\n  case \"outros\":\n    // Valor default\n    pontuacaoTotal += 0;\n    break;\n}\n// C. PONTOS POR SERVI\u00c7OS ADICIONAIS (Ano do Ve\u00edculo)\nif (anoVeiculo >= 2020) {\n  pontuacaoTotal += 3;\n}\n\n// Armazena a pontua\u00e7\u00e3o final no objeto\nleadData.PontuacaoFinal = pontuacaoTotal;\n\n// --- 3. CLASSIFICA\u00c7\u00c3O FINAL E ATRIBUI\u00c7\u00c3O (COMBINADA) ---\n\n// CASO 1: ALTA PRIORIDADE (Pontua\u00e7\u00e3o >= 15)\nif (pontuacaoTotal >= 15) {\n  leadData.Qualificacao = \"ALTA PRIORIDADE\";\n  leadData.Pontuacao = 10; // Pontua\u00e7\u00e3o de exibi\u00e7\u00e3o\n  designatedVendedor = vendedoresPool[2]; // Vendedor C (Carla) - Atribui\u00e7\u00e3o Direta e Urgente\n}\n// CASO 2: DADOS INCOMPLETOS OU NULOS (Pontua\u00e7\u00e3o <= 0)\nelse if (pontuacaoTotal <= 0) {\n  leadData.Qualificacao = \"BAIXA PRIORIDADE - DADOS INCOMPLETOS\";\n  leadData.Pontuacao = 0;\n  designatedVendedor = vendedoresPool[0]; // Vendedor A (Ana) - Limpeza de Dados\n}\n// CASO 3: M\u00c9DIA E BAIXA PRIORIDADE (Aplica Round-Robin)\nelse {\n  // Define a classifica\u00e7\u00e3o baseada na pontua\u00e7\u00e3o\n  leadData.Qualificacao =\n    pontuacaoTotal >= 7 ? \"M\u00c9DIA PRIORIDADE\" : \"BAIXA PRIORIDADE\";\n  leadData.Pontuacao = pontuacaoTotal >= 7 ? 5 : 2; // --- L\u00d3GICA ROUND-ROBIN COM HASH (Simula\u00e7\u00e3o de Persist\u00eancia) ---\n  if (leadID && leadID.length > 0) {\n    let hash = 0;\n    for (let i = 0; i < leadID.length; i++) {\n      hash = leadID.charCodeAt(i) + ((hash << 5) - hash);\n    }\n    const nextIndex = Math.abs(hash) % vendedoresPool.length;\n\n    designatedVendedor = vendedoresPool[nextIndex];\n  } else {\n    designatedVendedor = vendedoresPool[1]; // Fallback\n  }\n}\n\n// --- 4. ATRIBUI\u00c7\u00c3O FINAL E STATUS ---\nleadData.VendedorDesignado = designatedVendedor;\nleadData.Status = \"Atribu\u00eddo - Aguardando Contato\";\n\n// Retorna o array de itens atualizado\nreturn [{ json: leadData }];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        160,
        -80
      ],
      "id": "d0c78445-d723-4a55-a8e5-939f7b8ef466",
      "name": "Code in JavaScript"
    },
    {
      "parameters": {
        "authentication": "oAuth2",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "C09T138V70E",
          "mode": "list",
          "cachedResultName": "leads"
        },
        "text": "=Nova lead Recebida\nO cliente {{ $json.Nome }} da cidade de {{ $json.Cidade }} foi registrado e precisa de contato urgente. \nTelefone: {{ $json.Telefone }} \nFonte de trafego: {{ $json.Fonte }}\nAno do Veiculo: {{ $json.Ano }}\nStatus: {{ $json.Status }}\n",
        "otherOptions": {}
      },
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.3,
      "position": [
        64,
        -272
      ],
      "id": "8b96a5f7-d191-4f13-8353-86fbd9d163ec",
      "name": "Send a message",
      "credentials": {
        "slackOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "seconds",
              "secondsInterval": 2
            }
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        32,
        304
      ],
      "id": "6b629bfd-412b-4cbd-82aa-2ebd6c86895a",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA",
          "mode": "list",
          "cachedResultName": "Leads Test AEG",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "P\u00e1gina1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1troHZrkVi0AdpCzcgt5mtP1LYhJSsU0rN6EJPFLYUfA/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        240,
        304
      ],
      "id": "797017f3-eff2-43f4-a5d9-b7ba2ce17276",
      "name": "Get row(s) in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "0a5da6ef-c443-4aae-9a15-056cf816fcfa",
              "leftValue": "={{ $json['Data de Captura'] }}",
              "rightValue": "={{ $now.minus({days: 7})}}",
              "operator": {
                "type": "dateTime",
                "operation": "afterOrEquals"
              }
            },
            {
              "id": "20baa16a-e562-4b91-b54c-4421b5e637b5",
              "leftValue": "={{ $json['Data de Captura'] }}",
              "rightValue": "={{ $now }}",
              "operator": {
                "type": "dateTime",
                "operation": "beforeOrEquals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        448,
        304
      ],
      "id": "4deffc15-3b40-40ec-8bf3-9abac8f63f6d",
      "name": "Filter"
    },
    {
      "parameters": {
        "jsCode": "// O n\u00f3 recebe todos os leads da \u00faltima semana\nconst leads = $input.all().map(item => item.json);\nconst totalLeads = leads.length;\n\n// Fun\u00e7\u00e3o auxiliar para contar a ocorr\u00eancia de valores em uma chave (ex: 'Status')\nconst countBy = (arr, key) => arr.reduce((acc, obj) => {\n    const val = obj[key] || 'N\u00e3o Atribu\u00eddo';\n    acc[val] = (acc[val] || 0) + 1;\n    return acc;\n}, {});\n\n// Contagem de Status\nconst leadsPorStatus = countBy(leads, 'Status');\n\n// --- C\u00c1LCULO DAS M\u00c9TRICAS REQUERIDAS ---\n\nconst aguardandoFollowup = leadsPorStatus['Atribu\u00eddo - Aguardando Contato'] || 0;\nconst contatados = leadsPorStatus['Contatado'] || 0; // Voc\u00ea deve garantir que sua equipe mude o status para 'Contatado'\n\nconst leadsFechados = leadsPorStatus['Fechado'] || 0; // Exemplo de Status\nconst leadsPerdidos = leadsPorStatus['Perdido'] || 0;\n\n// Taxa de Convers\u00e3o: (Fechados / Total de Leads)\nconst taxaConversao = totalLeads > 0 ? (leadsFechados / totalLeads) * 100 : 0;\n\n\n// --- RETORNO DOS DADOS AGREGADOS ---\nreturn [{ \n    json: {\n        totalLeads,\n        aguardandoFollowup,\n        contatados,\n        taxaConversao: taxaConversao.toFixed(2) + '%',\n        leadsPorStatus // Objeto completo de contagem de status\n    } \n}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        656,
        304
      ],
      "id": "6719f14b-d496-4339-868d-a347b0ed56b1",
      "name": "Code in JavaScript1"
    },
    {
      "parameters": {
        "sendTo": "zalisonkiller777@gmail.com",
        "subject": "=RELATORIO DE PERFORMANCE ULTIMOS 7 DIAS",
        "message": "=<h3>\ud83d\udcc8 RELAT\u00d3RIO DE PERFORMANCE (\u00daltimos 7 Dias)</h3>\n<p><b>Total de Leads Capturados:</b> {{ $json.totalLeads }}</p>\n<p><b>Taxa de Convers\u00e3o:</b> {{ $json.taxaConversao }}</p>\n\n<h4>Status e Acompanhamento</h4>\n<ul>\n    <li><b>Leads Aguardando Follow-up (NOVOS):</b> {{ $json.aguardandoFollowup }}</li>\n    <li><b>Leads J\u00e1 Contatados:</b> {{ $json.contatados }}</li>\n    <li><b>Leads Fechados:</b> {{ $json.leadsPorStatus['Fechado'] || 0 }}</li>\n    <li><b>Leads Perdidos/Desqualificados:</b> {{ $json.leadsPorStatus['Perdido'] || 0 }}</li>\n</ul>",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        848,
        304
      ],
      "id": "56cca070-4820-4103-a27b-74fb412ea115",
      "name": "Send a message2",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "Send a message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Code in JavaScript",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message1": {
      "main": [
        []
      ]
    },
    "Code in JavaScript": {
      "main": [
        [
          {
            "node": "Send a message1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send a message": {
      "main": [
        []
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get row(s) in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get row(s) in sheet": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Code in JavaScript1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code in JavaScript1": {
      "main": [
        [
          {
            "node": "Send a message2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "352fffc8-d017-404a-bd57-f6b502d6be80",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "d0scJxvUt2wzbuGT",
  "tags": []
}