mirror of
https://github.com/rodtanci/Disparador-de-Campanha-Chatwoot-Evolution.git
synced 2025-07-13 15:24:47 -06:00
2444 lines
64 KiB
JSON
2444 lines
64 KiB
JSON
{
|
||
"name": "Disparador 1.4",
|
||
"nodes": [
|
||
{
|
||
"parameters": {
|
||
"rule": {
|
||
"interval": [
|
||
{
|
||
"field": "minutes",
|
||
"minutesInterval": 1
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"id": "df9412e7-00cd-4d92-8cd3-4ebe00deaa08",
|
||
"name": "Schedule Trigger",
|
||
"type": "n8n-nodes-base.scheduleTrigger",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-2180,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"dateTime": [
|
||
{
|
||
"value1": "={{ $json.newDate }}",
|
||
"operation": "before",
|
||
"value2": "={{ $now }}"
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"id": "e4d77d82-e6b1-4978-8e5f-f85dc397e76b",
|
||
"name": "Horario",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-1460,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Buscando Campanhas",
|
||
"height": 456.3958547081602,
|
||
"width": 1221.218469617133
|
||
},
|
||
"id": "21a6f283-f8b4-4049-ac4a-5839bd9616a5",
|
||
"name": "Sticky Note5",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-2231.8637163263666,
|
||
840
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Disparador de Campanha para ChatWoot\n## Evolution API\n\n\nv 1.4",
|
||
"height": 163.30528430133387,
|
||
"width": 847.4993167412657,
|
||
"color": 4
|
||
},
|
||
"id": "420e2489-e6d6-455b-9273-fda4f0b8c21a",
|
||
"name": "Sticky Note10",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-1940,
|
||
520
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "subtractFromDate",
|
||
"magnitude": "={{ $json.scheduled_at }}",
|
||
"timeUnit": "hours",
|
||
"duration": 3,
|
||
"options": {
|
||
"includeInputFields": true
|
||
}
|
||
},
|
||
"id": "09bcd224-9782-4cc1-8126-a6ebf9648353",
|
||
"name": "Altera fuso horário",
|
||
"type": "n8n-nodes-base.dateTime",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
-1640,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Busca contatos / Envia campanha\n",
|
||
"height": 918.3121272287237,
|
||
"width": 5519.984579857509,
|
||
"color": 3
|
||
},
|
||
"id": "d5064b32-0f1d-4b60-a202-ff6835ce842b",
|
||
"name": "Sticky Note",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-160,
|
||
780
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT * \nFROM campaigns c \nWHERE account_id = 0\nAND status_envia = 0\nAND inbox_id = 0\nLIMIT 1;",
|
||
"additionalFields": {}
|
||
},
|
||
"id": "31ca0c71-47bf-4bdb-91cb-c3db6e7a3e66",
|
||
"name": "Buscar campanhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-1820,
|
||
1040
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {},
|
||
"id": "6569b14b-5c91-4f26-a358-4a68188b6a29",
|
||
"name": "Repetir ação",
|
||
"type": "n8n-nodes-base.noOp",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
5220,
|
||
1220
|
||
]
|
||
},
|
||
{
|
||
"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": "f1630222-4f51-49db-a87d-e572494e55f9",
|
||
"name": "Time Randon1",
|
||
"type": "n8n-nodes-base.code",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
2400,
|
||
1060
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"amount": "={{ $json.waitTime }}"
|
||
},
|
||
"id": "2e71e55b-0ad7-4037-914c-6fcbff6c3f8a",
|
||
"name": "Tempo de espera1",
|
||
"type": "n8n-nodes-base.wait",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
2580,
|
||
1060
|
||
],
|
||
"webhookId": "0bdd5b4a-c8fb-47d1-ba29-bda564a4edc2"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"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 = {{ $('Info_Base').item.json.chatwoot_account_id }};",
|
||
"options": {}
|
||
},
|
||
"id": "c7e1948f-cb9b-454b-8274-ffd04c416538",
|
||
"name": "Busca contatos",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-80,
|
||
1040
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"string": [
|
||
{
|
||
"value1": "={{ $('Buscar campanhas').item.json.campaign_type }}",
|
||
"value2": "={{ 1 }}"
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"id": "2ce0d3cb-a6d3-48e2-b8e4-cc4cebdc76f2",
|
||
"name": "IF6",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-840,
|
||
1000
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fieldToSplitOut": "audience",
|
||
"include": "allOtherFields",
|
||
"options": {}
|
||
},
|
||
"id": "7860109f-9083-4643-9783-f0032d3ba8c9",
|
||
"name": "Item Lists1",
|
||
"type": "n8n-nodes-base.itemLists",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
-620,
|
||
1000
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Trata mensagem",
|
||
"height": 456.8892799239013,
|
||
"width": 728.217926985971,
|
||
"color": 2
|
||
},
|
||
"id": "f9d06cea-f3cf-4e79-85a0-21895d4a7729",
|
||
"name": "Sticky Note2",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-940,
|
||
840
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"options": {}
|
||
},
|
||
"id": "6dd8ccd7-8836-43cf-9c12-a012e2bb581c",
|
||
"name": "Loop Over Items",
|
||
"type": "n8n-nodes-base.splitInBatches",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
360,
|
||
1020
|
||
],
|
||
"executeOnce": false,
|
||
"alwaysOutputData": false,
|
||
"retryOnFail": false,
|
||
"notesInFlow": false
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "d0205698-dcfd-4d3c-b6e3-dfd7209035c3",
|
||
"leftValue": "={{ $json.limite_disparo }}",
|
||
"rightValue": 1,
|
||
"operator": {
|
||
"type": "number",
|
||
"operation": "gte"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "770fd071-f529-416d-994d-69a89844b586",
|
||
"name": "If",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1520,
|
||
1060
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Contador de limite / Verificação do número",
|
||
"height": 225.35612209945384,
|
||
"width": 853.0984671711764,
|
||
"color": 4
|
||
},
|
||
"id": "014bb3d6-5d40-45aa-820b-c18ea0cefc16",
|
||
"name": "Sticky Note1",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
1320,
|
||
1000
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Tempo entre as mensagens",
|
||
"height": 230.3746650610074,
|
||
"width": 404.53569195365,
|
||
"color": 4
|
||
},
|
||
"id": "6e12ff0b-005b-4254-8427-9000d69aea74",
|
||
"name": "Sticky Note3",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2340,
|
||
1000
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Contabiliza falhas",
|
||
"height": 225.08131697058332,
|
||
"width": 546.5336275124715,
|
||
"color": 2
|
||
},
|
||
"id": "8bdb22cc-29ef-453d-8f6f-23b9018edbd1",
|
||
"name": "Sticky Note6",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
3440,
|
||
1440
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Contabiliza envios",
|
||
"height": 215.09474919455494,
|
||
"width": 376.16757486051324,
|
||
"color": 2
|
||
},
|
||
"id": "db50c90e-12eb-4625-95b9-e9d399151bed",
|
||
"name": "Sticky Note7",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
3460,
|
||
980
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT falhou\nFROM campaigns\nWHERE id = {{ $('IF6').item.json.id }};",
|
||
"options": {
|
||
"queryReplacement": "="
|
||
}
|
||
},
|
||
"id": "a2c3ee35-318b-4c2a-b633-5802b539ed32",
|
||
"name": "Busca falhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3480,
|
||
1480
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT enviou\nFROM campaigns\nWHERE id = {{ $('IF6').item.json.id }};",
|
||
"options": {}
|
||
},
|
||
"id": "e18445ec-3c89-4daa-bee0-ce018ee782e4",
|
||
"name": "Busca envios",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3520,
|
||
1040
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"assignments": {
|
||
"assignments": [
|
||
{
|
||
"id": "cbb23691-dfc9-413f-b996-ba0515b0a902",
|
||
"name": "etiqueta",
|
||
"value": "={{ $('Buscar campanhas').item.json.audience[0].id }}",
|
||
"type": "number"
|
||
},
|
||
{
|
||
"id": "7a194f32-e774-4d48-94ed-1e2c9b9fd025",
|
||
"name": "msg.title",
|
||
"value": "={{ $('Buscar campanhas').item.json.title }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "4dc32df3-cc5a-4a9b-8dcd-2d3f8a50a6fd",
|
||
"name": "msg.message",
|
||
"value": "={{ $('Buscar campanhas').item.json.message }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "3b2fef42-7655-4ebc-ac93-1a25f77cbec1",
|
||
"name": "anexo",
|
||
"value": "={{ $('IF6').item.json.message.split('&anexo=')[1].split('&')[0] }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "66e5ac5e-5cef-4737-81d8-9457f8fb8536",
|
||
"name": "nomecontato",
|
||
"value": "={{ $json.message.match(/&nome/)[0] }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "afa0b53c-9933-44e1-ab91-49a9540f9c7d",
|
||
"name": "emailcontato",
|
||
"value": "={{ $json.message.match(/&email/)[0] }}",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "9eb416bc-6536-4451-8c02-d5cc53be1a5b",
|
||
"name": "Campanha",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
-420,
|
||
1000
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Relatorio da campanha",
|
||
"height": 346.43605543050865,
|
||
"width": 1085.0447604700087
|
||
},
|
||
"id": "2df465ec-5503-48ba-8b63-e50ba25c84ec",
|
||
"name": "Sticky Note8",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
1060,
|
||
414.55190978677456
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Limite exedido",
|
||
"height": 339.69571412210314,
|
||
"width": 1088.2492332463764
|
||
},
|
||
"id": "5c13909c-a2a4-450d-b4cc-89d3f27a29e7",
|
||
"name": "Sticky Note9",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
1060,
|
||
20
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $('Info_Base').item.json.evolution_url }}/message/sendText/{{ $('Info_Base').item.json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "accept",
|
||
"value": "application/json, text/plain, */*"
|
||
},
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $('Info_Base').item.json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\"number\":\"{{ $('Info_Base').item.json[\"recebe_relatorio\"] }}@s.whatsapp.net\",\"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!\"}}",
|
||
"options": {}
|
||
},
|
||
"id": "3cfac788-cb77-44a6-867d-a1bd58a8be31",
|
||
"name": "Envia relatorio",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
1620,
|
||
480
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $('Info_Base').item.json.evolution_url }}/message/sendText/{{ $('Info_Base').item.json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "accept",
|
||
"value": "application/json, text/plain, */*"
|
||
},
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $('Info_Base').item.json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\"number\":\"{{ $('Info_Base').item.json[\"recebe_relatorio\"] }}@s.whatsapp.net\",\"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!\"}}",
|
||
"options": {}
|
||
},
|
||
"id": "4db3e2e4-477d-4479-a604-041a486c9857",
|
||
"name": "Envia relatorio1",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
1620,
|
||
80
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE campaigns\nSET enviou = {{ $json.enviou +1 }}\nWHERE id = {{ $('IF6').item.json.id }};",
|
||
"options": {}
|
||
},
|
||
"id": "a28b4838-4358-4a33-a62a-2b92f68b5399",
|
||
"name": "Adiciona envios",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3680,
|
||
1040
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Sem Anexo",
|
||
"height": 199.63817652105178,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "d336ca85-7a02-4183-a8c9-3241941e88ff",
|
||
"name": "Sticky Note4",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
3080,
|
||
840
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Com Anexo",
|
||
"height": 221.17684873191945,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "e820b701-c153-48ea-ae5f-4a217e4993a1",
|
||
"name": "Sticky Note11",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
3080,
|
||
1100
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "daf39b75-a974-426f-a6f7-197497d2fa94",
|
||
"leftValue": "={{ $('Campanha').item.json.anexo }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "b86f94c7-58d9-4a4e-bd00-3187ad5453b3",
|
||
"name": "If1",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
2840,
|
||
1080
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "ebbe2797-49a1-47e7-9c54-161ff02dfa49",
|
||
"leftValue": "={{ $('Campanha').item.json.nomecontato }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
},
|
||
{
|
||
"id": "77ff2a0a-ae27-427a-b489-2daac4e90429",
|
||
"leftValue": "{{ $('Campanha').item.json.emailcontato}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "or"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "e20fdd84-acef-4f59-9067-a499f4c679a4",
|
||
"name": "If2",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
720,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"assignments": {
|
||
"assignments": [
|
||
{
|
||
"id": "a588a036-88bc-4bc2-aefa-a2c0b9af2000",
|
||
"name": "var_msg",
|
||
"value": "={{ $('IF6').item.json.message.split('&nome').join($json.name).split('&email').join($json.email) }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "16d86caa-9f85-496d-ae3d-7ad024e100d7",
|
||
"name": "verificanum",
|
||
"value": "={{ $('Loop Over Items').item.json.phone_number }}",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "6e375813-6614-4379-b24b-f342ebe057ef",
|
||
"name": "Edita Mensagem",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
1040,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fields": {
|
||
"values": [
|
||
{
|
||
"name": "mensagem",
|
||
"stringValue": "={{ $('Edita Mensagem').item.json.var_msg.split(\"&anexo=\")[0].replace(/\\n/g, \"\\\\n\") }}"
|
||
},
|
||
{
|
||
"name": "titulo",
|
||
"stringValue": "={{ $('Campanha').item.json.msg.title }}"
|
||
},
|
||
{
|
||
"name": "anexo",
|
||
"stringValue": "={{ $('Campanha').item.json.anexo }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {
|
||
"includeBinary": true
|
||
}
|
||
},
|
||
"id": "a301f4fc-5aa1-4455-aae8-e70e22d90731",
|
||
"name": "Edit Fields2",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.2,
|
||
"position": [
|
||
3120,
|
||
1160
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Resolve Conversa\n** Se a conversa estiver aberta mantém / Se for uma conversa nova ele fecha!",
|
||
"height": 331.5360284004761,
|
||
"width": 1227.4972493046307
|
||
},
|
||
"id": "45b7cb55-34cf-4743-97f9-b9a2cdca25af",
|
||
"name": "Sticky Note12",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
3920,
|
||
940
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"assignments": {
|
||
"assignments": [
|
||
{
|
||
"id": "a8de3538-0eac-4149-aaf9-7bc2c5c4b00e",
|
||
"name": "id_caixa",
|
||
"value": "={{ $('Info_Base').item.json.id_caixa }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "04e8a587-52b0-4ddc-877e-e97fdd1ef171",
|
||
"name": "id_contato",
|
||
"value": "={{ $('Busca Contato Existe').item.json.payload[0].id }}",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "e526be1e-6905-4be5-aef1-541462208923",
|
||
"name": "Salva conversa",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
4540,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "493b5963-2314-4179-a065-3a9aca90749e",
|
||
"leftValue": "={{ $json.payload[0].status }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "exists",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "1cefb0c1-9968-4353-86cb-ae6752b83841",
|
||
"name": "If3",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
4280,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"amount": 1
|
||
},
|
||
"id": "fa8858cd-ad13-4e10-a7e5-2a0f72809c52",
|
||
"name": "Wait",
|
||
"type": "n8n-nodes-base.wait",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
4700,
|
||
1040
|
||
],
|
||
"webhookId": "8fd175c2-2dff-44c3-b12f-b7f2dd0aa8da"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Resolve Conversa",
|
||
"height": 246.1701698163285,
|
||
"width": 704.4608631799392
|
||
},
|
||
"id": "6c8723be-4c21-4085-a1e1-1f41c36eec43",
|
||
"name": "Sticky Note13",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2340,
|
||
280
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $('Info_Base').item.json.evolution_url }}/message/sendText/{{ $('Info_Base').item.json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "accept",
|
||
"value": "application/json, text/plain, */*"
|
||
},
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $('Info_Base').item.json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\"number\":\"{{ $('Info_Base').item.json[\"recebe_relatorio\"] }}@s.whatsapp.net\",\"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! 😊\"}}",
|
||
"options": {}
|
||
},
|
||
"id": "e6d6314b-e896-4068-9319-3a26e0f28539",
|
||
"name": "Envia Notificação",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
160,
|
||
920
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT limite_disparo\nFROM accounts\nWHERE id ={{ $('Info_Base').item.json.chatwoot_account_id }};",
|
||
"options": {
|
||
"queryReplacement": "="
|
||
}
|
||
},
|
||
"id": "a2f504ed-1d2a-4f80-a0be-71bf54497224",
|
||
"name": "Busca limite diario",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
1360,
|
||
1060
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fromEmail": "suportesetabot@gmail.com",
|
||
"toEmail": "={{ $node['Info_Base'].json.email_relatorio }}",
|
||
"subject": "SetaBot - Limite de disparo excedido",
|
||
"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": "fceabe06-aa17-4c73-8da9-76e4fe2c1f3b",
|
||
"name": "Send Email",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1800,
|
||
80
|
||
],
|
||
"credentials": {
|
||
"smtp": {
|
||
"id": "VmMDyV2dTfPZUzPS",
|
||
"name": "SMTP account"
|
||
}
|
||
},
|
||
"continueOnFail": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fromEmail": "suportesetabot@gmail.com",
|
||
"toEmail": "={{ $node['Info_Base'].json.email_relatorio }}",
|
||
"subject": "SetaBot - Relatório a Campanha",
|
||
"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": "f7358a3e-8d88-424a-b45c-3fb638b00a38",
|
||
"name": "Send Email1",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1800,
|
||
480
|
||
],
|
||
"credentials": {
|
||
"smtp": {
|
||
"id": "VmMDyV2dTfPZUzPS",
|
||
"name": "SMTP account"
|
||
}
|
||
},
|
||
"continueOnFail": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "c2573aed-9acc-4fc6-a799-b11e2191d408",
|
||
"leftValue": "={{ $json.exists }}",
|
||
"rightValue": "true",
|
||
"operator": {
|
||
"type": "boolean",
|
||
"operation": "true",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "f5dbcfdb-e59e-4fef-adb5-1347eb42c94a",
|
||
"name": "If4",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1860,
|
||
1060
|
||
]
|
||
},
|
||
{
|
||
"parameters": {},
|
||
"id": "4f93a4ed-1767-4a3d-93e3-f10306b673f2",
|
||
"name": "Wait1",
|
||
"type": "n8n-nodes-base.wait",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
2396,
|
||
360
|
||
],
|
||
"webhookId": "e8e42f37-7b79-4a59-8860-fc20f3f45816"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE campaigns\nSET falhou = {{ $json.falhou +1 }}\nWHERE id = {{ $('IF6').item.json.id }};",
|
||
"options": {}
|
||
},
|
||
"id": "b4d11043-cbff-456d-8ebd-b918a5182b23",
|
||
"name": "Adiciona num de falhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3660,
|
||
1480
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"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": "a0080581-0363-443a-ab30-dc5aae547d52",
|
||
"name": "Adiciona num não enviado",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3840,
|
||
1480
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "0ed1f598-cec8-458a-97d7-1d82aedf251e",
|
||
"leftValue": "{{ $json.count }}",
|
||
"rightValue": "0",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "equals"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "148d0eee-70dc-46ac-8914-6b48504433c8",
|
||
"name": "If5",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1440,
|
||
180
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"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 = {{ $('IF6').item.json.id }};",
|
||
"options": {
|
||
"queryReplacement": "="
|
||
}
|
||
},
|
||
"id": "31ba7841-82b6-41da-a65c-3028c060cceb",
|
||
"name": "Notifica limite excedido",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
1120,
|
||
180
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "69cc2650-7d52-4da1-b391-a88b2326d63d",
|
||
"leftValue": "={{ $json.count }}",
|
||
"rightValue": "0",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "equals"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "ae876166-cf20-4ecd-99db-c72fe39ba83f",
|
||
"name": "If6",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1440,
|
||
580
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"keepOnlySet": true,
|
||
"values": {
|
||
"string": [
|
||
{
|
||
"name": "chatwoot_url",
|
||
"value": "https://urlchatwoot.com"
|
||
},
|
||
{
|
||
"name": "evolution_url",
|
||
"value": "https://urlevo.com"
|
||
},
|
||
{
|
||
"name": "chatwoot_token",
|
||
"value": "token perfil chatwoot"
|
||
},
|
||
{
|
||
"name": "global_api_key",
|
||
"value": "global api evo"
|
||
},
|
||
{
|
||
"name": "instance_name",
|
||
"value": "nome da tenancia evo"
|
||
},
|
||
{
|
||
"name": "id_caixa",
|
||
"value": "id caixa evo"
|
||
},
|
||
{
|
||
"name": "chatwoot_account_id",
|
||
"value": "id conta chatwoot"
|
||
},
|
||
{
|
||
"name": "email_relatorio",
|
||
"value": "email@email.com"
|
||
},
|
||
{
|
||
"name": "recebe_relatorio",
|
||
"value": "551199996666"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "99768971-6cf8-4d75-8ca6-2f4651f9d0c5",
|
||
"name": "Info_Base",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
-2000,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"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": "bb069edf-20a3-458d-a7d2-6276b0100417",
|
||
"name": "Code",
|
||
"type": "n8n-nodes-base.code",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1620,
|
||
620
|
||
]
|
||
},
|
||
{
|
||
"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": "e3f9e7af-0d04-4921-8b0b-0738e8fa62b3",
|
||
"name": "Code1",
|
||
"type": "n8n-nodes-base.code",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1620,
|
||
220
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fromEmail": "suportesetabot@gmail.com",
|
||
"toEmail": "={{ $node['Info_Base'].json.email_relatorio }}",
|
||
"subject": "SetaBot - Relatório a Campanha",
|
||
"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": "e2bdb92d-b801-402f-ab2b-850ec53696dc",
|
||
"name": "Send Email2",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1980,
|
||
620
|
||
],
|
||
"credentials": {
|
||
"smtp": {
|
||
"id": "VmMDyV2dTfPZUzPS",
|
||
"name": "SMTP account"
|
||
}
|
||
},
|
||
"continueOnFail": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $node['Info_Base'].json[\"evolution_url\"] }}/message/sendText/{{ $node['Info_Base'].json[\"instance_name\"] }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "accept",
|
||
"value": "application/json, text/plain, */*"
|
||
},
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $node['Info_Base'].json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\n \"number\": \"{{ $node['Info_Base'].json['recebe_relatorio'] }}@s.whatsapp.net\",\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 ",
|
||
"options": {}
|
||
},
|
||
"id": "3d1257d5-976f-4fc2-b19e-bbc030321c2b",
|
||
"name": "Envia relatorio3",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
1800,
|
||
620
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"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": "a956404d-11b2-4be8-bac1-e3cecf566476",
|
||
"name": "Postgres1",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
1280,
|
||
180
|
||
],
|
||
"alwaysOutputData": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $node['Info_Base'].json[\"evolution_url\"] }}/message/sendText/{{ $node['Info_Base'].json[\"instance_name\"] }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "accept",
|
||
"value": "application/json, text/plain, */*"
|
||
},
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $node['Info_Base'].json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\"number\":\"{{ $node['Info_Base'].json[\"recebe_relatorio\"] }}@s.whatsapp.net\",\"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",
|
||
"options": {}
|
||
},
|
||
"id": "a7fb9a00-ccf0-4ee5-9839-0e2e5872a4ef",
|
||
"name": "Envia relatorio2",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
1800,
|
||
220
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fromEmail": "suportesetabot@gmail.com",
|
||
"toEmail": "={{ $node['Info_Base'].json.email_relatorio }}",
|
||
"subject": "SetaBot - Limite de disparo excedido",
|
||
"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": "2e6e0b20-2b33-4f96-aef8-002850819abf",
|
||
"name": "Send Email3",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1980,
|
||
220
|
||
],
|
||
"credentials": {
|
||
"smtp": {
|
||
"id": "VmMDyV2dTfPZUzPS",
|
||
"name": "SMTP account"
|
||
}
|
||
},
|
||
"continueOnFail": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"assignments": {
|
||
"assignments": [
|
||
{
|
||
"id": "4e7aab24-149c-4afb-8970-97f3f4b91841",
|
||
"name": "etiqueta",
|
||
"value": "={{ $node['Buscar campanhas'].json.audience[0].id }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "93fad362-a35a-43c8-85ce-9d8dff3a28ad",
|
||
"name": "titulo_campanha",
|
||
"value": "={{ $node['Campanha'].json.msg.title }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "ae1dace5-7708-4042-a4f6-5d34a6b046bd",
|
||
"name": "id_campanha",
|
||
"value": "={{ $node['Buscar campanhas'].json.id }}",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "6798ffb0-9f2c-4ab3-a33c-84636ecaff3f",
|
||
"name": "Dados da campanha",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
800,
|
||
600
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fieldToSplitOut": "audience",
|
||
"include": "allOtherFields",
|
||
"options": {}
|
||
},
|
||
"id": "3c20c311-5206-4ba8-84f0-da39fd9df4cb",
|
||
"name": "Tratamento de lista",
|
||
"type": "n8n-nodes-base.itemLists",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
580,
|
||
860
|
||
],
|
||
"alwaysOutputData": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"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": "f13d2446-d9fc-49de-8619-615fc7769548",
|
||
"name": "Postgres",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
1280,
|
||
580
|
||
],
|
||
"alwaysOutputData": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"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": "518fde65-a11d-4da2-a160-3f795cf3f231",
|
||
"name": "Resumo relatorio",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
1120,
|
||
580
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"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": "2a5f3360-6846-41bd-a9ae-606bb87dde76",
|
||
"name": "Subtrair",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2040,
|
||
1060
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"url": "={{ $node['Info_Base'].json.chatwoot_url }}/api/v1/accounts/{{ $node['Info_Base'].json.chatwoot_account_id }}/contacts/{{ $json.payload[0].id }}/conversations",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "api_access_token",
|
||
"value": "={{ $node['Info_Base'].json.chatwoot_token }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "6fcd0f25-daf9-45d1-b4dc-7b581cfda4c4",
|
||
"name": "Abre conversa de contato existente",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
4120,
|
||
1040
|
||
],
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"url": "={{ $node['Info_Base'].json.chatwoot_url }}/api/v1/accounts/{{ $node['Info_Base'].json.chatwoot_account_id }}/contacts/search",
|
||
"sendQuery": true,
|
||
"queryParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "q",
|
||
"value": "={{ $node['Edita Mensagem'].json.verificanum }}"
|
||
}
|
||
]
|
||
},
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "api_access_token",
|
||
"value": "={{ $node['Info_Base'].json.chatwoot_token }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "6e07b8a8-5a3e-416b-afa3-f5924dabbbea",
|
||
"name": "Busca Contato Existe",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
3960,
|
||
1040
|
||
],
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $('Info_Base').item.json.evolution_url }}/message/sendMedia/{{ $('Info_Base').item.json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "accept",
|
||
"value": "application/json, text/plain, */*"
|
||
},
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $('Info_Base').item.json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\n \"number\":\"{{ $node['Edita Mensagem'].json.verificanum }}\",\n \"options\":{\"delay\":3000,\"presence\":\"composing\"},\n \"mediaMessage\":{\"mediatype\":\"image\",\"caption\":\"{{ $json.mensagem }}\",\n \"media\":\"{{ $json[\"anexo\"] }}\"}\n}\n",
|
||
"options": {}
|
||
},
|
||
"id": "c48d4efa-ffb8-4915-bf79-6ed888abea56",
|
||
"name": "Envia msg2",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
3260,
|
||
1160
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true,
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "=POST",
|
||
"url": "={{ $('Info_Base').item.json.evolution_url }}/message/sendText/{{ $('Info_Base').item.json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "accept",
|
||
"value": "application/json, text/plain, */*"
|
||
},
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $('Info_Base').item.json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"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": "7860bbe5-7edd-4ded-aeea-f66c0557c6bc",
|
||
"name": "Envia msg",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
3180,
|
||
880
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true,
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $node['Info_Base'].json.evolution_url }}/chat/whatsappNumbers/{{ $node['Info_Base'].json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "Content-Type",
|
||
"value": "application/json"
|
||
},
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $node['Info_Base'].json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\n \"numbers\": [\n \"{{ $node['Edita Mensagem'].json.verificanum }}\"\n ]\n} ",
|
||
"options": {}
|
||
},
|
||
"id": "8c4b60db-444b-407e-9dc1-215312202554",
|
||
"name": "HTTP Request1",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.2,
|
||
"position": [
|
||
1700,
|
||
1060
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $node['Info_Base'].json.chatwoot_url }}/api/v1/accounts/{{ $node['Info_Base'].json.chatwoot_account_id }}/conversations/{{ $json.payload[0].id }}/toggle_status",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "api_access_token",
|
||
"value": "={{ $node['Info_Base'].json[\"chatwoot_token\"] }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\n\"status\": \"resolved\"\n}",
|
||
"options": {}
|
||
},
|
||
"id": "345da7fb-df6f-473f-9512-7c1c5df15313",
|
||
"name": "Fecha Conversa",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
2876,
|
||
360
|
||
],
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"url": "={{ $node['Info_Base'].json.chatwoot_url }}/api/v1/accounts/{{ $node['Info_Base'].json.chatwoot_account_id }}/contacts/{{ $json.payload[0].id }}/conversations",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "api_access_token",
|
||
"value": "={{ $node['Info_Base'].json.chatwoot_token }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "2eb9fb31-8438-40c1-8a2e-64d8c64e7917",
|
||
"name": "Seleciona conversa",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
2716,
|
||
360
|
||
],
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"url": "={{ $node['Info_Base'].json.chatwoot_url }}/api/v1/accounts/{{ $node['Info_Base'].json.chatwoot_account_id }}/contacts/search",
|
||
"sendQuery": true,
|
||
"queryParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "q",
|
||
"value": "=+{{ $node['Info_Base'].json[\"recebe_relatorio\"] }}"
|
||
}
|
||
]
|
||
},
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "api_access_token",
|
||
"value": "={{ $node['Info_Base'].json.chatwoot_token }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "e6f5a645-89d0-4df2-b74a-69d368f01395",
|
||
"name": "Busca Contato do Relatorio",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
2560,
|
||
360
|
||
],
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE conversations\nSET status = 1\nWHERE contact_id = {{ $json.id_contato }};",
|
||
"options": {}
|
||
},
|
||
"id": "ceaa85f0-b6c2-40f1-801b-b372fd29fb92",
|
||
"name": "Resolve Conversa",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
4880,
|
||
1040
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
},
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE campaigns SET status_envia = 1 WHERE id = {{ $json.id }}",
|
||
"options": {}
|
||
},
|
||
"id": "071c4f11-eb86-4723-b6cc-1ffe021261f8",
|
||
"name": "UPDATE CAMPANHA",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-1200,
|
||
860
|
||
],
|
||
"alwaysOutputData": false,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "CbrIGpLnj1oilB4h",
|
||
"name": "Chatwoot"
|
||
}
|
||
}
|
||
}
|
||
],
|
||
"pinData": {},
|
||
"connections": {
|
||
"Schedule Trigger": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Info_Base",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Horario": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "IF6",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "UPDATE CAMPANHA",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Altera fuso horário": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Horario",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Buscar campanhas": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Altera fuso horário",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Repetir ação": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Loop Over Items",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Time Randon1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Tempo de espera1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Tempo de espera1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca contatos": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia Notificação",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Loop Over Items",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"IF6": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Item Lists1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Item Lists1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Campanha",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Loop Over Items": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Tratamento de lista",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "If2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "HTTP Request1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Notifica limite excedido",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca falhas": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Adiciona num de falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca envios": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Adiciona envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Campanha": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca contatos",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Adiciona envios": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca Contato Existe",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia msg",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Edit Fields2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Edita Mensagem": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca limite diario",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Edit Fields2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia msg2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Salva conversa": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Wait",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If3": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Repetir ação",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Salva conversa",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Wait": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Resolve Conversa",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia relatorio1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Send Email",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Wait1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia relatorio": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Send Email1",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Wait1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca limite diario": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Edita Mensagem",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Edita Mensagem",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If4": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Subtrair",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Wait1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca Contato do Relatorio",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Adiciona num de falhas": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Adiciona num não enviado",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Adiciona num não enviado": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Repetir ação",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If5": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia relatorio1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Code1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Notifica limite excedido": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Postgres1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If6": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia relatorio",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Code",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Info_Base": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Buscar campanhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Code": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia relatorio3",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Code1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia relatorio2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia relatorio3": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Send Email2",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Wait1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Postgres1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If5",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia relatorio2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Send Email3",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Wait1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Dados da campanha": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Resumo relatorio",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Tratamento de lista": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Dados da campanha",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Postgres": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If6",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Resumo relatorio": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Postgres",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Subtrair": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Time Randon1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Abre conversa de contato existente": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If3",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca Contato Existe": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Abre conversa de contato existente",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia msg2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia msg": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"HTTP Request1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If4",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Seleciona conversa": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Fecha Conversa",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca Contato do Relatorio": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Seleciona conversa",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Resolve Conversa": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Repetir ação",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
}
|
||
},
|
||
"active": false,
|
||
"settings": {
|
||
"executionOrder": "v1"
|
||
},
|
||
"versionId": "fa7b8249-f5c1-4503-bfbe-9382db29bd1f",
|
||
"meta": {
|
||
"templateCredsSetupCompleted": true,
|
||
"instanceId": "33738330930e3881dd5571eca013f36ddf8aab20e4ea5c1f2ebaf4a2b4668ac6"
|
||
},
|
||
"id": "nWWO8OiP6ELR2nnE",
|
||
"tags": [
|
||
{
|
||
"createdAt": "2024-06-24T17:54:45.734Z",
|
||
"updatedAt": "2024-06-24T17:54:45.734Z",
|
||
"id": "W4QFAwjDhUwUJMhH",
|
||
"name": "Dev"
|
||
}
|
||
]
|
||
}
|