get paid to paste

Enviar lembrete aniversário

{
  "meta": {
    "instanceId": "7350ad64699d4a716bb17e2ac4a1abdc5dd751423501ba26d218b248995d24d7"
  },
  "nodes": [
    {
      "parameters": {},
      "id": "a91519bb-c58f-4dda-a056-84a9768ff149",
      "name": "Start",
      "type": "n8n-nodes-base.start",
      "typeVersion": 1,
      "position": [
        220,
        980
      ]
    },
    {
      "parameters": {
        "sheetId": "1K3Due-xPhv0s6_k7mv7FFKM79gyR3tTwtAVu0hK95y8",
        "options": {}
      },
      "id": "a3fe0f38-5564-4dc3-b1ff-bd7afea8559e",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 2,
      "position": [
        480,
        980
      ],
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "2",
          "name": "Jean - BotConversa"
        }
      }
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "id": "c4432761-a670-4d73-a8ea-ef1b3bdc4a43",
      "name": "SplitInBatches1",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 1,
      "position": [
        760,
        980
      ]
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "Data atual",
              "value": "={{$now}}"
            },
            {
              "name": "Data aniversário",
              "value": "={{ $json[\"Data nascimento\"] }}"
            }
          ]
        },
        "options": {}
      },
      "id": "6d602d60-3cea-44a6-aba4-bc9dd7a19f93",
      "name": "Datas",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        980,
        980
      ]
    },
    {
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json[\"Data atual\"].split('T')[0].split('-').reverse().join('/').slice(0,5)}}",
              "value2": "={{ $json[\"Data aniversário\"].slice(0,5)}}"
            }
          ]
        }
      },
      "id": "73fad30f-15fb-48c9-a511-678926a37fca",
      "name": "IF1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 1,
      "position": [
        1200,
        980
      ]
    },
    {
      "parameters": {},
      "id": "d9d19882-caa9-46ec-825a-40792d975ea0",
      "name": "Falso",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1440,
        1120
      ]
    },
    {
      "parameters": {},
      "id": "4d6146a1-5781-473b-8124-88b7cfae60fe",
      "name": "Verdadeiro",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1360,
        720
      ]
    },
    {
      "parameters": {
        "functionCode": "var telefone = items[0].json.telefone.replace(' ','').replace('(','').replace(')','').replace(' ','').replace(' ','').replace('-','').replace(' ','');\nvar ddd = telefone.slice(2,4);\nvar ddi = telefone.charAt(0);\nvar ddx = telefone.slice(0,2);\nvar length = telefone.length;\nif (length >= 12){\n  if (ddi == '+'){\n    ddi = telefone.slice(0,3);\n    telefone = parseInt(telefone.slice(3)).toString();\n  } else {\n    if (ddx == '55'){\n      telefone = parseInt(telefone.slice(2)).toString();\n      ddi = \"+55\";\n    } else {\n      telefone = parseInt(telefone).toString();\n      ddi = 'não informado';\n    }\n  }\n} else {\n  telefone = parseInt(telefone).toString();\n  ddi = 'não informado';\n}\n\nddd = telefone.slice(0,2);\ntelefone = telefone.slice(2);\nif (ddd > 28){\n  telefone = telefone.slice(-8);\n} else {\n  telefone = '9'+telefone.slice(-8);\n}\nvar whatsapp_formatado = '+55'+ddd+telefone;\n\nreturn [\n  {\n    json: {\n      ddi,\n      ddd,\n      telefone,\n      whatsapp_formatado,   \n    }\n  }\n];"
      },
      "name": "Validar Telefone",
      "type": "n8n-nodes-base.function",
      "position": [
        1780,
        720
      ],
      "typeVersion": 1,
      "id": "ecb2d4ae-aa38-42ce-8fc3-46ddfc859c84"
    },
    {
      "parameters": {
        "values": {
          "string": [
            {
              "name": "telefone",
              "value": "=+{{ $node[\"SplitInBatches1\"].json[\"Telefone\"].toString()}}"
            }
          ]
        },
        "options": {}
      },
      "id": "41a4d15f-16a9-4280-9bd4-3ee179eb53ca",
      "name": "Telefone",
      "type": "n8n-nodes-base.set",
      "typeVersion": 1,
      "position": [
        1580,
        720
      ]
    },
    {
      "parameters": {
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "requestMethod": "POST",
        "url": "=https://backend.botconversa.com.br/api/v1/webhook/subscriber/",
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "phone",
              "value": "={{ $json[\"whatsapp_formatado\"] }}"
            },
            {
              "name": "first_name",
              "value": "={{ $node[\"SplitInBatches1\"].json[\"Nome\"].split(' ')[0]}}"
            },
            {
              "name": "last_name",
              "value": "={{ $node[\"SplitInBatches1\"].json[\"Nome\"].split(' ')[1]}} {{ $node[\"SplitInBatches1\"].json[\"Nome\"].split(' ')[2]}} {{ $node[\"SplitInBatches1\"].json[\"Nome\"].split(' ')[3]}}"
            }
          ]
        }
      },
      "id": "64feb937-57e7-45f1-8876-5b5204e5c3dc",
      "name": "Cadastrar na audiência",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        2000,
        720
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "29",
          "name": "Chave API AULA AVANCADA"
        }
      },
      "continueOnFail": true
    },
    {
      "parameters": {
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "url": "=https://backend.botconversa.com.br/api/v1/webhook/subscriber/{{$node[\"Validar Telefone\"].json[\"whatsapp_formatado\"]}}/",
        "options": {}
      },
      "id": "e29cd653-f228-4753-b8b9-bfae00c248a1",
      "name": "Buscar ID audiência",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        2240,
        720
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "29",
          "name": "Chave API AULA AVANCADA"
        }
      },
      "continueOnFail": true
    },
    {
      "parameters": {
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "requestMethod": "POST",
        "url": "=https://backend.botconversa.com.br/api/v1/webhook/subscriber/{{$node[\"Buscar ID audiência\"].json[\"id\"]}}/send_flow/",
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "flow",
              "value": "513439"
            }
          ]
        }
      },
      "id": "fa966ac6-6b2d-490c-a156-73e645d23f2c",
      "name": "Enviar fluxo",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 2,
      "position": [
        2460,
        720
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "29",
          "name": "Chave API AULA AVANCADA"
        }
      },
      "continueOnFail": true
    },
    {
      "parameters": {
        "amount": 10,
        "unit": "seconds"
      },
      "id": "c6d61939-b019-4e79-9709-faea653358c6",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1,
      "position": [
        2680,
        720
      ],
      "webhookId": "e35786b3-63cf-41d5-a5c4-ba631345ad81"
    },
    {
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "hour": 8
            }
          ]
        }
      },
      "id": "ebb80a39-c028-48b8-b2a7-a947fd816317",
      "name": "Cron",
      "type": "n8n-nodes-base.cron",
      "typeVersion": 1,
      "position": [
        220,
        1160
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "main": [
        [
          {
            "node": "SplitInBatches1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SplitInBatches1": {
      "main": [
        [
          {
            "node": "Datas",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Datas": {
      "main": [
        [
          {
            "node": "IF1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "IF1": {
      "main": [
        [
          {
            "node": "Verdadeiro",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Falso",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Falso": {
      "main": [
        [
          {
            "node": "SplitInBatches1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Verdadeiro": {
      "main": [
        [
          {
            "node": "Telefone",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Validar Telefone": {
      "main": [
        [
          {
            "node": "Cadastrar na audiência",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telefone": {
      "main": [
        [
          {
            "node": "Validar Telefone",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cadastrar na audiência": {
      "main": [
        [
          {
            "node": "Buscar ID audiência",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buscar ID audiência": {
      "main": [
        [
          {
            "node": "Enviar fluxo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enviar fluxo": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "SplitInBatches1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Cron": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

Pasted: Sep 1, 2022, 2:28:20 pm
Views: 2,087