mirror of
https://github.com/rodtanci/Disparador-de-Campanha-Chatwoot-Evolution.git
synced 2025-07-14 01:41:25 -06:00
3299 lines
87 KiB
JSON
3299 lines
87 KiB
JSON
{
|
||
"name": "[ Disparador de Campanha ] - [ Micro SAAS ] [ 2.1 ]",
|
||
"nodes": [
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"dateTime": [
|
||
{
|
||
"value1": "={{ $json.newDate }}",
|
||
"operation": "before",
|
||
"value2": "={{ $now }}"
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"id": "afd77225-f3a3-4d8b-9f3f-b39b1c0788fc",
|
||
"name": "Horario",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-3600,
|
||
960
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Buscando Campanhas",
|
||
"height": 496,
|
||
"width": 1604
|
||
},
|
||
"id": "dc30483e-fc27-4303-bfe5-c1cb66a71c8a",
|
||
"name": "Sticky Note5",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-4440,
|
||
760
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Disparador de Campanha para ChatWoot [SAAS]\n## Evolution API V2\n\n\nv 2.1",
|
||
"height": 163.30528430133387,
|
||
"width": 847.4993167412657,
|
||
"color": 4
|
||
},
|
||
"id": "f6237cd7-5141-4f8f-997f-8fc1e15d8cf6",
|
||
"name": "Sticky Note10",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-4440,
|
||
540
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "subtractFromDate",
|
||
"magnitude": "={{ $json.scheduled_at }}",
|
||
"timeUnit": "hours",
|
||
"duration": 3,
|
||
"options": {
|
||
"includeInputFields": true
|
||
}
|
||
},
|
||
"id": "6bb9c374-3371-42c0-87c8-fc4a6d7b1fd4",
|
||
"name": "Altera fuso horário",
|
||
"type": "n8n-nodes-base.dateTime",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
-3780,
|
||
960
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Busca contatos / Envia campanha\n",
|
||
"height": 1751,
|
||
"width": 5120,
|
||
"color": 3
|
||
},
|
||
"id": "b3fdd678-4197-4328-9b3e-c883de64aa20",
|
||
"name": "Sticky Note",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-820,
|
||
760
|
||
]
|
||
},
|
||
{
|
||
"parameters": {},
|
||
"id": "1bdcfc60-600e-44cd-8a5b-122d4e0cf61a",
|
||
"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 = 8; // Tempo mínimo de espera em segundos\nconst maxWait = 16; // 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": "fb522a86-a817-43c1-9bd3-6843cd2f56b3",
|
||
"name": "Time Randon1",
|
||
"type": "n8n-nodes-base.code",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
1340,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"amount": "={{ $json.waitTime }}"
|
||
},
|
||
"id": "dae471c3-ef6d-4196-b988-019c1819cf58",
|
||
"name": "Tempo de espera1",
|
||
"type": "n8n-nodes-base.wait",
|
||
"typeVersion": 1.1,
|
||
"position": [
|
||
1520,
|
||
1040
|
||
],
|
||
"webhookId": "4036d994-e204-470a-82d9-1ac3c5244871",
|
||
"disabled": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"string": [
|
||
{
|
||
"value1": "={{ $('Buscar campanhas').item.json.campaign_type }}",
|
||
"value2": "={{ 1 }}"
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"id": "7669e749-e8ab-4025-a125-de229dbc7558",
|
||
"name": "IF6",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-2740,
|
||
940
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fieldToSplitOut": "audience",
|
||
"include": "allOtherFields",
|
||
"options": {}
|
||
},
|
||
"id": "19ce2b45-29e5-48bc-b6e9-b30e70423283",
|
||
"name": "Item Lists1",
|
||
"type": "n8n-nodes-base.itemLists",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
-2540,
|
||
940
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Busca Contatos",
|
||
"height": 497,
|
||
"width": 588,
|
||
"color": 2
|
||
},
|
||
"id": "671defc4-af6e-4d03-9156-9177fa5c0d31",
|
||
"name": "Sticky Note2",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-1440,
|
||
760
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"options": {}
|
||
},
|
||
"id": "b58192b8-c900-41b4-8204-c6c0171aca5d",
|
||
"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": "19679557-4c1d-406a-a3d8-2cd5e300111b",
|
||
"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": "970f7b23-1275-4f3b-ac7f-b8d2310a3c3f",
|
||
"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": "1cd9cc58-28ac-4a29-84fb-568d63adf46a",
|
||
"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": "fa336799-ae0e-4cf0-87b4-24bec5ec6ac6",
|
||
"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": "e310ce59-5597-4a0d-8e25-44273633a5a9",
|
||
"name": "Sticky Note7",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2400,
|
||
960
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT falhou\nFROM campaigns\nWHERE id = {{ $node['Campanha'].json.id.campanha }};",
|
||
"options": {
|
||
"queryReplacement": "="
|
||
}
|
||
},
|
||
"id": "0349f4fd-2123-4dce-b095-5ebfc20b6da9",
|
||
"name": "Busca falhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2700,
|
||
1420
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT enviou\nFROM campaigns\nWHERE id = {{ $node['Campanha'].json.id.campanha }};",
|
||
"options": {}
|
||
},
|
||
"id": "f81b19d2-5e7a-4af7-bcea-009ed9c3df6f",
|
||
"name": "Busca envios",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2460,
|
||
1020
|
||
]
|
||
},
|
||
{
|
||
"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"
|
||
},
|
||
{
|
||
"id": "f40f7b3d-3c50-4e15-9c50-40197caed5ad",
|
||
"name": "typebot",
|
||
"value": "={{ $('Buscar campanhas').item.json.message.split('&typebot=')[1].split('&')[0] }}",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "2f43e89c-6677-4a30-9a9a-1cd437cf502c",
|
||
"name": "Campanha",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
-2360,
|
||
940
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Relatorio da campanha",
|
||
"height": 346.43605543050865,
|
||
"width": 1085.0447604700087
|
||
},
|
||
"id": "a28a64c0-e7d7-4e39-8e6f-d24797586c2f",
|
||
"name": "Sticky Note8",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
0,
|
||
400
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Limite excedido ",
|
||
"height": 339.69571412210314,
|
||
"width": 1088.2492332463764
|
||
},
|
||
"id": "65ed0b51-967b-4000-b2aa-af3deef38b28",
|
||
"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 = {{ $node['Campanha'].json.id.campanha }};",
|
||
"options": {}
|
||
},
|
||
"id": "6ab15a6e-bd39-4e12-8b4e-f2638358006d",
|
||
"name": "Adiciona envios",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2620,
|
||
1020
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Somente texto",
|
||
"height": 199.63817652105178,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "635f022c-afb2-4cee-ba71-9406c7cbd887",
|
||
"name": "Sticky Note4",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2020,
|
||
820
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Com imagem",
|
||
"height": 221.17684873191945,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "fde9b36d-2544-4c34-96fb-d2489eea1530",
|
||
"name": "Sticky Note11",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2020,
|
||
1080
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "ebbe2797-49a1-47e7-9c54-161ff02dfa49",
|
||
"leftValue": "={{ $node['Campanha'].json.nomecontato }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
},
|
||
{
|
||
"id": "77ff2a0a-ae27-427a-b489-2daac4e90429",
|
||
"leftValue": "={{ $node['Campanha'].json.emailcontato}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "empty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "or"
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "c86fdfe4-ca1e-4f5e-b721-a6a4a734a3f3",
|
||
"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": "69e5b6a8-86b2-49e6-9272-c33052a6da3e",
|
||
"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": "256de0e3-ad91-4e2b-92d3-12705483016a",
|
||
"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": "622c58aa-d592-483e-b6c6-af96eaa06b45",
|
||
"name": "If3",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
3220,
|
||
1020
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"amount": 1
|
||
},
|
||
"id": "5aa23004-fc62-4152-bbe3-a8d8f5e6c310",
|
||
"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": "8506dccb-a871-4ffa-9706-6fafe94a76cb",
|
||
"name": "Sticky Note13",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
1280,
|
||
260
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT limite_disparo\nFROM accounts\nWHERE id ={{ $node['Info_Base'].json.chatwoot_account_id }};",
|
||
"options": {
|
||
"queryReplacement": "="
|
||
}
|
||
},
|
||
"id": "b52643f0-ccdb-4290-b726-30e111cfd7ee",
|
||
"name": "Busca limite diario",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
300,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"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": "fd6f4454-ec4e-4750-9b03-8379f398c9c1",
|
||
"name": "Send Email",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
740,
|
||
60
|
||
],
|
||
"webhookId": "76b88e39-9633-4f6c-89ce-c805f0f9ea8e",
|
||
"disabled": true,
|
||
"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": "21fff96e-dfa5-43dd-9553-ca1e27ba484c",
|
||
"name": "Send Email1",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
740,
|
||
460
|
||
],
|
||
"webhookId": "3f48c037-fb6f-497f-b146-9d55acbb4596",
|
||
"disabled": true,
|
||
"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": "3ce0a1d0-44b4-4c01-807b-d16a5ffdc4c1",
|
||
"name": "If4",
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
800,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"parameters": {},
|
||
"id": "c4a086a5-2f1c-46a5-8596-aef2af4450c9",
|
||
"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 = {{ $node['Campanha'].json.id.campanha }};",
|
||
"options": {}
|
||
},
|
||
"id": "daafbfd5-7040-42e9-8c46-68b0ae9dd772",
|
||
"name": "Adiciona num de falhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
2880,
|
||
1420
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "INSERT INTO campaigns_failled (nomecontato, telefone, id_campanha)\nSELECT '{{ $node['Busca contatos'].json.name }}', '{{ $node['Busca contatos'].json.phone_number }}', {{ $('Buscar campanhas').item.json.id }}\nWHERE NOT EXISTS (\n SELECT 1\n FROM campaigns_failled\n WHERE telefone = '{{ $node['Busca contatos'].json.phone_number }}' AND id_campanha = {{ $node['Busca contatos'].json.id }}\n);",
|
||
"options": {}
|
||
},
|
||
"id": "4951110b-b62f-4d5e-b505-00caa8275e88",
|
||
"name": "Adiciona num não enviado",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3060,
|
||
1420
|
||
]
|
||
},
|
||
{
|
||
"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": "3b9562be-3979-4576-ae10-b4bb1fa33c55",
|
||
"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 = {{ $node['Campanha'].json.id.campanha }};",
|
||
"options": {
|
||
"queryReplacement": "="
|
||
}
|
||
},
|
||
"id": "25090777-77dd-479b-867b-3e14c131fa85",
|
||
"name": "Notifica limite excedido",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
60,
|
||
160
|
||
]
|
||
},
|
||
{
|
||
"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": "785879c2-c5b0-45a2-a097-0feda2e172c7",
|
||
"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": "b256c4ff-f2ee-4ab4-ba17-dfae06ca6bcc",
|
||
"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": "52b7677d-80d8-4b9a-924a-2e718fac7bcd",
|
||
"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": "e9303655-040b-41f6-8acb-a09a4cd6cfbe",
|
||
"name": "Send Email2",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
920,
|
||
600
|
||
],
|
||
"webhookId": "ec514a04-3386-4382-9a87-ed972c1479d4",
|
||
"disabled": true,
|
||
"continueOnFail": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT \n (SELECT COUNT(*) FROM campaigns_failled WHERE id_campanha = {{ $node['Campanha'].json.id.campanha }}) AS total_registros,\n campaigns_failled.*\nFROM campaigns_failled\nWHERE id_campanha = {{ $node['Campanha'].json.id.campanha }};",
|
||
"options": {}
|
||
},
|
||
"id": "3e598979-3381-4a54-aaf0-68949d027ed5",
|
||
"name": "Postgres1",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
380,
|
||
200
|
||
],
|
||
"alwaysOutputData": true
|
||
},
|
||
{
|
||
"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": "7bb62ed1-c445-468c-a49d-de5da9854c00",
|
||
"name": "Send Email3",
|
||
"type": "n8n-nodes-base.emailSend",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
920,
|
||
200
|
||
],
|
||
"webhookId": "c85a18f5-abeb-42fb-a02c-0fcc8293beea",
|
||
"disabled": true,
|
||
"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": "f582b087-1031-4011-bc89-b01101c35f4f",
|
||
"name": "Dados da campanha",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 3.3,
|
||
"position": [
|
||
-260,
|
||
580
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"fieldToSplitOut": "audience",
|
||
"include": "allOtherFields",
|
||
"options": {}
|
||
},
|
||
"id": "cbcddb8b-2fff-487b-903c-8d2473f248db",
|
||
"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": "5cbfebd4-f048-43b7-be1a-4847671f5602",
|
||
"name": "Postgres",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
380,
|
||
600
|
||
],
|
||
"alwaysOutputData": true
|
||
},
|
||
{
|
||
"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 = {{ $node['Campanha'].json.id.campanha }};",
|
||
"options": {}
|
||
},
|
||
"id": "1af09a30-0c75-4875-b024-734281335ca1",
|
||
"name": "Resumo relatorio",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
60,
|
||
560
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "UPDATE accounts\nSET limite_disparo = {{ $('Busca limite diario').item.json.limite_disparo -1 }}\nWHERE id ={{ $node['Info_Base'].json.chatwoot_account_id }};",
|
||
"options": {}
|
||
},
|
||
"id": "6d704409-4618-46b7-b48a-14ebb22cb06f",
|
||
"name": "Subtrair",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
980,
|
||
1040
|
||
]
|
||
},
|
||
{
|
||
"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": "18ccd9c8-8b37-4d29-9b79-bce2db0a509e",
|
||
"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": "5b839dd9-11d7-4d4c-9fb0-caebd015f4c1",
|
||
"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": "a4319bb4-d12e-41eb-b177-65b91df0a889",
|
||
"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": "04768b57-7b2b-4efb-949c-b31a3fe39cbc",
|
||
"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": "80ef6a3b-eb0d-40bc-a84b-a5b6a4445290",
|
||
"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": "7dd3e9fb-2389-45a6-8b3e-6dfb55cc0f17",
|
||
"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": "6624d17c-4c1f-47f3-b8c2-815ffdc04b59",
|
||
"name": "Resolve Conversa",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
3820,
|
||
1020
|
||
],
|
||
"onError": "continueRegularOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Com documento",
|
||
"height": 221.17684873191945,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "dead8d72-983f-42db-8387-307a6a61af03",
|
||
"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": "042f525d-418b-4f16-8e6c-96ffb47cbf4c",
|
||
"name": "UPDATE CAMPANHA",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-3340,
|
||
800
|
||
],
|
||
"alwaysOutputData": false
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT * FROM (\n SELECT DISTINCT c.*\n FROM contacts c\n JOIN taggings tg ON c.id = tg.taggable_id\n WHERE tg.tag_id IN ({{ $json.id }})\n AND tg.taggable_type = 'Contact'\n AND c.account_id = {{ $node['Info_Base'].json.chatwoot_account_id }}\n\n UNION\n\n SELECT DISTINCT c.*\n FROM contacts c\n JOIN conversations conv ON c.id = conv.contact_id\n JOIN taggings tg ON conv.id = tg.taggable_id\n WHERE tg.tag_id IN ({{ $json.id }})\n AND tg.taggable_type = 'Conversation'\n AND c.account_id = {{ $node['Info_Base'].json.chatwoot_account_id }}\n) AS unioned_contacts\nLIMIT 200;",
|
||
"options": {}
|
||
},
|
||
"id": "32bc296e-9873-4d2e-b300-559f8e153f67",
|
||
"name": "Busca contatos",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-1040,
|
||
940
|
||
],
|
||
"executeOnce": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "6bWpJ8I6FiuVQMLP",
|
||
"name": "Typebot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"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\": \"{{ $('HTTP Request1').item.json.jid }}\",\n \"text\": \"{{ $node['Edita Mensagem'].json.var_msg.replace(/\"/g, '\\\\\"').replace(/\\n/g, '\\\\n') }}\",\n \"delay\": 1200\n}",
|
||
"options": {}
|
||
},
|
||
"id": "f29157fa-0150-4617-a8a4-3c7dbd6c562a",
|
||
"name": "Envia msg",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
2120,
|
||
880
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true,
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"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": "a4cf8b35-2931-46fc-a363-86ba1d47d4fe",
|
||
"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": "d16eb514-1ab6-4b91-a4df-fbf2bd1f390f",
|
||
"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": "d8f45dbd-3c48-4941-886a-f6cf253ee087",
|
||
"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": "f331d935-990b-4453-80e1-7829b713837b",
|
||
"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": "71891fc0-d9c2-4a58-abaa-c807cf3d2907",
|
||
"name": "Envia Notificação",
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.1,
|
||
"position": [
|
||
-700,
|
||
860
|
||
],
|
||
"retryOnFail": false,
|
||
"maxTries": 2,
|
||
"waitBetweenTries": 2000,
|
||
"executeOnce": true
|
||
},
|
||
{
|
||
"parameters": {
|
||
"assignments": {
|
||
"assignments": [
|
||
{
|
||
"id": "a588a036-88bc-4bc2-aefa-a2c0b9af2000",
|
||
"name": "var_msg",
|
||
"value": "={{ $node['Campanha'].json.msg.message.split('&nome').join($('Loop Over Items').item.json.name).split('&email').join($('Loop Over Items').item.json.email) }}",
|
||
"type": "string"
|
||
},
|
||
{
|
||
"id": "16d86caa-9f85-496d-ae3d-7ad024e100d7",
|
||
"name": "verificanum",
|
||
"value": "={{ $node['Loop Over Items'].json.phone_number || $('Loop Over Items').item.json.identifier }}",
|
||
"type": "string"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"id": "fe062ec2-e3b0-405f-8deb-8ae736c6a4ab",
|
||
"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": "a3f9d423-d435-4174-a9d3-40ec83a6dead",
|
||
"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": "a5006b1a-d7f2-455f-a1b7-fa05652a27a0",
|
||
"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\": \"{{ $('HTTP Request1').item.json.jid }}\",\n \"mediatype\": \"image\",\n \"mimetype\": \"image/png\",\n \"caption\": \"{{ $json.mensagem }}\",\n \"media\": \"{{ $json[\"img\"] }}\",\n \"delay\": 1200\n}\n",
|
||
"options": {}
|
||
},
|
||
"id": "26081192-53ef-4330-9e57-5d0222aa0221",
|
||
"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\": \"{{ $('HTTP Request1').item.json.jid }}\",\n \"mediatype\": \"document\",\n \"caption\": \"{{ $json.mensagem }}\",\n \"media\": \"{{ $json[\"doc\"] }}\",\n \"fileName\": \"documento.pdf\",\n \"delay\": 1200\n}",
|
||
"options": {}
|
||
},
|
||
"id": "44991886-942d-4c6b-a428-ed42394a2259",
|
||
"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": "a766b77c-2865-4f36-9a8b-a53d6fa28f3e",
|
||
"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": "cdd91049-2c82-43f6-9977-6e89c50cc1ab",
|
||
"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\": \"{{ $('HTTP Request1').item.json.jid }}\",\n \"mediatype\": \"video\",\n \"caption\": \"{{ $json.mensagem }}\",\n \"media\": \"{{ $json[\"vid\"] }}\",\n \"delay\": 1200\n}\n",
|
||
"options": {}
|
||
},
|
||
"id": "dcebb4da-07cc-42ad-8936-4527f7b56f7d",
|
||
"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": "0e08469c-daf3-40df-96ef-dd2340d8905d",
|
||
"name": "Loop Over Items1",
|
||
"type": "n8n-nodes-base.splitInBatches",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
-4000,
|
||
940
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"rules": {
|
||
"values": [
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"leftValue": "={{ $node['Campanha'].json.img }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
},
|
||
"id": "65b1f5f0-2d2b-4a94-a852-67a3ea38623a"
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
},
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "68892a20-1c5e-42f8-a74d-aec4a687d0dd",
|
||
"leftValue": "={{ $node['Campanha'].json.doc }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
},
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "a430d20e-500b-4938-a0c4-78d66d8bdff4",
|
||
"leftValue": "={{ $node['Campanha'].json.vid }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
},
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "3bd5629e-b41c-428e-98eb-733fe1fa5c95",
|
||
"leftValue": "={{ $node['Campanha'].json.audio}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
},
|
||
{
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 1
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "ac9b8896-a202-427a-b6f9-70fdb6d677d0",
|
||
"leftValue": "={{ $node['Campanha'].json.typebot}}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
}
|
||
}
|
||
]
|
||
},
|
||
"options": {
|
||
"fallbackOutput": "extra"
|
||
}
|
||
},
|
||
"id": "7b42ec50-95db-450b-8e41-f1394e295cd7",
|
||
"name": "Switch",
|
||
"type": "n8n-nodes-base.switch",
|
||
"typeVersion": 3,
|
||
"position": [
|
||
1760,
|
||
1280
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Com Audio",
|
||
"height": 221.17684873191945,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "2d3abb6a-a046-43b9-9e6a-198f4eb529a0",
|
||
"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": "f0748940-0a39-4080-a5d9-891489a56e72",
|
||
"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\": \"{{ $('HTTP Request1').item.json.jid }}\",\n \"mediatype\": \"audio\",\n \"media\": \"{{ $json[\"audio\"] }}\",\n \"delay\": 1200\n \n}",
|
||
"options": {}
|
||
},
|
||
"id": "3fc3aaba-b424-4c24-8143-4edb1e47459c",
|
||
"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 and account_id = 1",
|
||
"additionalFields": {}
|
||
},
|
||
"id": "7c6caba3-a17e-4f4b-9662-3d9a5c8077b1",
|
||
"name": "Buscar campanhas",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-4200,
|
||
940
|
||
],
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "6bWpJ8I6FiuVQMLP",
|
||
"name": "Typebot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "select * from inboxes i where id = {{ $json.inbox_id }}",
|
||
"options": {}
|
||
},
|
||
"id": "1791c152-44a2-495c-8253-4bbb7b2f2686",
|
||
"name": "Busca Disparador",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-3340,
|
||
960
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "select * from channel_sms where id = {{ $json.channel_id }}",
|
||
"options": {}
|
||
},
|
||
"id": "6cd23bd8-926d-453d-81ea-565b2d294ca4",
|
||
"name": "Busca Caixa de Disparo",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-3160,
|
||
960
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"keepOnlySet": true,
|
||
"values": {
|
||
"string": [
|
||
{
|
||
"name": "chatwoot_url",
|
||
"value": "https://urlchatwoot"
|
||
},
|
||
{
|
||
"name": "evolution_url",
|
||
"value": "https://urlevolution"
|
||
},
|
||
{
|
||
"name": "typebotapi_url",
|
||
"value": "url do typebot"
|
||
},
|
||
{
|
||
"name": "global_api_key",
|
||
"value": "token_evolution"
|
||
},
|
||
{
|
||
"name": "chatwoot_token",
|
||
"value": "token_chatwoot"
|
||
},
|
||
{
|
||
"name": "email_envia_relatorio",
|
||
"value": "email que envia relatorio"
|
||
},
|
||
{
|
||
"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": "6c8a4e92-acf8-4e53-b662-e4919c46f27b",
|
||
"name": "Info_Base",
|
||
"type": "n8n-nodes-base.set",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
-2980,
|
||
960
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT * FROM labels WHERE id = ({{ $node['Campanha'].json.etiqueta }})",
|
||
"options": {}
|
||
},
|
||
"id": "1b26822a-7ea6-45bb-aab6-962bdd2799dd",
|
||
"name": "Busca tag",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-1360,
|
||
940
|
||
],
|
||
"executeOnce": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "6bWpJ8I6FiuVQMLP",
|
||
"name": "Typebot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"operation": "executeQuery",
|
||
"query": "SELECT * FROM tags WHERE labels_id = ({{ $json.id }})",
|
||
"options": {}
|
||
},
|
||
"id": "4d657dc7-3d1a-4fa7-8e72-015d25e5e32c",
|
||
"name": "Busca tag1",
|
||
"type": "n8n-nodes-base.postgres",
|
||
"typeVersion": 2.4,
|
||
"position": [
|
||
-1200,
|
||
940
|
||
],
|
||
"executeOnce": true,
|
||
"credentials": {
|
||
"postgres": {
|
||
"id": "6bWpJ8I6FiuVQMLP",
|
||
"name": "Typebot"
|
||
}
|
||
}
|
||
},
|
||
{
|
||
"parameters": {
|
||
"rule": {
|
||
"interval": [
|
||
{
|
||
"field": "minutes",
|
||
"minutesInterval": 1
|
||
}
|
||
]
|
||
}
|
||
},
|
||
"type": "n8n-nodes-base.scheduleTrigger",
|
||
"typeVersion": 1.2,
|
||
"position": [
|
||
-4380,
|
||
940
|
||
],
|
||
"id": "6df46dcb-09aa-4f02-96bd-0bfd5226f07a",
|
||
"name": "Schedule Trigger"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "## Typebot",
|
||
"height": 199.63817652105178,
|
||
"width": 313.99126283929667
|
||
},
|
||
"id": "b88fc001-1c76-4d0b-a80d-95d70af74460",
|
||
"name": "Sticky Note17",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
2020,
|
||
2260
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $node['Info_Base'].json.evolution_url }}/typebot/start/{{ $node['Info_Base'].json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $node['Info_Base'].json.global_api_key }}"
|
||
},
|
||
{
|
||
"name": "Content-Type",
|
||
"value": "application/json"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\n \"url\": \"{{ $node['Info_Base'].json.typebotapi_url }}\",\n \"typebot\": \"{{ $node['Code2'].json.typebot }}\",\n \"remoteJid\": \"{{ $('Edita Mensagem').item.json.verificanum }}\",\n \"startSession\": true,\n \"variables\": [\n {\n \"name\": \"pushName\",\n \"value\": \"{{ $node['Edita Mensagem'].json.nome }}\"\n },\n {\n \"name\": \"email\",\n \"value\": \"{{ $node['Edita Mensagem'].json.email }}\"\n }\n ]\n}",
|
||
"options": {}
|
||
},
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.2,
|
||
"position": [
|
||
2120,
|
||
2320
|
||
],
|
||
"id": "3f085820-6ed8-45ce-9a75-d02678b32494",
|
||
"name": "HTTP Request",
|
||
"onError": "continueErrorOutput"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Tratamento da campanha",
|
||
"height": 497,
|
||
"width": 608,
|
||
"color": 2
|
||
},
|
||
"id": "8227bfdf-84a4-4d9e-bb0b-ecee6b73ef77",
|
||
"name": "Sticky Note18",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-2800,
|
||
760
|
||
]
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 2
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "3817bfe2-1046-4a2e-b91b-3ecc981cf9d2",
|
||
"leftValue": "={{ $json.typebot }}",
|
||
"rightValue": "",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "notEmpty",
|
||
"singleValue": true
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2.2,
|
||
"position": [
|
||
-2140,
|
||
940
|
||
],
|
||
"id": "fb5db544-696a-4b6e-821c-830bd3d27bcc",
|
||
"name": "If1"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"url": "={{ $('Info_Base').item.json.evolution_url }}/typebot/find/{{ $('Info_Base').item.json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $('Info_Base').item.json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"options": {}
|
||
},
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.2,
|
||
"position": [
|
||
-1960,
|
||
820
|
||
],
|
||
"id": "c597fe61-16ba-4190-9992-41adc1daa7c8",
|
||
"name": "HTTP Request2"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"jsCode": "const targetTypebot = $('Campanha').first().json.typebot;\nconst registros = items; // todos os registros recebidos no nó\n\nconst existe = registros.some(item => item.json.typebot === targetTypebot);\n\nreturn [\n {\n json: {\n resultado: existe ? 'exist' : 'no',\n typebot: targetTypebot\n }\n }\n];\n"
|
||
},
|
||
"type": "n8n-nodes-base.code",
|
||
"typeVersion": 2,
|
||
"position": [
|
||
-1800,
|
||
820
|
||
],
|
||
"id": "f455f472-14d7-41a1-8320-5b10c28c550a",
|
||
"name": "Code2"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"conditions": {
|
||
"options": {
|
||
"caseSensitive": true,
|
||
"leftValue": "",
|
||
"typeValidation": "strict",
|
||
"version": 2
|
||
},
|
||
"conditions": [
|
||
{
|
||
"id": "7eaa4c79-554b-429b-b145-f0712db74bcb",
|
||
"leftValue": "={{ $json.resultado }}",
|
||
"rightValue": "exist",
|
||
"operator": {
|
||
"type": "string",
|
||
"operation": "equals",
|
||
"name": "filter.operator.equals"
|
||
}
|
||
}
|
||
],
|
||
"combinator": "and"
|
||
},
|
||
"options": {}
|
||
},
|
||
"type": "n8n-nodes-base.if",
|
||
"typeVersion": 2.2,
|
||
"position": [
|
||
-1640,
|
||
820
|
||
],
|
||
"id": "fe2653ff-a471-41b8-a596-859bb350eadb",
|
||
"name": "If7"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"method": "POST",
|
||
"url": "={{ $('Info_Base').item.json.evolution_url }}/typebot/create/{{ $('Info_Base').item.json.instance_name }}",
|
||
"sendHeaders": true,
|
||
"headerParameters": {
|
||
"parameters": [
|
||
{
|
||
"name": "apikey",
|
||
"value": "={{ $('Info_Base').item.json.global_api_key }}"
|
||
}
|
||
]
|
||
},
|
||
"sendBody": true,
|
||
"specifyBody": "json",
|
||
"jsonBody": "={\n \"enabled\": true,\n \"url\": \"{{ $('Info_Base').item.json.typebotapi_url }}\",\n \"typebot\": \"{{ $('Campanha').item.json.typebot }}\",\n \"triggerType\": \"none\",\n \"triggerOperator\": \"regex\",\n \"triggerValue\": \"^atend.*\",\n \"expire\": 20,\n \"keywordFinish\": \"#SAIR\",\n \"delayMessage\": 1000,\n \"unknownMessage\": \"Mensagem não reconhecida\",\n \"listeningFromMe\": false,\n \"stopBotFromMe\": false,\n \"keepOpen\": false,\n \"debounceTime\": 10\n}",
|
||
"options": {}
|
||
},
|
||
"type": "n8n-nodes-base.httpRequest",
|
||
"typeVersion": 4.2,
|
||
"position": [
|
||
-1640,
|
||
960
|
||
],
|
||
"id": "76f57a7e-7fc2-4312-8472-ed5e7bb90aeb",
|
||
"name": "HTTP Request3"
|
||
},
|
||
{
|
||
"parameters": {
|
||
"content": "# Verifica Typebot",
|
||
"height": 497,
|
||
"width": 688,
|
||
"color": 2
|
||
},
|
||
"id": "8e51610d-6405-47f4-97b2-5ecd97185cfd",
|
||
"name": "Sticky Note19",
|
||
"type": "n8n-nodes-base.stickyNote",
|
||
"typeVersion": 1,
|
||
"position": [
|
||
-2160,
|
||
760
|
||
]
|
||
}
|
||
],
|
||
"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": "Switch",
|
||
"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": "If1",
|
||
"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
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"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
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "HTTP Request",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Envia msg",
|
||
"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
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If1": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "HTTP Request2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca tag",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"HTTP Request2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Code2",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"Code2": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "If7",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"If7": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca tag",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "HTTP Request3",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"HTTP Request3": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca tag",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
},
|
||
"HTTP Request": {
|
||
"main": [
|
||
[
|
||
{
|
||
"node": "Busca envios",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
],
|
||
[
|
||
{
|
||
"node": "Busca falhas",
|
||
"type": "main",
|
||
"index": 0
|
||
}
|
||
]
|
||
]
|
||
}
|
||
},
|
||
"active": false,
|
||
"settings": {
|
||
"executionOrder": "v1"
|
||
},
|
||
"versionId": "c9df5976-038a-47f4-8fd9-ccaa89ac8e76",
|
||
"meta": {
|
||
"instanceId": "33738330930e3881dd5571eca013f36ddf8aab20e4ea5c1f2ebaf4a2b4668ac6"
|
||
},
|
||
"id": "Q4CrI3Xyh7TKv9Qi",
|
||
"tags": [
|
||
{
|
||
"createdAt": "2025-03-25T03:35:54.500Z",
|
||
"updatedAt": "2025-03-25T03:35:54.500Z",
|
||
"id": "uq2dkKd9AYzGoGp5",
|
||
"name": "RodrigoTanci"
|
||
}
|
||
]
|
||
}
|