mirror of
https://github.com/rodtanci/Disparador-de-Campanha-Chatwoot-Evolution.git
synced 2025-07-13 15:24:47 -06:00
3139 lines
82 KiB
JSON
3139 lines
82 KiB
JSON
{
|
||
"name": "Disparador SAAS",
|
||
"nodes": [
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"dateTime": [
|
||
{
|
||
"value1": "={{ $json.newDate }}",
|
||
"operation": "before",
|
||
"value2": "={{ $now }}"
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"id": "3f472360-5bce-44a8-9a70-af341d70158c",
|
||
"name": "Horario",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-2860,
|
||
1000
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Buscando Campanhas",
|
||
"height": 496,
|
||
"width": 1604
|
||
},
|
||
"id": "593cbe87-2fa6-45f9-aa9e-5a6a23725b8e",
|
||
"name": "Sticky Note5",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-3700,
|
||
800
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Disparador de Campanha para ChatWoot [SAAS]\n## Evolution API V2\n\n\nv 2.0",
|
||
"height": 163.30528430133387,
|
||
"width": 847.4993167412657,
|
||
"color": 4
|
||
},
|
||
"id": "7e875f9d-0a06-44fa-82a8-38d7c0fcb00d",
|
||
"name": "Sticky Note10",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-3000,
|
||
500
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "subtractFromDate",
|
||
"magnitude": "={{ $json.scheduled_at }}",
|
||
"timeUnit": "hours",
|
||
"duration": 3,
|
||
"options": {
|
||
"includeInputFields": true
|
||
}
|
||
},
|
||
"id": "207d7a90-839a-40ce-ada4-64879a90c03c",
|
||
"name": "Altera fuso horário",
|
||
"type": "n8n-nodes-base.dateTime",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
-3040,
|
||
1000
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Busca contatos / Envia campanha\n",
|
||
"height": 1511.1902423284298,
|
||
"width": 5519.984579857509,
|
||
"color": 3
|
||
},
|
||
"id": "612e3a8a-3ae9-4bea-89e8-8b01148c8593",
|
||
"name": "Sticky Note",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-1220,
|
||
760
|
||
]
|
||
},
|
||
{
|
||
"parameters": {},
|
||
"id": "36b06748-a057-490d-8372-38e8906089d2",
|
||
"name": "Repetir ação",
|
||
"type": "n8n-nodes-base.noOp",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
4160,
|
||
1200
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"jsCode": "// Este exemplo gera um tempo de espera aleatório entre 10 e 60 segundos\nconst minWait = 15; // Tempo mínimo de espera em segundos\nconst maxWait = 25; // 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": "4e993bdf-ec65-4fd2-8e79-9de647415c8e",
|
||
"name": "Time Randon1",
|
||
"type": "n8n-nodes-base.code",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1340,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"amount": "={{ $json.waitTime }}"
|
||
},
|
||
"id": "91b517d3-067a-4379-9cdc-90b094fa16d2",
|
||
"name": "Tempo de espera1",
|
||
"type": "n8n-nodes-base.wait",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
1520,
|
||
1040
|
||
],
|
||
"webhookId": "4036d994-e204-470a-82d9-1ac3c5244871"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"string": [
|
||
{
|
||
"value1": "={{ $('Buscar campanhas').item.json.campaign_type }}",
|
||
"value2": "={{ 1 }}"
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"id": "dd7343a9-efe5-436f-b5a7-5c36b566dcb4",
|
||
"name": "IF6",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-1980,
|
||
980
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fieldToSplitOut": "audience",
|
||
"include": "allOtherFields",
|
||
"options": {}
|
||
},
|
||
"id": "e0aa0a64-9fe9-448c-8a73-a358a78bfcde",
|
||
"name": "Item Lists1",
|
||
"type": "n8n-nodes-base.itemLists",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
-1780,
|
||
980
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Trata mensagem",
|
||
"height": 457,
|
||
"width": 808,
|
||
"color": 2
|
||
},
|
||
"id": "407a112e-d624-40d0-b210-7e1f19405fa4",
|
||
"name": "Sticky Note2",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-2060,
|
||
820
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"options": {}
|
||
},
|
||
"id": "6826e8f1-3f3c-4453-b276-d9700c61545d",
|
||
"name": "Loop Over Items",
|
||
"type": "n8n-nodes-base.splitInBatches",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
-700,
|
||
1000
|
||
],
|
||
"executeOnce": false,
|
||
"alwaysOutputData": false,
|
||
"retryOnFail": false,
|
||
"notesInFlow": false
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "d0205698-dcfd-4d3c-b6e3-dfd7209035c3",
|
||
"leftValue": "={{ $json.limite_disparo }}",
|
||
"rightValue": 1,
|
||
"operator": {
|
||
"type": "number",
|
||
"operation": "gte"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "87f85e93-de32-4e20-b8ce-0252e856463b",
|
||
"name": "If",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
460,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Contador de limite / Verificação do número",
|
||
"height": 225.35612209945384,
|
||
"width": 853.0984671711764,
|
||
"color": 4
|
||
},
|
||
"id": "3ced0f0b-a465-4567-89bd-6915624fa03d",
|
||
"name": "Sticky Note1",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
260,
|
||
980
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Tempo entre as mensagens",
|
||
"height": 230.3746650610074,
|
||
"width": 404.53569195365,
|
||
"color": 4
|
||
},
|
||
"id": "00c7a988-f4dd-48b3-9f8b-7819ea674205",
|
||
"name": "Sticky Note3",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
1280,
|
||
980
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Contabiliza falhas",
|
||
"height": 225.08131697058332,
|
||
"width": 546.5336275124715,
|
||
"color": 2
|
||
},
|
||
"id": "04a3be35-1d4d-43cf-a5c9-410c9f66f70c",
|
||
"name": "Sticky Note6",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2660,
|
||
1380
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Contabiliza envios",
|
||
"height": 215.09474919455494,
|
||
"width": 376.16757486051324,
|
||
"color": 2
|
||
},
|
||
"id": "f769be04-b385-45f4-82d6-aadc7b6619cf",
|
||
"name": "Sticky Note7",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2400,
|
||
960
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT falhou\nFROM campaigns\nWHERE id = {{ $('Campanha').item.json.id.campanha }};",
|
||
"options": {
|
||
"queryReplacement": "="
|
||
}
|
||
},
|
||
"id": "a2723719-cde1-4eb1-8fba-72073dc48847",
|
||
"name": "Busca falhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2700,
|
||
1420
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT enviou\nFROM campaigns\nWHERE id = {{ $('Campanha').item.json.id.campanha }};",
|
||
"options": {}
|
||
},
|
||
"id": "a255727f-0b78-429a-96ca-feae9e8fe162",
|
||
"name": "Busca envios",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2460,
|
||
1020
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"assignments": {
|
||
"assignments": [
|
||
{
|
||
"id": "cbb23691-dfc9-413f-b996-ba0515b0a902",
|
||
"name": "etiqueta",
|
||
"value": "={{ $('Buscar campanhas').item.json.audience ? $('Buscar campanhas').item.json.audience.map(a => a.id).join(',') : '0' }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"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": "img",
|
||
"value": "={{ $('Buscar campanhas').item.json.message.split('&img=')[1].split('&')[0] }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "66e5ac5e-5cef-4737-81d8-9457f8fb8536",
|
||
"name": "nomecontato",
|
||
"value": "={{ $('Buscar campanhas').item.json.message.match(/&nome/)[0] }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "afa0b53c-9933-44e1-ab91-49a9540f9c7d",
|
||
"name": "emailcontato",
|
||
"value": "={{ $('Buscar campanhas').item.json.message.match(/&email/)[0] }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "fde7488d-6bca-4057-a2c3-17cd21ea41cd",
|
||
"name": "doc",
|
||
"value": "={{ $('Buscar campanhas').item.json.message.split('&doc=')[1].split('&')[0] }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "459f505e-48c9-4829-a151-e9a9c651901c",
|
||
"name": "vid",
|
||
"value": "={{ $('Buscar campanhas').item.json.message.split('&vid=')[1].split('&')[0] }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "d5e7b83d-8c4b-4f2c-9905-1d6921d6a303",
|
||
"name": "audio",
|
||
"value": "={{ $('IF6').item.json.message.split('&audio=')[1].split('&')[0] }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "3d8f599b-3796-4538-8e78-a29494e85e40",
|
||
"name": "origemcontato",
|
||
"value": "={{ $json.audience.type }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "b596f98b-fbe0-44d7-98b0-667b4530c8e9",
|
||
"name": "id.campanha",
|
||
"value": "={{ $('Loop Over Items1').item.json.id }}",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "43da7f9e-a78f-45a4-89f3-a2a0aaae2323",
|
||
"name": "Campanha",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
-1600,
|
||
980
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Relatorio da campanha",
|
||
"height": 346.43605543050865,
|
||
"width": 1085.0447604700087
|
||
},
|
||
"id": "8a32c7a6-426b-416c-8bdd-88d9082c874f",
|
||
"name": "Sticky Note8",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
0,
|
||
400
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Limite excedido ",
|
||
"height": 339.69571412210314,
|
||
"width": 1088.2492332463764
|
||
},
|
||
"id": "25402b02-511f-4681-a5fc-7dab0db550c9",
|
||
"name": "Sticky Note9",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
0,
|
||
0
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE campaigns\nSET enviou = {{ $json.enviou +1 }}\nWHERE id = {{ $('Campanha').item.json.id.campanha }};",
|
||
"options": {}
|
||
},
|
||
"id": "519e81fe-0cab-49d0-9c58-763f5a7c1da1",
|
||
"name": "Adiciona envios",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2620,
|
||
1020
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Somente texto",
|
||
"height": 199.63817652105178,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "4da2c8cb-f733-48ea-bfa3-a9605645452c",
|
||
"name": "Sticky Note4",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2020,
|
||
820
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Com imagem",
|
||
"height": 221.17684873191945,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "4fb8c8ed-784d-4a33-ba5d-36d39a006b68",
|
||
"name": "Sticky Note11",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2020,
|
||
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": "8b433f82-ad62-4dcf-a46a-b2308f9fdc57",
|
||
"name": "If2",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
-340,
|
||
1020
|
||
]
|
||
},
|
||
{
|
||
"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": "57aae490-bc73-4e58-9eff-1a349a60373c",
|
||
"name": "Sticky Note12",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2860,
|
||
920
|
||
]
|
||
},
|
||
{
|
||
"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": "f0ce3f2c-4a9d-4841-9f73-d519c3ac205d",
|
||
"name": "Salva conversa",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
3480,
|
||
1020
|
||
]
|
||
},
|
||
{
|
||
"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": "40a4e8a1-b611-4c38-932c-453162ca7dab",
|
||
"name": "If3",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
3220,
|
||
1020
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"amount": 1
|
||
},
|
||
"id": "e61e2feb-8026-4918-a571-f6735627c81d",
|
||
"name": "Wait",
|
||
"type": "n8n-nodes-base.wait",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
3640,
|
||
1020
|
||
],
|
||
"webhookId": "2d3bd1b8-c8ab-4867-ac65-63691f4eee0e"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Resolve Conversa",
|
||
"height": 246.1701698163285,
|
||
"width": 704.4608631799392
|
||
},
|
||
"id": "6f3905c9-5069-468b-9415-8951e1f27a1f",
|
||
"name": "Sticky Note13",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
1280,
|
||
260
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT limite_disparo\nFROM accounts\nWHERE id ={{ $('Info_Base').item.json.chatwoot_account_id }};",
|
||
"options": {
|
||
"queryReplacement": "="
|
||
}
|
||
},
|
||
"id": "5a8782a6-f0c8-48f4-a7aa-8f1e25e4f291",
|
||
"name": "Busca limite diario",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
300,
|
||
1040
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fromEmail": "={{ $node['Info_Base'].json.email_envia_relatorio }}",
|
||
"toEmail": "={{ $node['Info_Base'].json.email_relatorio }}",
|
||
"subject": "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": "eb453df4-eb20-4053-85ee-e3eee5be2df5",
|
||
"name": "Send Email",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
740,
|
||
60
|
||
],
|
||
"webhookId": "76b88e39-9633-4f6c-89ce-c805f0f9ea8e",
|
||
"credentials": {
|
||
"smtp": {
|
||
"id": "VmMDyV2dTfPZUzPS",
|
||
"name": "SMTP account"
|
||
}
|
||
},
|
||
"continueOnFail": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fromEmail": "={{ $node['Info_Base'].json.email_envia_relatorio }}",
|
||
"toEmail": "={{ $node['Info_Base'].json.email_relatorio }}",
|
||
"subject": "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": "6a5d202b-1f78-4036-bc03-c16961226d76",
|
||
"name": "Send Email1",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
740,
|
||
460
|
||
],
|
||
"webhookId": "3f48c037-fb6f-497f-b146-9d55acbb4596",
|
||
"credentials": {
|
||
"smtp": {
|
||
"id": "VmMDyV2dTfPZUzPS",
|
||
"name": "SMTP account"
|
||
}
|
||
},
|
||
"continueOnFail": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "c2573aed-9acc-4fc6-a799-b11e2191d408",
|
||
"leftValue": "={{ $json.exists }}",
|
||
"rightValue": "true",
|
||
"operator": {
|
||
"type": "boolean",
|
||
"operation": "true",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "9f70413d-efc9-4c6a-bbf3-10ecfd08bc5a",
|
||
"name": "If4",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
800,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {},
|
||
"id": "019af9d7-bdd6-488d-890a-8bd988beac99",
|
||
"name": "Wait1",
|
||
"type": "n8n-nodes-base.wait",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
1340,
|
||
340
|
||
],
|
||
"webhookId": "39bf7e5c-0cb9-4e8b-9ff7-8bda47bf82d2"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE campaigns\nSET falhou = {{ $json.falhou +1 }}\nWHERE id = {{ $('Campanha').item.json.id.campanha }};",
|
||
"options": {}
|
||
},
|
||
"id": "5e448f7a-0b42-4701-af14-64ab995a46fb",
|
||
"name": "Adiciona num de falhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2880,
|
||
1420
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE 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": "705651c6-1370-4df1-b785-e5e6491748a1",
|
||
"name": "Adiciona num não enviado",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3060,
|
||
1420
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "0ed1f598-cec8-458a-97d7-1d82aedf251e",
|
||
"leftValue": "={{ $json.falhou }}",
|
||
"rightValue": 0,
|
||
"operator": {
|
||
"type": "number",
|
||
"operation": "equals"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "61452fc3-fd98-4632-8723-c1571d22fd12",
|
||
"name": "If5",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
220,
|
||
160
|
||
]
|
||
},
|
||
{
|
||
"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": "079054ed-b8d5-4b77-8498-8d0d4bdbbb13",
|
||
"name": "Notifica limite excedido",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
60,
|
||
160
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "69cc2650-7d52-4da1-b391-a88b2326d63d",
|
||
"leftValue": "={{ $json.falhou }}",
|
||
"rightValue": 0,
|
||
"operator": {
|
||
"type": "number",
|
||
"operation": "equals"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "72307b59-f305-4016-8c34-70050953a9be",
|
||
"name": "If6",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
220,
|
||
560
|
||
]
|
||
},
|
||
{
|
||
"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": "d93af553-d8ef-41a3-900e-896ffcd09d89",
|
||
"name": "Code",
|
||
"type": "n8n-nodes-base.code",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
560,
|
||
600
|
||
]
|
||
},
|
||
{
|
||
"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": "42a2d8e6-d783-4553-9594-2200d747170d",
|
||
"name": "Code1",
|
||
"type": "n8n-nodes-base.code",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
560,
|
||
200
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fromEmail": "={{ $node['Info_Base'].json.email_envia_relatorio }}",
|
||
"toEmail": "={{ $node['Info_Base'].json.email_relatorio }}",
|
||
"subject": "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": "1c404587-8a49-4ed5-b355-a5b051f5cabc",
|
||
"name": "Send Email2",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
920,
|
||
600
|
||
],
|
||
"webhookId": "ec514a04-3386-4382-9a87-ed972c1479d4",
|
||
"credentials": {
|
||
"smtp": {
|
||
"id": "VmMDyV2dTfPZUzPS",
|
||
"name": "SMTP account"
|
||
}
|
||
},
|
||
"continueOnFail": 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": "9b2c41c5-2b58-4c5d-8b68-6dc411da48d2",
|
||
"name": "Postgres1",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
380,
|
||
200
|
||
],
|
||
"alwaysOutputData": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fromEmail": "={{ $node['Info_Base'].json.email_envia_relatorio }}",
|
||
"toEmail": "={{ $node['Info_Base'].json.email_relatorio }}",
|
||
"subject": "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": "5120934d-04a8-4eb0-9477-e4bcc68fbca1",
|
||
"name": "Send Email3",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
920,
|
||
200
|
||
],
|
||
"webhookId": "c85a18f5-abeb-42fb-a02c-0fcc8293beea",
|
||
"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": "00300561-4e27-4461-856f-4cfb91300559",
|
||
"name": "Dados da campanha",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
-260,
|
||
580
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fieldToSplitOut": "audience",
|
||
"include": "allOtherFields",
|
||
"options": {}
|
||
},
|
||
"id": "59896ddb-81e9-41d7-ad6d-cab234de2feb",
|
||
"name": "Tratamento de lista",
|
||
"type": "n8n-nodes-base.itemLists",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
-480,
|
||
840
|
||
],
|
||
"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": "68c8905c-f022-4496-984a-86f300c177dc",
|
||
"name": "Postgres",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
380,
|
||
600
|
||
],
|
||
"alwaysOutputData": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE 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": "9774b1f3-d0dc-474c-80b5-98abf2b3bad6",
|
||
"name": "Resumo relatorio",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
60,
|
||
560
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE 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": "2a57b895-62de-4521-8a63-421a5904a2c7",
|
||
"name": "Subtrair",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
980,
|
||
1040
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE 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": "f116ed0a-86ac-4d6c-a4dc-6babb91bd000",
|
||
"name": "Abre conversa de contato existente",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
3060,
|
||
1020
|
||
],
|
||
"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": "9d6692cc-38e4-4f29-99c1-bc2116ebebcb",
|
||
"name": "Busca Contato Existe",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
2900,
|
||
1020
|
||
],
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"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": "afec4f8d-d884-4ae9-bab6-cf61668a5adb",
|
||
"name": "HTTP Request1",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.2,
|
||
"position": [
|
||
640,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"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": "558e53b9-f1bb-4beb-ace8-235f51775141",
|
||
"name": "Fecha Conversa",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
1820,
|
||
340
|
||
],
|
||
"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": "e22f21b9-9c69-411c-87e1-940a1f221eea",
|
||
"name": "Seleciona conversa",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
1660,
|
||
340
|
||
],
|
||
"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": "fe546a1f-d791-480b-b4b0-0314d96b717c",
|
||
"name": "Busca Contato do Relatorio",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
1500,
|
||
340
|
||
],
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE conversations\nSET status = 1\nWHERE contact_id = {{ $json.id_contato }};",
|
||
"options": {}
|
||
},
|
||
"id": "a5b97639-fb25-44e3-ab15-06454563e4f3",
|
||
"name": "Resolve Conversa",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3820,
|
||
1020
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
},
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Com documento",
|
||
"height": 221.17684873191945,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "6ae810a2-1b47-48d0-8f7d-ba38f1b624b2",
|
||
"name": "Sticky Note14",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2020,
|
||
1380
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE campaigns SET status_envia = 1 WHERE id = {{ $json.id }}",
|
||
"options": {}
|
||
},
|
||
"id": "8c81e92f-310a-4b87-98e4-7c1700c4de12",
|
||
"name": "UPDATE CAMPANHA",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-2600,
|
||
840
|
||
],
|
||
"alwaysOutputData": false,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT DISTINCT c.*\nFROM contacts c\nJOIN taggings tg ON c.id = tg.taggable_id\nWHERE tg.tag_id IN ({{ $json.id }})\n AND tg.taggable_type = 'Contact'\n AND c.account_id = {{ $node['Info_Base'].json.chatwoot_account_id }}\nUNION\nSELECT DISTINCT c.*\nFROM contacts c\nJOIN conversations conv ON c.id = conv.contact_id\nJOIN taggings tg ON conv.id = tg.taggable_id\nWHERE tg.tag_id IN ({{ $json.id }})\n AND tg.taggable_type = 'Conversation'\n AND c.account_id = {{ $node['Info_Base'].json.chatwoot_account_id }};",
|
||
"options": {}
|
||
},
|
||
"id": "771dc6ed-3244-441d-b694-a9c7e022c694",
|
||
"name": "Busca contatos",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-1140,
|
||
1020
|
||
],
|
||
"executeOnce": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"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 \"text\": \"{{ $node['Edita Mensagem'].json.var_msg.replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') }}\",\n \"delay\": 1200\n}",
|
||
"options": {}
|
||
},
|
||
"id": "1ce3f0c6-b0cc-4b9e-9d6a-b6c8f49c4937",
|
||
"name": "Envia msg",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
2120,
|
||
860
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true,
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "eba67cd0-fd9f-4069-b1e3-accd10450f96",
|
||
"leftValue": "={{ $('Campanha').item.json.img}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
},
|
||
{
|
||
"id": "de8f0cf5-8faf-45a1-8965-7e660b401c5d",
|
||
"leftValue": "={{ $('Campanha').item.json.doc}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
},
|
||
{
|
||
"id": "292e83ff-984b-4d13-8997-a70e14d6cab6",
|
||
"leftValue": "={{ $('Campanha').item.json.vid}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
},
|
||
{
|
||
"id": "e27e0e90-2ed8-4eaa-a8ee-e654da292084",
|
||
"leftValue": "={{ $('Campanha').item.json.audio}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "aa3251a4-9477-4530-94bf-7d82ee9f8060",
|
||
"name": "If1",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1740,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"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\"] }}\",\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}",
|
||
"options": {}
|
||
},
|
||
"id": "c26c82f2-52d8-4273-ae4c-51cfcbf2fa91",
|
||
"name": "Envia relatorio3",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
740,
|
||
600
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": 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\"] }}\",\n \"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!\"\n}",
|
||
"options": {}
|
||
},
|
||
"id": "90632876-9d93-41cb-ae5e-472ef27e3b58",
|
||
"name": "Envia relatorio",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
560,
|
||
460
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": 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\"] }}\",\n \"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": "28911c22-ec58-4217-a70f-1a8808d8374f",
|
||
"name": "Envia relatorio2",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
740,
|
||
200
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": 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\"] }}\",\n \"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!\"\n}",
|
||
"options": {}
|
||
},
|
||
"id": "d1fa6508-dc68-4b3e-a83a-5ee1814ce1a0",
|
||
"name": "Envia relatorio1",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
560,
|
||
60
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": 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\"] }}\",\n \"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! 😊\"\n}",
|
||
"options": {}
|
||
},
|
||
"id": "a9a6710b-b742-4640-9217-df59b968db7f",
|
||
"name": "Envia Notificação",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
-900,
|
||
900
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"assignments": {
|
||
"assignments": [
|
||
{
|
||
"id": "a588a036-88bc-4bc2-aefa-a2c0b9af2000",
|
||
"name": "var_msg",
|
||
"value": "={{ $('Campanha').item.json.msg.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 || $('Loop Over Items').item.json.identifier }}",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "94bd5077-c8bb-4f32-85e8-6d8847fc21f0",
|
||
"name": "Edita Mensagem",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
-80,
|
||
1020
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fields": {
|
||
"values": [
|
||
{
|
||
"name": "mensagem",
|
||
"stringValue": "={{ $node['Edita Mensagem'].json.var_msg.split(\"&doc=\")[0].replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') }}"
|
||
},
|
||
{
|
||
"name": "titulo",
|
||
"stringValue": "={{ $('Campanha').item.json.msg.title }}"
|
||
},
|
||
{
|
||
"name": "doc",
|
||
"stringValue": "={{ $('Campanha').item.json.doc }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {
|
||
"includeBinary": true
|
||
}
|
||
},
|
||
"id": "a6296161-0389-47b7-9085-bff03ab7dd8c",
|
||
"name": "Edit Fields",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.2,
|
||
"position": [
|
||
2060,
|
||
1440
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fields": {
|
||
"values": [
|
||
{
|
||
"name": "mensagem",
|
||
"stringValue": "={{ $node['Edita Mensagem'].json.var_msg.split(\"&img=\")[0].replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') }}"
|
||
},
|
||
{
|
||
"name": "titulo",
|
||
"stringValue": "={{ $('Campanha').item.json.msg.title }}"
|
||
},
|
||
{
|
||
"name": "img",
|
||
"stringValue": "={{ $('Campanha').item.json.img }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {
|
||
"includeBinary": true
|
||
}
|
||
},
|
||
"id": "efad38f8-5b8c-4225-9163-8f90e78b629a",
|
||
"name": "Edit Fields2",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.2,
|
||
"position": [
|
||
2060,
|
||
1140
|
||
]
|
||
},
|
||
{
|
||
"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 \"mediatype\": \"image\",\n \"mimetype\": \"image/png\",\n \"caption\": \"{{ $json.mensagem }}\",\n \"media\": \"{{ $json[\"img\"] }}\",\n \"delay\": 1200\n}\n",
|
||
"options": {}
|
||
},
|
||
"id": "874b0fd1-10e0-4d52-9884-022921a42951",
|
||
"name": "Envia msg2",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
2200,
|
||
1140
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true,
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"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 \"mediatype\": \"document\",\n \"caption\": \"{{ $json.mensagem }}\",\n \"media\": \"{{ $json[\"doc\"] }}\",\n \"fileName\": \"documento.pdf\",\n \"delay\": 1200\n}",
|
||
"options": {}
|
||
},
|
||
"id": "4e6482c2-8e5d-44b5-b2a0-031825c8bb9a",
|
||
"name": "Envia msg1",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
2200,
|
||
1440
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true,
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Com video",
|
||
"height": 221.17684873191945,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "2b888724-c3b3-49e0-a163-1ad94e4e83ee",
|
||
"name": "Sticky Note15",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2020,
|
||
1680
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fields": {
|
||
"values": [
|
||
{
|
||
"name": "mensagem",
|
||
"stringValue": "={{ $node['Edita Mensagem'].json.var_msg.split(\"&vid=\")[0].replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') }}"
|
||
},
|
||
{
|
||
"name": "titulo",
|
||
"stringValue": "={{ $('Campanha').item.json.msg.title }}"
|
||
},
|
||
{
|
||
"name": "vid",
|
||
"stringValue": "={{ $('Campanha').item.json.vid }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {
|
||
"includeBinary": true
|
||
}
|
||
},
|
||
"id": "4a8bfd0f-1610-408b-b303-1356c3e06d2f",
|
||
"name": "Edit Fields1",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.2,
|
||
"position": [
|
||
2060,
|
||
1740
|
||
]
|
||
},
|
||
{
|
||
"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 \"mediatype\": \"video\",\n \"caption\": \"{{ $json.mensagem }}\",\n \"media\": \"{{ $json[\"vid\"] }}\",\n \"delay\": 1200\n}\n",
|
||
"options": {}
|
||
},
|
||
"id": "24189acf-a889-40d4-a1ba-3436d1857b0d",
|
||
"name": "Envia msg3",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
2200,
|
||
1740
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true,
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"options": {}
|
||
},
|
||
"id": "623e0e75-50b2-4104-a4f0-ba4c6b96ab54",
|
||
"name": "Loop Over Items1",
|
||
"type": "n8n-nodes-base.splitInBatches",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
-3260,
|
||
980
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"rules": {
|
||
"values": [
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"leftValue": "={{ $('Campanha').item.json.img }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
},
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "68892a20-1c5e-42f8-a74d-aec4a687d0dd",
|
||
"leftValue": "={{ $('Campanha').item.json.doc }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
},
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "a430d20e-500b-4938-a0c4-78d66d8bdff4",
|
||
"leftValue": "={{ $('Campanha').item.json.vid }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
},
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict"
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "3bd5629e-b41c-428e-98eb-733fe1fa5c95",
|
||
"leftValue": "={{ $('Campanha').item.json.audio}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "e7062be2-72df-4f1e-9c1b-295c174bec65",
|
||
"name": "Switch",
|
||
"type": "n8n-nodes-base.switch",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
1760,
|
||
1280
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Com Audio",
|
||
"height": 221.17684873191945,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "934af491-f35a-495c-a364-6897342ed6de",
|
||
"name": "Sticky Note16",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2020,
|
||
1980
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fields": {
|
||
"values": [
|
||
{
|
||
"name": "audio",
|
||
"stringValue": "={{ $('Campanha').item.json.audio }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {
|
||
"includeBinary": true
|
||
}
|
||
},
|
||
"id": "a00b7d61-ee51-4f53-b20e-c5ef52e9345b",
|
||
"name": "Edit Fields3",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.2,
|
||
"position": [
|
||
2060,
|
||
2040
|
||
]
|
||
},
|
||
{
|
||
"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 \"mediatype\": \"audio\",\n \"media\": \"{{ $json[\"audio\"] }}\",\n \"delay\": 1200\n \n}",
|
||
"options": {}
|
||
},
|
||
"id": "b9fe733a-84e1-4673-a308-1a010ec9a786",
|
||
"name": "Envia msg4",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
2200,
|
||
2040
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true,
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "select * from campaigns c where campaign_type = 1 and status_envia = 0",
|
||
"additionalFields": {}
|
||
},
|
||
"id": "78e898d0-7618-449c-9cd5-cc8fcbdebf58",
|
||
"name": "Buscar campanhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-3460,
|
||
980
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "select * from inboxes i where id = {{ $json.inbox_id }}",
|
||
"options": {}
|
||
},
|
||
"id": "3d55ee58-6097-4521-b699-46e344be1bf1",
|
||
"name": "Busca Disparador",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-2600,
|
||
1000
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "select * from channel_sms where id = {{ $json.channel_id }}",
|
||
"options": {}
|
||
},
|
||
"id": "325f00cf-1370-4528-b458-1b932e09d274",
|
||
"name": "Busca Caixa de Disparo",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-2420,
|
||
1000
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"keepOnlySet": true,
|
||
"values": {
|
||
"string": [
|
||
{
|
||
"name": "chatwoot_url",
|
||
"value": "https://url_evoapi"
|
||
},
|
||
{
|
||
"name": "evolution_url",
|
||
"value": "https://url_chatwoot"
|
||
},
|
||
{
|
||
"name": "global_api_key",
|
||
"value": "global api evo"
|
||
},
|
||
{
|
||
"name": "chatwoot_token",
|
||
"value": "token chatwoot"
|
||
},
|
||
{
|
||
"name": "email_envia_relatorio",
|
||
"value": "exemplo@email.com"
|
||
},
|
||
{
|
||
"name": "instance_name",
|
||
"value": "={{ $json.provider_config.application_id }}"
|
||
},
|
||
{
|
||
"name": "chatwoot_account_id",
|
||
"value": "={{ $('Buscar campanhas').item.json.account_id }}"
|
||
},
|
||
{
|
||
"name": "recebe_relatorio",
|
||
"value": "={{ $json.provider_config.api_key }}"
|
||
},
|
||
{
|
||
"name": "email_relatorio",
|
||
"value": "={{ $json.provider_config.api_secret }}"
|
||
},
|
||
{
|
||
"name": "audience",
|
||
"value": "={{ $('Buscar campanhas').item.json.audience }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "618e0f36-eeac-4e0b-9ee8-5363bf48cbe2",
|
||
"name": "Info_Base",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
-2240,
|
||
1000
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT * FROM labels WHERE id = ({{ $json.etiqueta }})",
|
||
"options": {}
|
||
},
|
||
"id": "786f317e-11d5-4c87-832e-d25b1407f05c",
|
||
"name": "Busca tag",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-1420,
|
||
980
|
||
],
|
||
"executeOnce": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT * FROM labels WHERE id = ({{ $json.id }})",
|
||
"options": {}
|
||
},
|
||
"id": "652ebcfb-0037-4e53-b943-c64936f5a63c",
|
||
"name": "Busca tag1",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-1420,
|
||
1140
|
||
],
|
||
"executeOnce": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "neqgycsPf7lF5Reo",
|
||
"name": "INOVANODE CHATWOOT"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"rule": {
|
||
"interval": [
|
||
{
|
||
"field": "minutes",
|
||
"minutesInterval": 1
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"type": "n8n-nodes-base.scheduleTrigger",
|
||
"typeVersion": 1.2,
|
||
"position": [
|
||
-3640,
|
||
980
|
||
],
|
||
"id": "0b98cbae-c909-415f-ad24-5488cad44c36",
|
||
"name": "Schedule Trigger"
|
||
}
|
||
],
|
||
"pinData": {},
|
||
"connections": {
|
||
"Horario": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "UPDATE CAMPANHA",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Busca Disparador",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Loop Over Items1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Altera fuso horário": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Horario",
|
||
"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
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"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 tag",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Adiciona envios": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca Contato Existe",
|
||
"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
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"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": "Postgres1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Notifica limite excedido": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If5",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If6": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia relatorio",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Postgres",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Code": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia relatorio3",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Code1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia relatorio2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Postgres1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Code1",
|
||
"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": "Code",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Resumo relatorio": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If6",
|
||
"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
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"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
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca contatos": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia Notificação",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Loop Over Items",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia msg": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia msg",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Switch",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia relatorio3": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Send Email2",
|
||
"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
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia relatorio2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Send Email3",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Wait1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia relatorio1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Send Email",
|
||
"type": "main",
|
||
"index": 0
|
||
},
|
||
{
|
||
"node": "Wait1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Edita Mensagem": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca limite diario",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Edit Fields": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia msg1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Edit Fields2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia msg2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia msg2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia msg1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Edit Fields1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia msg3",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia msg3": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Loop Over Items1": {
|
||
"main": [
|
||
[],
|
||
[
|
||
{
|
||
"node": "Altera fuso horário",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Switch": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Edit Fields2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Edit Fields",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Edit Fields1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Edit Fields3",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Edit Fields3": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Envia msg4",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Envia msg4": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Buscar campanhas": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Loop Over Items1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca Disparador": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca Caixa de Disparo",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca Caixa de Disparo": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Info_Base",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Info_Base": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "IF6",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca tag": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca tag1",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Busca tag1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca contatos",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Schedule Trigger": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Buscar campanhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
}
|
||
},
|
||
"active": false,
|
||
"settings": {
|
||
"executionOrder": "v1"
|
||
},
|
||
"versionId": "7a52e8f1-e21e-418b-8620-bd351a306a2e",
|
||
"meta": {
|
||
"templateCredsSetupCompleted": true,
|
||
"instanceId": "33738330930e3881dd5571eca013f36ddf8aab20e4ea5c1f2ebaf4a2b4668ac6"
|
||
},
|
||
"id": "PBLqhk3RRik3uKA8",
|
||
"tags": [
|
||
{
|
||
"name": "RodrigoTanci",
|
||
"id": "uq2dkKd9AYzGoGp5",
|
||
"createdAt": "2025-03-25T03:35:54.500Z",
|
||
"updatedAt": "2025-03-25T03:35:54.500Z"
|
||
}
|
||
]
|
||
}
|