{
  "name": "Agendamento v2.0 + Supabase + Pinecone + Áudio e Texto AULA",
  "nodes": [
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Credenciais').item.json.baseUrl }}/message/sendText/{{ $('Credenciais').item.json.instancia }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $('Credenciais').item.json.apikey }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"number\": \"{{ $('Credenciais').item.json.WhatsApp }}\",\n  \"text\": \"{{ $json.output.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"').trim() }}\"\n}\n",
        "options": {}
      },
      "id": "97d92df6-e092-4c89-a3ea-c8b1c0cf3929",
      "name": "Enviar Mensagem WhatsApp Lead6",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        3380,
        900
      ],
      "continueOnFail": true
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2f8e1fbf-9134-4b48-be29-066509e021f5",
              "name": "telefone",
              "value": "={{ $('Webhook').item.json.body.data.key.remoteJid }}",
              "type": "string"
            },
            {
              "id": "59fd3a53-08be-41db-b91e-9abccd7ef4ad",
              "name": "Audio",
              "value": "={{ $json.text || '' }}",
              "type": "string"
            },
            {
              "id": "1f3efabc-087b-4843-8766-742b9109e955",
              "name": "WhatsWeb",
              "value": "={{ $json.pergunta || ''}}",
              "type": "string"
            },
            {
              "id": "60d6b895-fea6-4d7f-932a-b8771c97242e",
              "name": "WhatsAppApp",
              "value": "={{ $json.mensagem || '' }}",
              "type": "string"
            },
            {
              "id": "f45d0d25-8456-4a53-9290-69eed044964e",
              "name": "Imagem",
              "value": "={{ $json.content || ''}}",
              "type": "string"
            },
            {
              "id": "0d9377f3-acbb-49ed-9254-ef9e3e561465",
              "name": "Documento",
              "value": "={{ $json.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "2f491dbf-98a7-4893-b363-d14fabbe4bbd",
      "name": "Filtra Webhook",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1700,
        720
      ]
    },
    {
      "parameters": {
        "amount": 0
      },
      "id": "03cfec0a-175f-4044-a025-27e5600b5f11",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1980,
        720
      ],
      "webhookId": "2875f9a3-cd5a-4f81-a376-7fb52c4dc83b"
    },
    {
      "parameters": {
        "operation": "get",
        "propertyName": "mensagem",
        "key": "={{ $json.telefone }}",
        "options": {}
      },
      "id": "4d1925ce-bde0-40ad-802d-10d592c0fefd",
      "name": "Puxar as Mensagens",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        1980,
        960
      ],
      "credentials": {
        "redis": {
          "id": "OiUMB4ciOVde7idb",
          "name": "Redis account 2"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 1
          },
          "conditions": [
            {
              "id": "9e9b4155-e399-4936-a5db-2d79c8cb871f",
              "leftValue": "={{ $json.mensagem.last() }}",
              "rightValue": "={{ $('Filtra Webhook').item.json.Audio || $('Filtra Webhook').item.json.WhatsWeb || $('Filtra Webhook').item.json.WhatsAppApp || $('Filtra Webhook').item.json.Imagem }}",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "7fdf2c5a-7cdf-4362-94b4-4acf7d941fab",
      "name": "If1",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        2140,
        840
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "bce70488-3d4e-412d-9c28-4858906bc722",
              "name": "mensagem",
              "value": "={{ $('Puxar as Mensagens').item.json.mensagem.join('\\n') }}",
              "type": "string"
            },
            {
              "id": "abca95c7-60a4-474b-95ed-a22557fa8af7",
              "name": "telefone",
              "value": "={{ $('Wait').item.json.telefone }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "409476c7-a059-40c2-b14f-37ba11a202f6",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2300,
        720
      ]
    },
    {
      "parameters": {},
      "id": "a1861c53-f194-45f2-80c8-64348de51d13",
      "name": "No Operation, do nothing",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        2300,
        980
      ]
    },
    {
      "parameters": {
        "operation": "delete",
        "key": "={{ $json.telefone }}"
      },
      "id": "80f96fcd-a80d-48a8-b4ee-8b973cdf1080",
      "name": "Redis",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        2500,
        720
      ],
      "credentials": {
        "redis": {
          "id": "OiUMB4ciOVde7idb",
          "name": "Redis account 2"
        }
      }
    },
    {
      "parameters": {},
      "id": "9f4a443d-8d3a-4649-9ff6-4410082727d4",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        2940,
        940
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "ea71d2ce-6780-4557-abfc-cf922f9623a6",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        2680,
        940
      ],
      "credentials": {
        "openAiApi": {
          "id": "2Wn4ZlGC30GW12Fg",
          "name": "OpenAi account 2"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Credenciais').item.json.baseUrl }}/chat/getBase64FromMediaMessage/{{ $('Credenciais').item.json.instancia }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $json.apikey }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"message\": {\n        \"key\": {\n            \"id\":  \"{{ $json.body.data.key.id }}\"\n        }\n    },\n    \"convertToMp4\": true\n} ",
        "options": {}
      },
      "id": "4554361e-d8f5-44d3-a9a6-4bb2bbfe3bee",
      "name": "Mensagem de Audio",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1200,
        480
      ],
      "retryOnFail": true,
      "maxTries": 2
    },
    {
      "parameters": {
        "operation": "toBinary",
        "sourceProperty": "base64",
        "options": {
          "fileName": "audio",
          "mimeType": "={{ $json.mimetype }}"
        }
      },
      "id": "84d8e3d7-7826-4f99-962d-58d34b358a33",
      "name": "Converter Áudio",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        1340,
        480
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6b7bef37-abbe-4207-aae0-5447388019a3",
              "name": "baseUrl",
              "value": "( base url evo )",
              "type": "string"
            },
            {
              "id": "67c50f2f-89e2-4a5c-84c2-c2ac76962f6e",
              "name": "apikey",
              "value": "(api key evo )",
              "type": "string"
            },
            {
              "id": "9177d222-437a-4284-a96f-115fba66662c",
              "name": "instancia",
              "value": "( instancia evo )",
              "type": "string"
            },
            {
              "id": "ab90e3ce-3657-4124-968d-37c0aaebd5ab",
              "name": "xi-api-key",
              "value": "( api eleven labs )",
              "type": "string"
            },
            {
              "id": "8d6c586e-0f00-4100-bc40-231cda7f93b7",
              "name": "WhatsApp",
              "value": "={{ $json.body.data.key.remoteJid }}",
              "type": "string"
            }
          ]
        },
        "includeOtherFields": true,
        "options": {}
      },
      "id": "dfb0b18d-87de-46c7-a500-b1268c660c22",
      "name": "Credenciais",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.3,
      "position": [
        640,
        820
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "17694db0-6248-444f-afb9-ff7ed13996ef",
              "name": "pergunta",
              "value": "={{ $('Webhook').item.json.body.data.message.extendedTextMessage.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "58a99d28-2fc7-46a3-9f43-7898b6da83d6",
      "name": "Texto Web",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.3,
      "position": [
        1180,
        640
      ],
      "notesInFlow": false,
      "alwaysOutputData": true
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2f8e1fbf-9134-4b48-be29-066509e021f5",
              "name": "telefone",
              "value": "={{ $('Webhook').item.json.body.data.key.remoteJid }}",
              "type": "string"
            },
            {
              "id": "a6004904-d9e1-4627-be79-d2a5b073d44f",
              "name": "mensagem",
              "value": "={{ $json.body.data.message.conversation }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "5279b7e1-cf75-4fbf-884c-17431a221e0b",
      "name": "Filta Msg App",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1180,
        800
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Credenciais').item.json.baseUrl }}/chat/getBase64FromMediaMessage/{{ $('Credenciais').item.json.instancia }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $('Credenciais').item.json.apikey }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"message\": {\n        \"key\": {\n            \"id\":  \"{{ $json.body.data.key.id }}\"\n        }\n    },\n    \"convertToMp4\": true\n} ",
        "options": {}
      },
      "id": "778c0e4f-bc2a-42a1-8dbb-aa74762db1b4",
      "name": "Envio de Imagens",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1180,
        940
      ],
      "retryOnFail": true,
      "maxTries": 2
    },
    {
      "parameters": {
        "operation": "toBinary",
        "sourceProperty": "base64",
        "options": {
          "fileName": "image",
          "mimeType": ""
        }
      },
      "id": "53cde6f8-ab22-4f33-b6cf-97bf0bc6a7b8",
      "name": "Converter Imagem",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        1320,
        940
      ]
    },
    {
      "parameters": {
        "operation": "push",
        "list": "={{ $json.telefone }}",
        "messageData": "={{ $json.Audio || $json.WhatsWeb || $json.WhatsAppApp || $json.Imagem || $json.mensagem}}",
        "tail": true
      },
      "id": "a2f754fe-6703-4454-bf67-c3cbb4f8f2fa",
      "name": "Lista Mensagens1",
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        1740,
        960
      ],
      "credentials": {
        "redis": {
          "id": "OiUMB4ciOVde7idb",
          "name": "Redis account 2"
        }
      }
    },
    {
      "parameters": {
        "operation": "pdf",
        "options": {}
      },
      "id": "30564335-6f29-481c-8aff-8d833a6d458d",
      "name": "Extrair Dados",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        1500,
        1100
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Credenciais').item.json.baseUrl }}/chat/getBase64FromMediaMessage/{{ $('Credenciais').item.json.instancia }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $('Credenciais').item.json.apikey }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"message\": {\n        \"key\": {\n            \"id\":  \"{{ $json.body.data.key.id }}\"\n        }\n    },\n    \"convertToMp4\": true\n} ",
        "options": {}
      },
      "id": "30382031-0d81-411b-85f6-d7e9200b1946",
      "name": "Envio de Documentos1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        1160,
        1100
      ],
      "retryOnFail": true,
      "maxTries": 2
    },
    {
      "parameters": {
        "operation": "toBinary",
        "sourceProperty": "base64",
        "options": {
          "fileName": "=image {{ $('Switch').item.json.body.data.message.documentMessage.fileName }}",
          "mimeType": "={{ $('Switch').item.json.body.data.message.documentMessage.mimetype }}"
        }
      },
      "id": "1884c38a-e69b-4945-8505-e5e210cda421",
      "name": "Converter Arquivo1",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        1340,
        1100
      ]
    },
    {
      "parameters": {
        "content": "Filtra as Mensagens",
        "height": 830.5893065371872,
        "width": 1231.9510817704675,
        "color": 5
      },
      "id": "b92b33fa-99ea-4bcd-8252-e283c0a14e9c",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        456,
        460
      ]
    },
    {
      "parameters": {
        "content": "Concatenação de Mensagens",
        "height": 830.15644164636,
        "width": 952.7060569889857,
        "color": 6
      },
      "id": "5c2e9679-b1b0-456a-88cc-6f6a7e670bca",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1680,
        460
      ]
    },
    {
      "parameters": {
        "content": "IA",
        "height": 828.8267661669029,
        "width": 1292.417508558578,
        "color": 4
      },
      "id": "6b6a1143-480d-4001-81fb-35f6fce1c9c7",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2629,
        460
      ]
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.telefone }}"
      },
      "id": "ffad3c52-723d-414e-92bd-48614a077d2f",
      "name": "Redis Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.3,
      "position": [
        2800,
        940
      ],
      "credentials": {
        "redis": {
          "id": "OiUMB4ciOVde7idb",
          "name": "Redis account 2"
        }
      }
    },
    {
      "parameters": {
        "content": "## Responde em Áudio\n",
        "height": 279.83391588940833,
        "width": 619.97914906351,
        "color": 3
      },
      "id": "82f129f9-6a03-4e6b-8132-09ab41d6a298",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        3300,
        459.3408755117304
      ]
    },
    {
      "parameters": {
        "content": "## Responde em Texto\n",
        "height": 239.1747914011388,
        "width": 249.0313820540327
      },
      "id": "850af2cb-10e7-46a8-a587-d3f52affd394",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        3300,
        820
      ]
    },
    {
      "parameters": {
        "content": "## Agendamentos\n",
        "height": 183.7289063119872,
        "width": 411.5476275128165,
        "color": 3
      },
      "id": "714cd8ad-833b-4234-91e9-83fa1baf2807",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2720,
        1300
      ]
    },
    {
      "parameters": {
        "mode": "delete"
      },
      "id": "10dd7482-fd8d-44ac-9b53-c9f9f3ad1da4",
      "name": "Chat Memory Manager",
      "type": "@n8n/n8n-nodes-langchain.memoryManager",
      "typeVersion": 1.1,
      "position": [
        1980,
        1420
      ],
      "disabled": true
    },
    {
      "parameters": {
        "content": "Limpa Memória",
        "height": 304.83247531487484,
        "width": 415.33068089188083,
        "color": 7
      },
      "id": "0017ceb9-bb38-4193-82ea-6a2a584b878a",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1920,
        1320
      ]
    },
    {
      "parameters": {
        "operation": "delete",
        "calendar": {
          "__rl": true,
          "value": "956a8d60d36c50009693bb721a1e6172ac4638ac706c3192d615a2570d2f1076@group.calendar.google.com",
          "mode": "list",
          "cachedResultName": "Aula Mago"
        },
        "eventId": "={{ $fromAI(\"Event_ID\",\"Id do evento que deve ser excluído\") }}",
        "options": {}
      },
      "id": "04181392-68fa-4118-88ec-784f16a873df",
      "name": "Deletar Evento1",
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.1,
      "position": [
        2760,
        1360
      ],
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "BRU0uDvkqqiTKNqA",
          "name": "Google Calendar account 1"
        }
      }
    },
    {
      "parameters": {
        "operation": "getAll",
        "calendar": {
          "__rl": true,
          "value": "956a8d60d36c50009693bb721a1e6172ac4638ac706c3192d615a2570d2f1076@group.calendar.google.com",
          "mode": "list",
          "cachedResultName": "Aula Mago"
        },
        "returnAll": true,
        "options": {
          "timeMin": "={{ $fromAI(\"Initital_DateTime\", \"Data e hora inicial da consulta Ex.: 2024-10-17 00:00:00\") }}",
          "timeMax": "={{ $fromAI(\"Final_DateTime\", \"Data e hora final da consulta Ex.: 2024-10-17 00:00:00\") }}",
          "timeZone": {
            "__rl": true,
            "value": "America/Sao_Paulo",
            "mode": "list",
            "cachedResultName": "America/Sao_Paulo"
          }
        }
      },
      "id": "9186f2dd-fb2e-4c08-88fa-3b4c759a12dc",
      "name": "Buscar Eventos1",
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.1,
      "position": [
        2900,
        1360
      ],
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "BRU0uDvkqqiTKNqA",
          "name": "Google Calendar account 1"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "id": "101c3ff7-e997-43bb-8e99-fe82746c5993",
                    "leftValue": "={{ $json.body.data.message.audioMessage }}",
                    "rightValue": "",
                    "operator": {
                      "type": "object",
                      "operation": "notEmpty",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "audioMessage"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "id": "4b94d2ac-53e5-4153-9377-4cc6db20cb1c",
                    "leftValue": "={{ $json.body.data.message.extendedTextMessage }}",
                    "rightValue": "",
                    "operator": {
                      "type": "object",
                      "operation": "notEmpty",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "extendedTextMessage"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "id": "38226af4-80fe-4155-9ceb-2379f44e29ed",
                    "leftValue": "={{ $json.body.data.message.conversation }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "conversation"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "id": "300366d9-2416-4cf4-93c3-e48c8761c60f",
                    "leftValue": "={{ $json.body.data.message.imageMessage }}",
                    "rightValue": "",
                    "operator": {
                      "type": "object",
                      "operation": "notEmpty",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "imageMessage"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 1
                },
                "conditions": [
                  {
                    "id": "f33566fd-3eb9-45f4-934a-3a39e2adca6c",
                    "leftValue": "={{ $('Webhook').item.json.body.data.messageType === 'documentMessage' }}",
                    "rightValue": true,
                    "operator": {
                      "type": "boolean",
                      "operation": "equals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "documentMessage"
            }
          ]
        },
        "options": {
          "fallbackOutput": "none"
        }
      },
      "id": "9c84b0e3-56a0-42bf-a203-d8f6ab0ab6fe",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3,
      "position": [
        820,
        800
      ]
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "options": {}
      },
      "id": "9d2fbebf-dee9-405c-be60-739d0b6b90f0",
      "name": "OpenAI2",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.6,
      "position": [
        1500,
        480
      ],
      "credentials": {
        "openAiApi": {
          "id": "2Wn4ZlGC30GW12Fg",
          "name": "OpenAi account 2"
        }
      }
    },
    {
      "parameters": {
        "calendar": {
          "__rl": true,
          "value": "956a8d60d36c50009693bb721a1e6172ac4638ac706c3192d615a2570d2f1076@group.calendar.google.com",
          "mode": "list",
          "cachedResultName": "Aula Mago"
        },
        "start": "={{ $fromAI(\"Start_Time\",\"Horário inicial do evento ex.:2024-10-08 00:00:00\") }}",
        "end": "={{ $fromAI(\"End_Time\",\"Horário final do evento ex.:2024-10-08 00:01:00\") }}",
        "additionalFields": {
          "attendees": [
            "( email organizador )",
            "={{ $fromAI (\"e-mail\", \"o email de agendamento da reunião\") }}"
          ],
          "color": "2",
          "conferenceDataUi": {
            "conferenceDataValues": {
              "conferenceSolution": "hangoutsMeet"
            }
          },
          "description": "(descrição evento )",
          "sendUpdates": "all",
          "summary": "=( alterar titulo ) Call - BotXpert & {{ $fromAI(\"Nome\") }}"
        }
      },
      "id": "d09d2d1d-8ff2-46eb-b5f1-cd8193a4809b",
      "name": "Criar Eventos",
      "type": "n8n-nodes-base.googleCalendarTool",
      "typeVersion": 1.1,
      "position": [
        3040,
        1360
      ],
      "credentials": {
        "googleCalendarOAuth2Api": {
          "id": "BRU0uDvkqqiTKNqA",
          "name": "Google Calendar account 1"
        }
      }
    },
    {
      "parameters": {
        "resource": "image",
        "operation": "analyze",
        "modelId": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "GPT-4O-MINI"
        },
        "text": "Descreva essa imagem, oque tem nela?",
        "inputType": "base64",
        "options": {}
      },
      "id": "e08865df-7c49-4b9d-97a1-45017b7aca40",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.6,
      "position": [
        1500,
        920
      ],
      "credentials": {
        "openAiApi": {
          "id": "2Wn4ZlGC30GW12Fg",
          "name": "OpenAi account 2"
        }
      }
    },
    {
      "parameters": {
        "content": "## Dados\n",
        "height": 183.7289063119872,
        "width": 155.86031171693085,
        "color": 6
      },
      "id": "100938b0-1573-425e-be1c-c0221caf45ef",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        3160,
        1300
      ]
    },
    {
      "parameters": {
        "descriptionType": "manual",
        "toolDescription": "=A ferramenta Supabase2 recebe os dados do agente de IA e cria um novo usuário na tabela \"Agendamentos\".",
        "tableId": "Agendamentos",
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "nome",
              "fieldValue": "={{ $fromAI(\"nome\") }}"
            },
            {
              "fieldId": "email",
              "fieldValue": "={{ $fromAI(\"email\") }}"
            },
            {
              "fieldId": "data e hora do evento",
              "fieldValue": "={{ $fromAI(\"Start_Time\") }}"
            },
            {
              "fieldId": "motivo",
              "fieldValue": "={{ $fromAI(\"motivo\") }}"
            },
            {
              "fieldId": "criado em",
              "fieldValue": "={{ $fromAI(\"dataehoraatual\") }}"
            }
          ]
        }
      },
      "id": "85243cfa-7169-40e9-9670-caa70e4830c2",
      "name": "Supabase2",
      "type": "n8n-nodes-base.supabaseTool",
      "typeVersion": 1,
      "position": [
        3200,
        1360
      ],
      "credentials": {
        "supabaseApi": {
          "id": "QPRfRq4Z93AAspAa",
          "name": "Supabase account"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.elevenlabs.io/v1/text-to-speech/jsCqWAovK2LkecY7zXl4",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Accept",
              "value": "audio/mpeg"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            },
            {
              "name": "xi-api-key",
              "value": "={{ $('Credenciais').item.json['xi-api-key'] }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"text\": \"{{ $json.output.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\\\\\"').replace(/\\*/g, '').replace(/\\s+/g, ' ').trim() }}\",\n    \"model_id\": \"eleven_multilingual_v2\",\n    \"voice_settings\": {\n        \"stability\": 0.5,\n        \"similarity_boost\": 0.5\n    }\n}",
        "options": {}
      },
      "id": "075a13d4-ee8e-40e7-a2ec-835ae4ced68c",
      "name": "ElevenLabs1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        3360,
        560
      ]
    },
    {
      "parameters": {
        "operation": "binaryToPropery",
        "options": {}
      },
      "id": "19706370-c7fd-4f49-8a26-7432b5671a58",
      "name": "Extract from File1",
      "type": "n8n-nodes-base.extractFromFile",
      "typeVersion": 1,
      "position": [
        3560,
        560
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "={{ $('Credenciais').item.json.baseUrl }}/message/sendWhatsAppAudio/{{ $('Credenciais').item.json.instancia }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $('Credenciais').item.json.apikey }}"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n    \"number\": \"{{ $('Webhook').item.json.body.data.key.remoteJid }}\",\n    \"audio\": \"{{ $json.data }}\"\n}\n",
        "options": {}
      },
      "id": "8574615f-6ed8-46a3-836d-40f0bf89700c",
      "name": "sendWhatsAppAudio1",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.1,
      "position": [
        3780,
        560
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "62f2e20d-0f99-43a6-93e5-c8c99ca2bd09",
        "options": {}
      },
      "id": "67e24bf8-6fcc-4271-a050-89d4fc12250a",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        480,
        820
      ],
      "webhookId": "62f2e20d-0f99-43a6-93e5-c8c99ca2bd09"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "9432a5cd-37fc-4ba9-a0e3-c12017585807",
              "leftValue": "={{ $json.output.length }}",
              "rightValue": 200,
              "operator": {
                "type": "number",
                "operation": "lt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "312fc99a-f298-4fd8-bd95-662568f6f648",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        3120,
        640
      ]
    },
    {
      "parameters": {
        "jsCode": "function limparMensagem(texto) {\n  if (typeof texto !== 'string') {\n    return '';\n  }\n\n  function removerMetadataTecnico(str) {\n    return str\n      // Remove padrões de tool_calls com colchetes\n      .replace(/tool_calls\\s*:\\s*\\[\\s*\\]\\s*,?/gi, '')\n      .replace(/invalid_tool_calls\\s*:\\s*\\[\\s*\\]\\s*,?/gi, '')\n      // Remove objetos type:human completos\n      .replace(/{\\s*type\\s*:\\s*human\\s*,?\\s*data\\s*:\\s*{\\s*content\\s*:\\s*[^}]*}\\s*}/g, '')\n      .replace(/type\\s*:\\s*human\\s*,?\\s*data\\s*:\\s*{\\s*content\\s*:\\s*[^}]*}/g, '')\n      // Remove padrões de metadata\n      .replace(/,?\\s*\"additional_kwargs\"\\s*[,:]?\\s*[{]?[^}]*[}]?\\s*,?\\s*\"response_metadata\"\\s*[,:]?\\s*[{][^}]*[}]/g, '')\n      // Remove chaves e colchetes soltos com seu conteúdo\n      .replace(/{\\s*[^{}]*}/g, '')\n      .replace(/\\[\\s*[^\\[\\]]*\\]/g, '')\n      // Remove dois pontos soltos e vírgulas\n      .replace(/\\s*:\\s*/g, ' ')\n      .replace(/\\s*,\\s*/g, ' ')\n      .trim();\n  }\n\n  function limparFormatacao(str) {\n    return str\n      // Remove caracteres de escape\n      .replace(/\\\\[rnt]/g, ' ')\n      .replace(/\\\\\"/g, '')\n      .replace(/\\\\\\\\/g, '')\n      // Remove aspas\n      .replace(/\"+/g, '')\n      // Remove chaves e colchetes soltos\n      .replace(/[{}[\\]]/g, '')\n      // Limpa pontuação\n      .replace(/\\s*([.,!?])\\s*/g, '$1 ')\n      // Remove múltiplos espaços\n      .replace(/\\s+/g, ' ')\n      // Remove caracteres de controle\n      .replace(/[\\x00-\\x1F\\x7F-\\x9F]/g, '')\n      .trim();\n  }\n\n  function extrairMensagemPrincipal(str) {\n    // Divide em frases\n    const frases = str.split(/(?<=[.!?])\\s+/);\n    \n    return frases\n      .map(frase => frase.trim())\n      .filter(frase => {\n        // Remove frases que são apenas metadata\n        return frase.length > 0 &&\n          !frase.includes('tool_calls') &&\n          !frase.includes('invalid_tool_calls') &&\n          !frase.includes('type:human') &&\n          !frase.includes('data:') &&\n          !frase.match(/^[:\\s\\[\\]{}]+$/) &&\n          !frase.match(/^[0-9\\s:]+$/);\n      })\n      .join(' ');\n  }\n\n  let resultado = texto;\n  \n  // Primeira passagem - remove metadata técnica\n  resultado = removerMetadataTecnico(resultado);\n  \n  // Segunda passagem - extrai mensagem principal\n  resultado = extrairMensagemPrincipal(resultado);\n  \n  // Terceira passagem - limpa formatação\n  resultado = limparFormatacao(resultado);\n  \n  // Limpeza final\n  resultado = resultado\n    .replace(/\\s+/g, ' ')\n    .replace(/^[\",\\s]+|[\",\\s]+$/g, '')\n    .trim();\n\n  return resultado;\n}\n\nfunction processarMensagens(items) {\n  return items.map(item => {\n    try {\n      if (!item?.json?.mensagem) {\n        return item;\n      }\n\n      let mensagem = item.json.mensagem;\n      \n      // Se for objeto, converte para string\n      if (typeof mensagem === 'object') {\n        try {\n          mensagem = JSON.stringify(mensagem);\n        } catch (e) {\n          console.error('Erro ao converter objeto para string:', e);\n          return item;\n        }\n      }\n\n      // Aplica a limpeza\n      const mensagemLimpa = limparMensagem(mensagem);\n      \n      // Atualiza apenas se houver conteúdo significativo\n      if (mensagemLimpa && mensagemLimpa.length > 0) {\n        item.json.mensagem = mensagemLimpa;\n      }\n\n      return { json: item.json };\n    } catch (error) {\n      console.error('Erro ao processar item:', error);\n      return item;\n    }\n  });\n}\n\n// Execução principal\ntry {\n  const items = $input.all();\n  return processarMensagens(items);\n} catch (error) {\n  console.error('Erro na execução:', error);\n  throw error;\n}"
      },
      "id": "624cf9e7-9592-4edb-9d06-0a3f97be9bb4",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        2600,
        560
      ]
    },
    {
      "parameters": {},
      "id": "a6c9d9ee-24ef-4edc-820b-499b1296de7a",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        693,
        1340
      ],
      "disabled": true
    },
    {
      "parameters": {
        "operation": "download",
        "fileId": {
          "__rl": true,
          "value": "( url google drive )",
          "mode": "url"
        },
        "options": {}
      },
      "id": "d248d745-6335-4d55-8e3b-6f68fe9d827b",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "typeVersion": 3,
      "position": [
        900,
        1380
      ],
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "hIf1ub4KefOVFb3d",
          "name": "Google Drive account"
        }
      }
    },
    {
      "parameters": {
        "dataType": "binary",
        "options": {}
      },
      "id": "0a0df02c-f8bb-44bf-8eee-6f472cb691b1",
      "name": "Default Data Loader",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        1153,
        1540
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "chunkSize": 3000,
        "chunkOverlap": 200,
        "options": {}
      },
      "id": "ec4e76f1-a925-4065-bacb-9ae986548dec",
      "name": "Recursive Character Text Splitter",
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "position": [
        1153,
        1680
      ],
      "typeVersion": 1
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "571bf9c7-5899-4361-9d83-2d10728964b8",
      "name": "Embeddings OpenAI1",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "position": [
        1033,
        1580
      ],
      "typeVersion": 1,
      "credentials": {
        "openAiApi": {
          "id": "2Wn4ZlGC30GW12Fg",
          "name": "OpenAi account 2"
        }
      }
    },
    {
      "parameters": {
        "content": "Database Informações",
        "height": 517.6827039739503,
        "width": 864.1985100368698,
        "color": 3
      },
      "id": "0dde06ae-72d1-45a6-a9e7-dcf6015a4129",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        620,
        1300
      ]
    },
    {
      "parameters": {
        "content": "## Configure antes de usar",
        "height": 219.8880124219723,
        "width": 198.17781071920416
      },
      "id": "8d3c8f36-dd2d-4d80-b986-8c7639794b9d",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        860,
        1300
      ]
    },
    {
      "parameters": {
        "name": "dentista",
        "description": "Use essa ferramenta para buscar informações sobre procedimentos e serviços."
      },
      "id": "4440ea81-fb92-408c-9a3a-0142ca6f52eb",
      "name": "Vector Store Tool",
      "type": "@n8n/n8n-nodes-langchain.toolVectorStore",
      "typeVersion": 1,
      "position": [
        3040,
        900
      ]
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "d22c9cbe-3012-4f06-a04e-a9a067116ba9",
      "name": "Embeddings OpenAI",
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1,
      "position": [
        2980,
        1120
      ],
      "credentials": {
        "openAiApi": {
          "id": "2Wn4ZlGC30GW12Fg",
          "name": "OpenAi account 2"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "id": "b8b9f132-2ae0-4457-998f-603e0694bb48",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1,
      "position": [
        3220,
        1040
      ],
      "credentials": {
        "openAiApi": {
          "id": "2Wn4ZlGC30GW12Fg",
          "name": "OpenAi account 2"
        }
      }
    },
    {
      "parameters": {
        "mode": "insert",
        "pineconeIndex": {
          "__rl": true,
          "value": "botxpert",
          "mode": "list",
          "cachedResultName": "botxpert"
        },
        "options": {
          "clearNamespace": true
        }
      },
      "id": "73fa9c00-eddc-4639-aebe-24e3f35109fb",
      "name": "Insert into Pinecone vector store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "position": [
        1093,
        1340
      ],
      "typeVersion": 1,
      "credentials": {
        "pineconeApi": {
          "id": "bjWgYyl8FrjyPXF3",
          "name": "PineconeApi account"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.mensagem }}",
        "options": {
          "systemMessage": "=Este assistente virtual é desenvolvido para oferecer suporte eficiente e amigável na gestão de agendamentos e cancelamentos de reuniões da empresa \"BotXpert\", especializada em criação de agentes de inteligência artificial. Ele ajuda os clientes a visualizar horários disponíveis, agendar reuniões personalizadas e fornecer detalhes completos sobre os serviços oferecidos. Seguindo o padrão brasileiro de data e hora (DD/MM/AAAA e HH), o assistente opera no fuso horário \"America/Sao_Paulo\". hora atual: {{ $now.format('HH:mm:ss') }}\n\nInformações da Empresa\nNome: BotXpert - Especialista em Criação de Agentes de IA\nEndereço: Avenida Paulista, 1234 - Bela Vista, São Paulo - SP, CEP 01310-100\nHorário de Funcionamento:\n\nSegunda a sexta-feira: das 08:00 às 18:00\nSábado: das 08:00 às 12:00\nServiços Disponíveis e Valores:\n\nConsultoria Inicial: R$ 300\nDesenvolvimento de Agentes Virtuais Personalizados: R$ 1.500\nTreinamento e Ajuste de Modelos de IA: R$ 1.000\nAvaliação e Otimização de Sistemas de IA: R$ 800\nOutros Serviços: valor mediante consulta\nFunções do Assistente\n1. Exibir Horários Disponíveis\nObjetivo: Mostrar os horários de consulta ou reunião disponíveis ao cliente, considerando um intervalo de datas informado, o fuso horário \"America/Sao_Paulo\" e o horário de funcionamento da BotXpert.\n\nCritérios de Exibição:\n\nExibir apenas horários futuros, a partir do momento atual.\nUtilizar o formato de data (DD/MM/AAAA) e horário (HH).\nNão solicitar o e-mail do cliente nesta etapa.\nconsiderando o momento atual e os horários de funcionamento da empresa. Exibiremos apenas horários futuros.\nExemplo de Resposta:\n\n📅 Data Atual: {{ $now.format('DD/MM/YYYY') }}\n\nHorários disponíveis para hoje:\n\n⏰ 08:00\n⏰ 09:00\n⏰ 10:00\n⏰ 11:00\n(continuar listagem conforme disponibilidade...)\nPor favor, informe o horário desejado e o motivo da reunião (ex: Consultoria Inicial, Treinamento de IA, Avaliação de Sistema, etc.) para prosseguir com o agendamento! 😊\n\n2. Solicitar Motivo da Reunião\nAntes de realizar o agendamento, o assistente deve:\n\nPerguntar ao cliente o motivo da reunião. Exemplos incluem: Consultoria Inicial, Desenvolvimento de Agentes Virtuais, Treinamento de Modelos de IA, Avaliação de Sistemas, entre outros.\nCondição: Somente após o cliente informar o motivo, o assistente poderá prosseguir para a etapa de confirmação do agendamento.\n3. Confirmar Agendamento\nObjetivo: Confirmar o agendamento após o cliente escolher um horário e informar o motivo da reunião.\n\nInstruções:\n\nSe o horário selecionado for para o mesmo dia, confirmar o agendamento para \"hoje\".\nCaso seja uma data futura, incluir a data e o horário do agendamento na confirmação.\nIncluir o nome do cliente e o motivo do agendamento no título do evento do Google Calendar, por exemplo: \"Reunião - João Silva - Consultoria Inicial\".\nSolicitar o e-mail do cliente para envio do link do evento e confirmação após a seleção do horário e motivo da reunião.\nDados Necessários: Nome, e-mail, data e horário do agendamento, motivo da reunião.\n\nExemplo de Resposta para Agendamento no Mesmo Dia:\n\n✅ Agendamento confirmado para hoje às [horário escolhido]! 😊\n\nExemplo para Data Futura:\n\n✅ Agendamento confirmado para [data escolhida] às [horário escolhido]! 😊\n\nDetalhes do seu agendamento:\n\nEndereço: Avenida Paulista, 1234 - Bela Vista, São Paulo - SP\nData: [data escolhida]\nHorário: [horário escolhido]\nMotivo da Reunião: [motivo informado pelo cliente]\nLink do Evento: [incluir o link do Google Calendar]\nLembre-se de trazer materiais relacionados ao projeto ou dúvidas específicas, se aplicável. Qualquer dúvida, estamos à disposição! 😊\n\n4. Cancelar Agendamento\nObjetivo: Cancelar um agendamento mediante o fornecimento do e-mail do cliente.\n\nInstruções:\n\nSolicitar o e-mail para cancelamentos, por questões de confirmação de segurança.\nConfirmar o cancelamento e informar o cliente com uma mensagem clara.\nDados Necessários: E-mail de confirmação.\n\nExemplo de Resposta de Cancelamento Bem-Sucedido:\n\n✅ Agendamento cancelado com sucesso em {{ $now.format('DD/MM/YYYY') }}! 😊\n\nCaso deseje reagendar ou tenha alguma dúvida, estamos à disposição!\n\nExemplo de Erro ao Cancelar:\n\n⚠️ Erro ao cancelar. Verifique o e-mail e tente novamente.\n\nUtilizar a ferramenta Supabase, para salvar os dados dos clientes, após o agendamento.\nSalvar as seguintes informações: nome, motivo, data e hora do agendamento, email."
        }
      },
      "id": "30504734-26a2-48f1-9658-78c0d2bb2a0f",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.6,
      "position": [
        2780,
        640
      ]
    },
    {
      "parameters": {
        "pineconeIndex": {
          "__rl": true,
          "value": "botxpert",
          "mode": "list",
          "cachedResultName": "botxpert"
        },
        "options": {}
      },
      "id": "5b096c36-e190-4a91-aaf1-8b4d806e7779",
      "name": "Pinecone Vector Store",
      "type": "@n8n/n8n-nodes-langchain.vectorStorePinecone",
      "typeVersion": 1,
      "position": [
        2980,
        1020
      ],
      "credentials": {
        "pineconeApi": {
          "id": "bjWgYyl8FrjyPXF3",
          "name": "PineconeApi account"
        }
      }
    }
  ],
  "pinData": {},
  "connections": {
    "Filtra Webhook": {
      "main": [
        [
          {
            "node": "Lista Mensagens1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Puxar as Mensagens",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Puxar as Mensagens": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Redis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redis": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Mensagem de Audio": {
      "main": [
        [
          {
            "node": "Converter Áudio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Converter Áudio": {
      "main": [
        [
          {
            "node": "OpenAI2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Credenciais": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Texto Web": {
      "main": [
        [
          {
            "node": "Filtra Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filta Msg App": {
      "main": [
        [
          {
            "node": "Filtra Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Envio de Imagens": {
      "main": [
        [
          {
            "node": "Converter Imagem",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Converter Imagem": {
      "main": [
        [
          {
            "node": "OpenAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lista Mensagens1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extrair Dados": {
      "main": [
        [
          {
            "node": "Filtra Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Envio de Documentos1": {
      "main": [
        [
          {
            "node": "Converter Arquivo1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Converter Arquivo1": {
      "main": [
        [
          {
            "node": "Extrair Dados",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Redis Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Buscar Eventos1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Deletar Evento1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Mensagem de Audio",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Texto Web",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Filta Msg App",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Envio de Imagens",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Envio de Documentos1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI2": {
      "main": [
        [
          {
            "node": "Filtra Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Criar Eventos": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI": {
      "main": [
        [
          {
            "node": "Filtra Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase2": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "ElevenLabs1": {
      "main": [
        [
          {
            "node": "Extract from File1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File1": {
      "main": [
        [
          {
            "node": "sendWhatsAppAudio1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Credenciais",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "ElevenLabs1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Enviar Mensagem WhatsApp Lead6",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Insert into Pinecone vector store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Insert into Pinecone vector store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI1": {
      "ai_embedding": [
        [
          {
            "node": "Insert into Pinecone vector store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Pinecone Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Vector Store Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pinecone Vector Store": {
      "ai_vectorStore": [
        [
          {
            "node": "Vector Store Tool",
            "type": "ai_vectorStore",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2eb8ba33-868e-4512-97c0-3c340899bd66",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "079e33df96811355e9a4b4196df7f240b7f4dcb46102b91d26bb671e95971058"
  },
  "id": "u2O2qb3NhqITr8EV",
  "tags": []
}