diff --git a/disparador.json b/disparador.json index 86bb571..31c2e62 100644 --- a/disparador.json +++ b/disparador.json @@ -1,5 +1,5 @@ { - "name": "Disparador 1.5", + "name": "Disparador 1.5.1", "nodes": [ { "parameters": { @@ -12,7 +12,7 @@ ] } }, - "id": "340c174a-59ba-43b5-bb51-ac8a14fe218d", + "id": "1a0c0f85-951d-492b-a612-6e9362b2bbc1", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "typeVersion": 1, @@ -33,7 +33,7 @@ ] } }, - "id": "1edfb4d2-33e3-4a97-9802-4c56a4fafe9c", + "id": "86f49414-76c2-4ab9-a229-0ef9cb3b3891", "name": "Horario", "type": "n8n-nodes-base.if", "typeVersion": 1, @@ -48,7 +48,7 @@ "height": 456.3958547081602, "width": 1221.218469617133 }, - "id": "e6acfa3d-8cfa-4307-9ac0-143fb7e7cda7", + "id": "94ce7814-77e3-4356-a063-a388977973d5", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -59,12 +59,12 @@ }, { "parameters": { - "content": "# Disparador de Campanha para ChatWoot\n## Evolution API\n\n\nv 1.5", + "content": "# Disparador de Campanha para ChatWoot\n## Evolution API\n\n\nv 1.5.1", "height": 163.30528430133387, "width": 847.4993167412657, "color": 4 }, - "id": "a46fb63d-7831-4b9a-b603-0f9857cd7567", + "id": "dd00e5b4-2cbb-4e3b-a75b-172af798d1fe", "name": "Sticky Note10", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -83,7 +83,7 @@ "includeInputFields": true } }, - "id": "b55513b0-1036-4c62-b27c-82df301c9cfc", + "id": "52b2a28a-47cb-43f9-9913-5e8da44e2b2c", "name": "Altera fuso horário", "type": "n8n-nodes-base.dateTime", "typeVersion": 2, @@ -99,7 +99,7 @@ "width": 5519.984579857509, "color": 3 }, - "id": "9d12feaa-1384-4363-9724-e526a950d380", + "id": "734db5f0-bbed-4aae-bd24-68d87f85050a", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -110,7 +110,7 @@ }, { "parameters": {}, - "id": "f8824154-8a53-43b4-bf01-ea68fbc04f2e", + "id": "217bf3f0-de61-4fa2-8b9a-dd99a20b2eee", "name": "Repetir ação", "type": "n8n-nodes-base.noOp", "typeVersion": 1, @@ -123,7 +123,7 @@ "parameters": { "jsCode": "// Este exemplo gera um tempo de espera aleatório entre 10 e 60 segundos\nconst minWait = 8; // Tempo mínimo de espera em segundos\nconst maxWait = 15; // Tempo máximo de espera em segundos\nconst randomWaitTime = Math.floor(Math.random() * (maxWait - minWait + 1)) + minWait;\n\nreturn [\n {\n json: {\n waitTime: randomWaitTime\n }\n }\n];\n" }, - "id": "dd6343b7-cfa0-41b1-9620-58c6225de1ad", + "id": "bf2422f2-0a36-4438-9b1d-80dee1a36692", "name": "Time Randon1", "type": "n8n-nodes-base.code", "typeVersion": 2, @@ -136,7 +136,7 @@ "parameters": { "amount": "={{ $json.waitTime }}" }, - "id": "98a6cab0-24b3-414d-b4e6-bf22ed0b92fe", + "id": "27132669-ff04-4a46-9631-f8c29e9467ba", "name": "Tempo de espera1", "type": "n8n-nodes-base.wait", "typeVersion": 1.1, @@ -144,7 +144,7 @@ 2580, 1060 ], - "webhookId": "31abe436-92ec-4d95-abaa-9e1b8a0daf69" + "webhookId": "20e37a81-2807-42b8-9da8-2c223684669e" }, { "parameters": { @@ -157,7 +157,7 @@ ] } }, - "id": "86e3f39b-80fa-4e7d-beff-583b36f46ea1", + "id": "72f29390-3730-4f27-b448-fa6dd1d79efe", "name": "IF6", "type": "n8n-nodes-base.if", "typeVersion": 1, @@ -172,7 +172,7 @@ "include": "allOtherFields", "options": {} }, - "id": "a510b759-02d7-4e87-a130-6526171a9c0e", + "id": "900e2c14-756f-4cd9-9d84-3eb2bd3f6869", "name": "Item Lists1", "type": "n8n-nodes-base.itemLists", "typeVersion": 3, @@ -188,7 +188,7 @@ "width": 728.217926985971, "color": 2 }, - "id": "37380d5e-9ff9-4cb0-8bb1-c93af1c27f3b", + "id": "374ea10b-4960-42f0-921b-37b8bd6a3ecf", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -201,7 +201,7 @@ "parameters": { "options": {} }, - "id": "477ed4cd-61d1-4672-aeba-7c9992ad6ab6", + "id": "b0d999f6-7283-4f39-889c-3540093378c6", "name": "Loop Over Items", "type": "n8n-nodes-base.splitInBatches", "typeVersion": 3, @@ -237,7 +237,7 @@ }, "options": {} }, - "id": "f060c009-8377-4df6-8e26-89008ddbba3b", + "id": "a079c60c-662b-45a3-ac21-110dd9c28a0c", "name": "If", "type": "n8n-nodes-base.if", "typeVersion": 2, @@ -253,7 +253,7 @@ "width": 853.0984671711764, "color": 4 }, - "id": "5ba7c3d9-b728-4b39-b7d9-97097aac1b39", + "id": "7888310b-d694-43f2-b16a-060428bc8215", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -269,7 +269,7 @@ "width": 404.53569195365, "color": 4 }, - "id": "daf532a0-247e-470d-812f-f22947cfc1ea", + "id": "7b39b2b5-611f-462a-af60-cf3602ee6d64", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -285,7 +285,7 @@ "width": 546.5336275124715, "color": 2 }, - "id": "cfda581b-b06c-4902-a9b6-e3fc5c11dffb", + "id": "1d1e3d8f-f8ac-4416-bd36-3a72510c45db", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -301,7 +301,7 @@ "width": 376.16757486051324, "color": 2 }, - "id": "f3bab47b-15d0-45b8-805f-5cd3267fcd05", + "id": "18680595-537a-414b-9e0b-5c2f23ed0009", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -318,7 +318,7 @@ "queryReplacement": "=" } }, - "id": "5c05c936-0e56-43f2-a9c4-c53f1562384c", + "id": "20c2336f-19d1-4c4d-9021-fdd698ef80ec", "name": "Busca falhas", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -333,7 +333,7 @@ "query": "SELECT enviou\nFROM campaigns\nWHERE id = {{ $('IF6').item.json.id }};", "options": {} }, - "id": "be39ed05-43ca-4467-bc4a-60a1229c111e", + "id": "5cd94391-c899-4b1f-b329-970844f9be0f", "name": "Busca envios", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -398,7 +398,7 @@ }, "options": {} }, - "id": "f8450871-2275-463b-99ec-7627c7cce009", + "id": "3fc490de-ec8e-43cf-9d01-e8dc6fc2e32c", "name": "Campanha", "type": "n8n-nodes-base.set", "typeVersion": 3.3, @@ -413,7 +413,7 @@ "height": 346.43605543050865, "width": 1085.0447604700087 }, - "id": "a71bd8df-0484-49b0-b87c-c07f4e016242", + "id": "8a6ac58f-1a50-43c5-8d14-da95dd90a138", "name": "Sticky Note8", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -424,11 +424,11 @@ }, { "parameters": { - "content": "# Limite excedido", + "content": "# Limite excedido ", "height": 339.69571412210314, "width": 1088.2492332463764 }, - "id": "a6207421-9db6-45c9-b503-fd4f164e86e4", + "id": "25d47746-1ee7-4366-b4b5-4d1e9e7c8955", "name": "Sticky Note9", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -443,7 +443,7 @@ "query": "UPDATE campaigns\nSET enviou = {{ $json.enviou +1 }}\nWHERE id = {{ $('IF6').item.json.id }};", "options": {} }, - "id": "c139c950-3c24-49b2-935f-2ec304380a5d", + "id": "a2f8685c-216f-40f0-ac7e-115007d12d35", "name": "Adiciona envios", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -458,7 +458,7 @@ "height": 199.63817652105178, "width": 313.99126283929667 }, - "id": "1dfd8fbf-acb1-4fa4-a600-ca35a1242705", + "id": "f255dd13-2819-4f2f-9623-d28f23b24de4", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -473,7 +473,7 @@ "height": 221.17684873191945, "width": 313.99126283929667 }, - "id": "a9f4f1c5-48a5-466a-9167-f5c7128a3131", + "id": "b7dd533d-3e9d-4836-b1a4-93d4b5301238", "name": "Sticky Note11", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -516,7 +516,7 @@ }, "options": {} }, - "id": "885d9791-0308-4213-8e46-f160617952a5", + "id": "2e37af4d-2a7a-4ffb-b9be-b0f75c82cb60", "name": "If2", "type": "n8n-nodes-base.if", "typeVersion": 2, @@ -531,7 +531,7 @@ "height": 331.5360284004761, "width": 1227.4972493046307 }, - "id": "0cac7b92-0dbd-47a9-aa69-0ca301ad9fcf", + "id": "5cd74851-facf-4df2-bde3-1ddf6fa89450", "name": "Sticky Note12", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -560,7 +560,7 @@ }, "options": {} }, - "id": "12716989-d5c3-47ee-abd9-ef57d45f5d90", + "id": "b51fe687-00a9-43ae-8711-4730d9627caf", "name": "Salva conversa", "type": "n8n-nodes-base.set", "typeVersion": 3.3, @@ -593,7 +593,7 @@ }, "options": {} }, - "id": "645d5deb-4967-4463-a976-d407575cc50f", + "id": "c9e67e65-40a6-49b2-a139-ade028c4346b", "name": "If3", "type": "n8n-nodes-base.if", "typeVersion": 2, @@ -606,7 +606,7 @@ "parameters": { "amount": 1 }, - "id": "a6d9ab7f-a016-4432-86ec-1f5d12e74f8d", + "id": "38a23425-65c9-4f71-b1be-ebc522ee391f", "name": "Wait", "type": "n8n-nodes-base.wait", "typeVersion": 1.1, @@ -614,7 +614,7 @@ 4700, 1040 ], - "webhookId": "9564575c-7414-4c94-b1f1-d73c99222ecc" + "webhookId": "a977474d-6165-4bda-8120-cd7e36705ca7" }, { "parameters": { @@ -622,7 +622,7 @@ "height": 246.1701698163285, "width": 704.4608631799392 }, - "id": "3cfc96af-5e02-44e7-aba6-88cb5f454e87", + "id": "d21f56a3-f65f-4abd-975b-ecde5a334176", "name": "Sticky Note13", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -639,7 +639,7 @@ "queryReplacement": "=" } }, - "id": "b7e94c23-023a-45ae-bf6a-08423995b60c", + "id": "340edd9e-f050-4e70-9d13-14a7e274ea90", "name": "Busca limite diario", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -656,7 +656,7 @@ "text": "=⚠️ Atenção! Algumas mensagens da campanha {{ $node['Buscar campanhas'].json.title }} podem não ter sido enviadas. ⚠️\n\n✔️ Total de envios: {{ $('Notifica limite excedido').item.json.enviou }}\n❌ Número de falhas: {{ $('Notifica limite excedido').item.json.falhou }}\n#️⃣ Limite restante: {{ $('Notifica limite excedido').item.json.limite_disparo }} \n\nO limite de disparos diários foi excedido. Por favor, verifique os envios ou entre em contato com o suporte para mais informações.\n\nObrigado pela compreensão! ", "options": {} }, - "id": "6a0fb4f7-2e3e-49e9-88a7-74b3eae029da", + "id": "ccdd46f6-9c38-4430-ada7-c0d516d3a735", "name": "Send Email", "type": "n8n-nodes-base.emailSend", "typeVersion": 2, @@ -674,7 +674,7 @@ "text": "=📢 Campanha {{ $node['Buscar campanhas'].json.title }} enviada com sucesso! 📢\n\n✔️ Total de envios: {{ $('Resumo relatorio').item.json.enviou }}\n❌ Número de falhas: {{ $('Resumo relatorio').item.json.falhou }} \n#️⃣ Limite restante: {{ $('Resumo relatorio').item.json.limite_disparo }} \n\nObrigado por utilizar nossos serviços!", "options": {} }, - "id": "be4d879f-7de5-4721-a738-691d0f249df0", + "id": "a327f78a-ce13-460e-8cb1-932ba9b0e096", "name": "Send Email1", "type": "n8n-nodes-base.emailSend", "typeVersion": 2, @@ -708,7 +708,7 @@ }, "options": {} }, - "id": "7c327d7e-0143-454d-b028-c2a0a85c07a4", + "id": "36e2da3f-83ff-459b-84d1-f546e8cd0b4f", "name": "If4", "type": "n8n-nodes-base.if", "typeVersion": 2, @@ -719,7 +719,7 @@ }, { "parameters": {}, - "id": "ed86a90e-8f24-4c25-b714-1a68dd305c81", + "id": "a7bb0d55-80bb-4fbc-ae15-9052bfccf34f", "name": "Wait1", "type": "n8n-nodes-base.wait", "typeVersion": 1.1, @@ -727,7 +727,7 @@ 2396, 360 ], - "webhookId": "82162c4e-916e-460e-9f04-c21ed4c6895e" + "webhookId": "e812a880-b6b3-429c-b600-83c09305cfa7" }, { "parameters": { @@ -735,7 +735,7 @@ "query": "UPDATE campaigns\nSET falhou = {{ $json.falhou +1 }}\nWHERE id = {{ $('IF6').item.json.id }};", "options": {} }, - "id": "5bd4675b-18ee-431d-86b8-9434feb10bec", + "id": "1da158e1-8281-410d-84bc-06ff81b000ac", "name": "Adiciona num de falhas", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -750,7 +750,7 @@ "query": "INSERT INTO campaigns_failled (nomecontato, telefone, id_campanha)\nSELECT '{{ $('Busca contatos').item.json.name }}', '{{ $('Busca contatos').item.json.phone_number }}', {{ $('Buscar campanhas').item.json.id }}\nWHERE NOT EXISTS (\n SELECT 1\n FROM campaigns_failled\n WHERE telefone = '{{ $('Busca contatos').item.json.phone_number }}' AND id_campanha = {{ $('Buscar campanhas').item.json.id }}\n);", "options": {} }, - "id": "a6391e66-33ff-4248-9ca6-43605072d6d9", + "id": "d0b6f4bc-bb32-42da-b0c8-bff94a87031e", "name": "Adiciona num não enviado", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -782,7 +782,7 @@ }, "options": {} }, - "id": "b06f8d61-800e-4527-948e-cec8be070900", + "id": "6f89751c-f852-45f1-b388-057e63f0426e", "name": "If5", "type": "n8n-nodes-base.if", "typeVersion": 2, @@ -799,7 +799,7 @@ "queryReplacement": "=" } }, - "id": "67de1521-ac0b-4ac8-b090-5028e10eb78c", + "id": "ea2fbe1f-2d1f-41c3-b4f3-58ef76127956", "name": "Notifica limite excedido", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -831,7 +831,7 @@ }, "options": {} }, - "id": "9d8e6abf-14f6-496d-9bd1-23fb1333ff72", + "id": "b9a0a034-0169-4781-b78d-d3aec2b0ca46", "name": "If6", "type": "n8n-nodes-base.if", "typeVersion": 2, @@ -844,7 +844,7 @@ "parameters": { "jsCode": "let contatos = items.map(item => `${item.json.nomecontato} - ${item.json.telefone}`).join('\\n');\n\nreturn [\n {\n json: {\n listaContatos: contatos\n }\n }\n];" }, - "id": "d7ccc463-49a8-44e2-a5ae-49d1e7808d7b", + "id": "a244a740-90fa-48f3-b1b1-ef87a72669e0", "name": "Code", "type": "n8n-nodes-base.code", "typeVersion": 2, @@ -857,7 +857,7 @@ "parameters": { "jsCode": "let contatos = items.map(item => `${item.json.nomecontato} - ${item.json.telefone}`).join('\\n');\n\nreturn [\n {\n json: {\n listaContatos: contatos\n }\n }\n];" }, - "id": "efa516c0-a8cb-4921-bc18-f5756f79f476", + "id": "7a863822-6535-4d7b-8661-ced5bfc9dd54", "name": "Code1", "type": "n8n-nodes-base.code", "typeVersion": 2, @@ -874,7 +874,7 @@ "text": "=📢 Campanha {{ $node['Buscar campanhas'].json.title }} enviada com sucesso! 📢\n\n✔️ Total de envios: {{ $node['Resumo relatorio'].json.enviou }}\n❌ Número de falhas: {{ $node['Resumo relatorio'].json.falhou }} \n#️⃣ Limite restante: {{ $node['Resumo relatorio'].json.limite_disparo }} \n\nContatos não enviados:\n{{ $('Code').item.json[\"listaContatos\"] }}\n\nObrigado por utilizar nossos serviços!", "options": {} }, - "id": "069b730a-745b-48b5-816f-1609e02f0d8b", + "id": "60460953-2a29-4049-9e8b-110a30db181a", "name": "Send Email2", "type": "n8n-nodes-base.emailSend", "typeVersion": 2, @@ -890,7 +890,7 @@ "query": "SELECT \n (SELECT COUNT(*) FROM campaigns_failled WHERE id_campanha = {{ $('Buscar campanhas').item.json.id }}) AS total_registros,\n campaigns_failled.*\nFROM campaigns_failled\nWHERE id_campanha = {{ $('Buscar campanhas').item.json.id }};", "options": {} }, - "id": "3eb8ede6-d136-43cc-9778-2cd9de47a146", + "id": "73c31bd7-63aa-483b-aecd-c234c23d5dfb", "name": "Postgres1", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -908,7 +908,7 @@ "text": "=⚠️ Atenção! Algumas mensagens da campanha {{ $node['Buscar campanhas'].json.title }} podem não ter sido enviadas. ⚠️\n\n✔️ Total de envios: {{ $node['Notifica limite excedido'].json.enviou }}\n❌ Número de falhas: {{ $node['Notifica limite excedido'].json.falhou }}\n#️⃣ Limite restante: {{ $node['Notifica limite excedido'].json.limite_disparo }} \n\nContatos não enviados:\n{{ $node['Code1'].json[\"listaContatos\"] }}\n\nO limite de disparos diários foi excedido. Por favor, verifique os envios ou entre em contato com o suporte para mais informações.\n\nObrigado pela compreensão! ", "options": {} }, - "id": "ee817be8-c8b1-424d-86a8-28e17eb64266", + "id": "1ac8121e-381e-4c93-b311-7bb748aab2d7", "name": "Send Email3", "type": "n8n-nodes-base.emailSend", "typeVersion": 2, @@ -944,7 +944,7 @@ }, "options": {} }, - "id": "b9b808ea-09e8-420d-9214-35bde4723d31", + "id": "7859a488-f383-41ad-88b6-fed93cfb4475", "name": "Dados da campanha", "type": "n8n-nodes-base.set", "typeVersion": 3.3, @@ -959,7 +959,7 @@ "include": "allOtherFields", "options": {} }, - "id": "ab5b1d8d-b38c-46a2-80fc-955b626ffaea", + "id": "98f8463b-ecb0-47bd-9f90-2062989ba752", "name": "Tratamento de lista", "type": "n8n-nodes-base.itemLists", "typeVersion": 3, @@ -975,7 +975,7 @@ "query": "SELECT \n (SELECT COUNT(*) FROM campaigns_failled WHERE id_campanha = {{ $node['Dados da campanha'].json.id_campanha }}) AS total_registros,\n cf.*\nFROM campaigns_failled cf\nWHERE cf.id_campanha = {{ $node['Dados da campanha'].json.id_campanha }};", "options": {} }, - "id": "aa7668d3-8747-4fa7-bd74-d439b1ecbd10", + "id": "25b8b9b7-9ce9-4780-b461-e5b30a1a9301", "name": "Postgres", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -991,7 +991,7 @@ "query": "SELECT \n c.falhou, \n c.enviou, \n a.limite_disparo \nFROM \n campaigns c\nJOIN \n accounts a ON c.account_id = a.id\nWHERE \n c.id = {{ $json.id_campanha }};", "options": {} }, - "id": "c198e4d8-9ed1-414b-ac43-28a02bd485a5", + "id": "e130bc04-f22b-4d96-9257-6654f70e0150", "name": "Resumo relatorio", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -1006,7 +1006,7 @@ "query": "UPDATE accounts\nSET limite_disparo = {{ $('Busca limite diario').item.json.limite_disparo -1 }}\nWHERE id ={{ $('Info_Base').item.json.chatwoot_account_id }};", "options": {} }, - "id": "afaead58-13a5-4b86-b13d-0e16aa979098", + "id": "4b1acd31-567d-4f7f-970c-612fb8a76a61", "name": "Subtrair", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -1029,7 +1029,7 @@ }, "options": {} }, - "id": "abea672f-ef40-4199-bfe9-b1ee05e2e803", + "id": "b620f72e-d3d1-4eda-a81e-2765ef3a74b7", "name": "Abre conversa de contato existente", "type": "n8n-nodes-base.httpRequest", "typeVersion": 3, @@ -1062,7 +1062,7 @@ }, "options": {} }, - "id": "dda3aa66-5d7d-46f4-914f-ca5e7cf786fb", + "id": "af5b4c37-33b3-486d-9a34-468d051ad98a", "name": "Busca Contato Existe", "type": "n8n-nodes-base.httpRequest", "typeVersion": 3, @@ -1094,7 +1094,7 @@ "jsonBody": "={\n \"numbers\": [\n \"{{ $node['Edita Mensagem'].json.verificanum }}\"\n ]\n} ", "options": {} }, - "id": "d1df106c-43ab-4bab-bf62-8a2ced83e4ae", + "id": "817a0880-6a92-4ce7-8848-acbf89ec4a60", "name": "HTTP Request1", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, @@ -1121,7 +1121,7 @@ "jsonBody": "={\n\"status\": \"resolved\"\n}", "options": {} }, - "id": "45d730a9-2122-48e3-9d61-2c2b6e6de362", + "id": "037a8e79-cc1e-45d4-8ecf-69f95bf1e97a", "name": "Fecha Conversa", "type": "n8n-nodes-base.httpRequest", "typeVersion": 3, @@ -1145,7 +1145,7 @@ }, "options": {} }, - "id": "17c4d96f-dce7-4a1f-a10f-1e709018bf82", + "id": "526199dd-b079-4a96-9d8e-c50458147454", "name": "Seleciona conversa", "type": "n8n-nodes-base.httpRequest", "typeVersion": 3, @@ -1178,7 +1178,7 @@ }, "options": {} }, - "id": "74a57751-1e8c-4808-b294-cb49c56bab3a", + "id": "b299e9b1-fd52-467b-8dbb-833318de9cea", "name": "Busca Contato do Relatorio", "type": "n8n-nodes-base.httpRequest", "typeVersion": 3, @@ -1194,7 +1194,7 @@ "query": "UPDATE conversations\nSET status = 1\nWHERE contact_id = {{ $json.id_contato }};", "options": {} }, - "id": "41c1cfa3-f53d-4047-a33a-ed46f499ccd1", + "id": "cff40d9b-69db-4f2f-9f1a-c3ff1f730e5b", "name": "Resolve Conversa", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -1210,7 +1210,7 @@ "height": 221.17684873191945, "width": 313.99126283929667 }, - "id": "f812dc4c-19e6-46a6-b163-ca616d97c81f", + "id": "dcab2e10-47f2-4528-be73-232617f01fec", "name": "Sticky Note14", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, @@ -1225,7 +1225,7 @@ "query": "SELECT * \nFROM campaigns c \nWHERE account_id = 0\nAND status_envia = 0\nAND inbox_id = 0\nLIMIT 1;", "additionalFields": {} }, - "id": "6f70e67a-1790-4e73-bd40-df8e2f33abed", + "id": "4ea84a1e-ae03-42f6-8c1e-b9d1ca9331b0", "name": "Buscar campanhas", "type": "n8n-nodes-base.postgres", "typeVersion": 1, @@ -1240,7 +1240,7 @@ "query": "UPDATE campaigns SET status_envia = 1 WHERE id = {{ $json.id }}", "options": {} }, - "id": "27b0ae63-1e34-4c71-b723-350d964f83d0", + "id": "34ec6be3-9e42-4d70-a1eb-b6e5e3681cbd", "name": "UPDATE CAMPANHA", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -1256,7 +1256,7 @@ "query": "SELECT c.*\nFROM contacts c\nJOIN taggings tg ON c.id = tg.taggable_id\nWHERE tg.tag_id = {{ $json.etiqueta }}\nAND tg.taggable_type = 'Contact'\nAND c.account_id = {{ $node['Info_Base'].json.chatwoot_account_id }};", "options": {} }, - "id": "15c09c35-7ab3-4603-8720-9348e31b77a1", + "id": "3c8b711a-c389-4763-b53d-3702d6fa95b3", "name": "Busca contatos", "type": "n8n-nodes-base.postgres", "typeVersion": 2.4, @@ -1310,7 +1310,7 @@ }, "options": {} }, - "id": "32df25b6-c893-432d-9450-fc112f878b26", + "id": "1cee7087-c515-49a0-afc7-69ae2a0c713a", "name": "Info_Base", "type": "n8n-nodes-base.set", "typeVersion": 2, @@ -1341,7 +1341,7 @@ "jsonBody": "={\n \"number\":\"{{ $node['Edita Mensagem'].json.verificanum }}\",\n \"options\":{\"delay\":3000,\"presence\":\"composing\"},\n \"textMessage\":{\"text\":\"{{ $('Edita Mensagem').item.json.var_msg.replace(/\\n/g, '\\\\n') }}\"}\n} ", "options": {} }, - "id": "fbd66398-af4d-413a-a104-62b30c7c03d2", + "id": "1355e700-3e12-4d43-8a76-7556c8e83cbd", "name": "Envia msg", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, @@ -1406,7 +1406,7 @@ }, "options": {} }, - "id": "d7fc16bd-3dce-4136-b162-8af79e0952f1", + "id": "41e47a4f-b092-4589-88be-9e36588777cf", "name": "Switch", "type": "n8n-nodes-base.switch", "typeVersion": 3, @@ -1449,7 +1449,7 @@ }, "options": {} }, - "id": "9b8c4f7f-ef97-4ab7-a320-1a3e0008ad61", + "id": "48f0793d-b511-414e-bb9c-facb68f0ada7", "name": "If1", "type": "n8n-nodes-base.if", "typeVersion": 2, @@ -1477,10 +1477,10 @@ }, "sendBody": true, "specifyBody": "json", - "jsonBody": "={\n \"number\": \"{{ $node['Info_Base'].json['recebe_relatorio'] }}\",\n \"options\": {\n \"delay\": 3000,\n \"presence\": \"composing\"\n },\n \"textMessage\": {\n \"text\": \"📢 Campanha *{{ $node['Buscar campanhas'].json.title }}* enviada com sucesso! 📢\\n\\n✔️ Total de envios: {{ $node['Resumo relatorio'].json.enviou }}\\n❌ Número de falhas: {{ $node['Resumo relatorio'].json.falhou }}\\n#️⃣ Limite restante: {{ $node['Resumo relatorio'].json.limite_disparo }}\\n\\n*Contatos não enviados:*\\n{{ $('Code').item.json.listaContatos.replace(/\\n/g, '\\\\n') }} \\n\\nObrigado por utilizar nossos serviços!\"\n }\n}\n ", + "jsonBody": "={\n \"number\": \"{{ $node['Info_Base'].json['recebe_relatorio'] }}\",\n \"options\": {\n \"delay\": 3000,\n \"presence\": \"composing\"\n },\n \"textMessage\": {\n \"text\": \"📢 Campanha *{{ $node['Buscar campanhas'].json.title }}* enviada com sucesso! 📢\\n\\n✔️ Total de envios: {{ $node['Resumo relatorio'].json.enviou }}\\n❌ Número de falhas: {{ $node['Resumo relatorio'].json.falhou }}\\n#️⃣ Limite restante: {{ $node['Resumo relatorio'].json.limite_disparo }}\\n\\n*Contatos não enviados:*\\n{{ $node['Code'].json.listaContatos.replace(/\\n/g, '\\\\n') }} \\n\\nObrigado por utilizar nossos serviços!\"\n }\n}\n ", "options": {} }, - "id": "1e2e47c0-96a3-4d7f-97e9-a1df60ae2aa9", + "id": "d38c8ddf-0300-4a7c-bf94-9f909ff8b6f9", "name": "Envia relatorio3", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, @@ -1496,7 +1496,7 @@ { "parameters": { "method": "POST", - "url": "={{ $('Info_Base').item.json.evolution_url }}/message/sendText/{{ $('Info_Base').item.json.instance_name }}", + "url": "={{ $node['Info_Base'].json.evolution_url }}/message/sendText/{{ $node['Info_Base'].json.instance_name }}", "sendHeaders": true, "headerParameters": { "parameters": [ @@ -1506,16 +1506,16 @@ }, { "name": "apikey", - "value": "={{ $('Info_Base').item.json.global_api_key }}" + "value": "={{ $node['Info_Base'].json.global_api_key }}" } ] }, "sendBody": true, "specifyBody": "json", - "jsonBody": "={\"number\":\"{{ $('Info_Base').item.json[\"recebe_relatorio\"] }}\",\"options\":{\"delay\":3000,\"presence\":\"composing\"},\"textMessage\":{\"text\":\"📢 Campanha *{{ $('Buscar campanhas').item.json.title }}* enviada com sucesso! 📢\\n\\n✔️ Total de envios: {{ $json[\"enviou\"] }}\\n❌ Número de falhas: {{ $json[\"falhou\"] }}\\n#️⃣ Limite restante: {{ $json[\"limite_disparo\"] }}\\n\\nObrigado por utilizar nossos serviços!\"}}", + "jsonBody": "={\"number\":\"{{ $node['Info_Base'].json[\"recebe_relatorio\"] }}\",\"options\":{\"delay\":3000,\"presence\":\"composing\"},\"textMessage\":{\"text\":\"📢 Campanha *{{ $node['Buscar campanhas'].json.title }}* enviada com sucesso! 📢\\n\\n✔️ Total de envios: {{ $json[\"enviou\"] }}\\n❌ Número de falhas: {{ $json[\"falhou\"] }}\\n#️⃣ Limite restante: {{ $json[\"limite_disparo\"] }}\\n\\nObrigado por utilizar nossos serviços!\"}}", "options": {} }, - "id": "8e12e19b-7828-4c2b-be9b-f17427f2497a", + "id": "8826f0f9-1756-4e02-96db-bab53c778883", "name": "Envia relatorio", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, @@ -1547,10 +1547,10 @@ }, "sendBody": true, "specifyBody": "json", - "jsonBody": "={\"number\":\"{{ $node['Info_Base'].json[\"recebe_relatorio\"] }}\",\"options\":{\"delay\":3000,\"presence\":\"composing\"},\"textMessage\":{\"text\":\"⚠️ *Atenção!* Algumas mensagens da campanha *{{ $node['Buscar campanhas'].json.title }}* podem não ter sido enviadas. ⚠️\\n\\n✔️ Total de envios: {{ $node['Notifica limite excedido'].json[\"enviou\"] }}\\n❌ Número de falhas: {{ $node['Notifica limite excedido'].json[\"falhou\"] }}\\n#️⃣ Limite restante: {{ $node['Notifica limite excedido'].json[\"limite_disparo\"] }}\\n\\n*Contatos não enviados:*\\n{{ $('Code1').item.json.listaContatos.replace(/\\n/g, '\\\\n') }} \\n\\nO limite de disparos diários foi excedido. Por favor, verifique os envios ou entre em contato com o suporte para mais informações.\\n\\nObrigado pela compreensão!\"}}\n", + "jsonBody": "={\"number\":\"{{ $node['Info_Base'].json[\"recebe_relatorio\"] }}\",\"options\":{\"delay\":3000,\"presence\":\"composing\"},\"textMessage\":{\"text\":\"⚠️ *Atenção!* Algumas mensagens da campanha *{{ $node['Buscar campanhas'].json.title }}* podem não ter sido enviadas. ⚠️\\n\\n✔️ Total de envios: {{ $node['Notifica limite excedido'].json[\"enviou\"] }}\\n❌ Número de falhas: {{ $node['Notifica limite excedido'].json[\"falhou\"] }}\\n#️⃣ Limite restante: {{ $node['Notifica limite excedido'].json[\"limite_disparo\"] }}\\n\\n*Contatos não enviados:*\\n{{ $node['Code1'].json.listaContatos.replace(/\\n/g, '\\\\n') }} \\n\\nO limite de disparos diários foi excedido. Por favor, verifique os envios ou entre em contato com o suporte para mais informações.\\n\\nObrigado pela compreensão!\"}}\n", "options": {} }, - "id": "d3bb2767-78bd-4966-b988-392c9ac5babc", + "id": "56551ce3-fa8d-4231-8df1-9dfb294be3a1", "name": "Envia relatorio2", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, @@ -1566,7 +1566,7 @@ { "parameters": { "method": "POST", - "url": "={{ $('Info_Base').item.json.evolution_url }}/message/sendText/{{ $('Info_Base').item.json.instance_name }}", + "url": "={{ $node['Info_Base'].json.evolution_url }}/message/sendText/{{ $node['Info_Base'].json.instance_name }}", "sendHeaders": true, "headerParameters": { "parameters": [ @@ -1576,16 +1576,16 @@ }, { "name": "apikey", - "value": "={{ $('Info_Base').item.json.global_api_key }}" + "value": "={{ $node['Info_Base'].json.global_api_key }}" } ] }, "sendBody": true, "specifyBody": "json", - "jsonBody": "={\"number\":\"{{ $('Info_Base').item.json[\"recebe_relatorio\"] }}\",\"options\":{\"delay\":3000,\"presence\":\"composing\"},\"textMessage\":{\"text\":\"⚠️ *Atenção!* Algumas mensagens da campanha *{{ $('Buscar campanhas').item.json.title }}* podem não ter sido enviadas. ⚠️\\n\\n✔️ Total de envios: {{ $json[\"enviou\"] }}\\n❌ Número de falhas: {{ $json[\"falhou\"] }}\\n#️⃣ Limite restante: {{ $json[\"limite_disparo\"] }}\\n\\nO limite de disparos diários foi excedido. Por favor, verifique os envios ou entre em contato com o suporte para mais informações.\\n\\nObrigado pela compreensão!\"}}", + "jsonBody": "={\"number\":\"{{ $node['Info_Base'].json[\"recebe_relatorio\"] }}\",\"options\":{\"delay\":3000,\"presence\":\"composing\"},\"textMessage\":{\"text\":\"⚠️ *Atenção!* Algumas mensagens da campanha *{{ $node['Buscar campanhas'].json.title }}* podem não ter sido enviadas. ⚠️\\n\\n✔️ Total de envios: {{ $json[\"enviou\"] }}\\n❌ Número de falhas: {{ $json[\"falhou\"] }}\\n#️⃣ Limite restante: {{ $json[\"limite_disparo\"] }}\\n\\nO limite de disparos diários foi excedido. Por favor, verifique os envios ou entre em contato com o suporte para mais informações.\\n\\nObrigado pela compreensão!\"}}", "options": {} }, - "id": "894e381a-fd47-424f-b9f5-098676e0ce00", + "id": "51fef911-88f3-4f42-bbce-8a5c0c03b097", "name": "Envia relatorio1", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, @@ -1601,7 +1601,7 @@ { "parameters": { "method": "POST", - "url": "={{ $('Info_Base').item.json.evolution_url }}/message/sendText/{{ $('Info_Base').item.json.instance_name }}", + "url": "={{ $node['Info_Base'].json.evolution_url }}/message/sendText/{{ $node['Info_Base'].json.instance_name }}", "sendHeaders": true, "headerParameters": { "parameters": [ @@ -1611,16 +1611,16 @@ }, { "name": "apikey", - "value": "={{ $('Info_Base').item.json.global_api_key }}" + "value": "={{ $node['Info_Base'].json.global_api_key }}" } ] }, "sendBody": true, "specifyBody": "json", - "jsonBody": "={\"number\":\"{{ $('Info_Base').item.json[\"recebe_relatorio\"] }}\",\"options\":{\"delay\":3000,\"presence\":\"composing\"},\"textMessage\":{\"text\":\"📢 Notificação Importante 📢\\n\\n🚀 A campanha *{{ $('Buscar campanhas').item.json.title }}* foi iniciada com sucesso! 🎉\\n\\n📲 As mensagens estão sendo enviadas. Fique atento para atualizações.\\n\\nObrigado por utilizar nossos serviços! 😊\"}}", + "jsonBody": "={\"number\":\"{{ $node['Info_Base'].json[\"recebe_relatorio\"] }}\",\"options\":{\"delay\":3000,\"presence\":\"composing\"},\"textMessage\":{\"text\":\"📢 Notificação Importante 📢\\n\\n🚀 A campanha *{{ $node['Buscar campanhas'].json.title }}* foi iniciada com sucesso! 🎉\\n\\n📲 As mensagens estão sendo enviadas. Fique atento para atualizações.\\n\\nObrigado por utilizar nossos serviços! 😊\"}}", "options": {} }, - "id": "b7e1db5a-9530-4907-ae39-6f0a5f92ec9a", + "id": "6a9e4b4a-5946-4588-a01e-bdd79946d59a", "name": "Envia Notificação", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, @@ -1653,7 +1653,7 @@ }, "options": {} }, - "id": "7a474735-c8d1-4993-bc14-101d7106ca00", + "id": "9845d88f-f91b-4636-a266-26053663383f", "name": "Edita Mensagem", "type": "n8n-nodes-base.set", "typeVersion": 3.3, @@ -1684,7 +1684,7 @@ "includeBinary": true } }, - "id": "685aaf58-e036-409c-b7fe-68f924def8c8", + "id": "1fe14c06-c603-40d3-8e63-b9a143d832c3", "name": "Edit Fields", "type": "n8n-nodes-base.set", "typeVersion": 3.2, @@ -1715,7 +1715,7 @@ "includeBinary": true } }, - "id": "4f0af8f5-0fe9-4f9d-a44a-93cacd561eea", + "id": "80452d26-383b-4b83-80ea-57fdcd6d5508", "name": "Edit Fields2", "type": "n8n-nodes-base.set", "typeVersion": 3.2, @@ -1746,7 +1746,7 @@ "jsonBody": "={\n \"number\":\"{{ $node['Edita Mensagem'].json.verificanum }}\",\n \"options\":{\"delay\":3000,\"presence\":\"composing\"},\n \"mediaMessage\":{\"mediatype\":\"image\",\"caption\":\"{{ $json.mensagem }}\",\n \"media\":\"{{ $json[\"img\"] }}\"}\n}\n", "options": {} }, - "id": "a235d6e7-3a28-4625-84f6-30b36505e606", + "id": "444967ea-2d19-4cde-b8ff-8976fbfb3d2b", "name": "Envia msg2", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, @@ -1763,7 +1763,7 @@ { "parameters": { "method": "=POST", - "url": "=https://evo.setabot.com.br/message/sendMedia/SetaBotQRCode", + "url": "={{ $('Info_Base').item.json[\"evolution_url\"] }}/message/sendMedia/{{ $('Info_Base').item.json[\"instance_name\"] }}", "sendHeaders": true, "headerParameters": { "parameters": [ @@ -1773,7 +1773,7 @@ }, { "name": "apikey", - "value": "=d12a3367a8e365ff6bd6df881578fa42" + "value": "={{ $('Info_Base').item.json.global_api_key }}" } ] }, @@ -1782,7 +1782,7 @@ "jsonBody": "={\n \"number\": \"{{ $node['Edita Mensagem'].json.verificanum }}\",\n \"options\": {\n \"delay\": 3000,\n \"presence\": \"composing\"\n },\n \"mediaMessage\": {\n \"mediatype\": \"document\",\n \"media\": \"{{ $json[\"doc\"] }}\",\n \"caption\": \"{{ $json.mensagem }}\",\n \"fileName\": \"documento.pdf\"\n }\n}", "options": {} }, - "id": "bded3f73-8499-4d2d-84df-f088f097df2e", + "id": "45b8f820-8a60-422d-8e35-1079463ce7a4", "name": "Envia msg1", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.1, @@ -2523,12 +2523,12 @@ "settings": { "executionOrder": "v1" }, - "versionId": "23cd186f-7027-4f80-ab81-60c5876a43f1", + "versionId": "3efebeed-0724-4e2c-8599-7ec286418dd7", "meta": { "templateCredsSetupCompleted": true, "instanceId": "33738330930e3881dd5571eca013f36ddf8aab20e4ea5c1f2ebaf4a2b4668ac6" }, - "id": "xVN4ktEqvxZNZVUj", + "id": "Rytft8pRXa8tqKH9", "tags": [ { "createdAt": "2024-06-24T17:54:45.734Z",