{
  "name": "SDR Clinica Aula",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "clinica_webhook",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        280,
        580
      ],
      "id": "31a30dd8-61bd-4c32-a44c-a9a5794721b9",
      "name": "Webhook",
      "webhookId": "f6553f43-5883-481b-8565-10ce6055db49"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "c26e7772-c06f-4b38-9ee7-34508bb78f35",
              "name": "NumeroWhatsLead",
              "value": "={{ $('Webhook').item.json.body.data.key.remoteJid.substring(0,$('Webhook').item.json.body.data.key.remoteJid.indexOf(\"@\")) }}",
              "type": "string"
            },
            {
              "id": "f69b6a35-5e0f-4970-b3c4-1455b518e050",
              "name": "nomeIntancia",
              "value": "SuaInstancia",
              "type": "string"
            },
            {
              "id": "083ecc0a-f90a-4712-af63-3f18cf963e17",
              "name": "ApiKeyEVO",
              "value": "SuaChave",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        800,
        580
      ],
      "id": "9026d5e9-458c-42af-964c-15da06284420",
      "name": "Variaveis"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "2807dd4e-28c8-47d0-88c0-88b9d3fd8d6d",
              "leftValue": "={{ $json.body.data.key.fromMe }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        560,
        580
      ],
      "id": "b3e6afbf-681a-45a4-97aa-5dfe5c5dd0b2",
      "name": "MesagemExterna"
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1VHlvoCKyeG9_Zb_l5tIMXtRI8aJjHUtWP-Kurv60Jjg",
          "mode": "list",
          "cachedResultName": "Leads Aula",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VHlvoCKyeG9_Zb_l5tIMXtRI8aJjHUtWP-Kurv60Jjg/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "LeadsContato",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VHlvoCKyeG9_Zb_l5tIMXtRI8aJjHUtWP-Kurv60Jjg/edit#gid=0"
        },
        "filtersUI": {
          "values": [
            {
              "lookupColumn": "Whatsapp",
              "lookupValue": "={{ $json.NumeroWhatsLead }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1020,
        580
      ],
      "id": "75854474-b23c-421a-a7bb-082b91b02d90",
      "name": "BuscaDados",
      "alwaysOutputData": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YWenq5p5xoiGfNR3",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.isEmpty() }}",
                    "rightValue": "",
                    "operator": {
                      "type": "boolean",
                      "operation": "true",
                      "singleValue": true
                    },
                    "id": "1284c8fd-e45a-4e96-8cd7-6bbd6ff86c56"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Primeiro Contato"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": false,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "8275b567-b914-4c23-bb3c-9dc045b6341e",
                    "leftValue": "={{ $json['Atendimento Manual?'] }}",
                    "rightValue": "S",
                    "operator": {
                      "type": "string",
                      "operation": "notEquals"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Atendimento OK"
            }
          ]
        },
        "options": {
          "ignoreCase": true
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        1240,
        580
      ],
      "id": "31c72e0d-ae83-4005-9487-e0d92b367915",
      "name": "Switch"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1VHlvoCKyeG9_Zb_l5tIMXtRI8aJjHUtWP-Kurv60Jjg",
          "mode": "list",
          "cachedResultName": "Leads Aula",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VHlvoCKyeG9_Zb_l5tIMXtRI8aJjHUtWP-Kurv60Jjg/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "LeadsContato",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1VHlvoCKyeG9_Zb_l5tIMXtRI8aJjHUtWP-Kurv60Jjg/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Nome Lead": "={{ $('Webhook').item.json.body.data.pushName }}",
            "Whatsapp": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "Data Cadastro": "={{ $now.format('dd/MM/yyyy HH:mm') }}",
            "Atendimento Manual?": "N"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Nome Lead",
              "displayName": "Nome Lead",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Whatsapp",
              "displayName": "Whatsapp",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Data Cadastro",
              "displayName": "Data Cadastro",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Atendimento Manual?",
              "displayName": "Atendimento Manual?",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        1520,
        360
      ],
      "id": "870a3212-333c-4fa9-9778-b29ec8e47b55",
      "name": "SalvaDados",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "YWenq5p5xoiGfNR3",
          "name": "Google Sheets account"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://evolution.ericorenatoautomacao.com.br/message/sendText/{{ $('Variaveis').item.json.nomeIntancia }}",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "apikey",
              "value": "={{ $('Variaveis').item.json.ApiKeyEVO }}"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "number",
              "value": "={{ $('Variaveis').item.json.NumeroWhatsLead }}"
            },
            {
              "name": "text",
              "value": "={{ $json.resposta }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        5860,
        1160
      ],
      "id": "d543144f-19f2-4184-a540-83ea4f602342",
      "name": "EnviaMsg"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "b48312e7-334c-4d7d-a6de-6f968b0b8d43",
              "leftValue": "={{ $('BuscaDados').item.json.isEmpty() }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2.2,
      "position": [
        5140,
        860
      ],
      "id": "da7f17a6-7dec-4591-9a37-6d87d157ba1f",
      "name": "Filter"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "3f92debc-c2c0-4831-a1e3-29ccf2a8bb51",
              "name": "resposta",
              "value": "={{ $json.output.split(\"\\n\\n\") }}",
              "type": "array"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        5160,
        1100
      ],
      "id": "68ece5d3-29b1-4cc8-8a40-d4d710569e17",
      "name": "ArrayResposta"
    },
    {
      "parameters": {
        "fieldToSplitOut": "resposta",
        "options": {}
      },
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        5380,
        1100
      ],
      "id": "ad47f297-b0a1-4621-8f87-9741564bcdf7",
      "name": "Split Out"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        5600,
        1100
      ],
      "id": "72622b93-7979-4ba9-914b-f70a0efed996",
      "name": "Loop Over Items"
    },
    {
      "parameters": {
        "amount": 3
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        6080,
        1340
      ],
      "id": "167f7ee1-9ead-4320-8f5c-23812c365493",
      "name": "Wait",
      "webhookId": "4076f24b-44a7-4397-b22b-ec3e20c99282"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "be47ab44-77c8-4ae1-9683-239a9906f1ac",
              "name": "base64",
              "value": "={{ $('Webhook').item.json.body.data.message.base64 }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2020,
        380
      ],
      "id": "3afebbb7-258d-41c5-8e4d-c196572e7b65",
      "name": "Base64"
    },
    {
      "parameters": {
        "operation": "toBinary",
        "sourceProperty": "base64",
        "binaryPropertyName": "audio",
        "options": {
          "fileName": "audio.ogg",
          "mimeType": "audio/ogg"
        }
      },
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        2240,
        380
      ],
      "id": "67c2a04b-f8af-4189-98d3-f7c833367c01",
      "name": "Convert Base64"
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "binaryPropertyName": "audio",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        2460,
        380
      ],
      "id": "387e06be-894b-44d8-a76d-3bb78fb2d79f",
      "name": "TranscreveAudio",
      "credentials": {
        "openAiApi": {
          "id": "Oo8FUOo9UEEn46xn",
          "name": "OpenAi Conexão"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.merge",
      "typeVersion": 3.1,
      "position": [
        2860,
        600
      ],
      "id": "128176e9-9ed8-40d3-a64d-e483e2fc6313",
      "name": "Merge"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "2a64e9cd-a354-4f13-b573-cb99305f616b",
              "leftValue": "={{ $('Webhook').item.json.body.data.messageType }}",
              "rightValue": "audioMessage",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1800,
        600
      ],
      "id": "958aabf2-4f38-413f-b527-ae136805ef15",
      "name": "If Audio/texto"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6c064707-ec10-4741-b54b-cc0cc2d145ee",
              "name": "mensagem.texto",
              "value": "={{ $('Webhook').item.json.body.data.message.conversation }}",
              "type": "string"
            },
            {
              "id": "b67aedd5-92b0-4db8-b40c-8dafbfdc4e81",
              "name": "mensagem.id",
              "value": "={{ $('Webhook').item.json.body.data.key.id }}",
              "type": "string"
            },
            {
              "id": "4a35c12c-dad4-4b29-a13e-4eb6505edb46",
              "name": "mensagem.horaEnvio",
              "value": "={{ $('Webhook').item.json.body.data.messageTimestamp.toDateTime('s').toISO() }}",
              "type": "string"
            },
            {
              "id": "6f22433e-c943-4db8-a7fa-4eb454ebdaf9",
              "name": "mensagem.remoteId",
              "value": "={{ $('MesagemExterna').item.json.body.data.key.remoteJid }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2460,
        620
      ],
      "id": "192fa089-76ee-45b0-87a6-852abfd61b2b",
      "name": "Varaives Texto"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6c064707-ec10-4741-b54b-cc0cc2d145ee",
              "name": "mensagem.texto",
              "value": "={{ $json.text }}",
              "type": "string"
            },
            {
              "id": "b67aedd5-92b0-4db8-b40c-8dafbfdc4e81",
              "name": "mensagem.id",
              "value": "={{ $('Webhook').item.json.body.data.key.id }}",
              "type": "string"
            },
            {
              "id": "4a35c12c-dad4-4b29-a13e-4eb6505edb46",
              "name": "mensagem.horaEnvio",
              "value": "={{ $('Webhook').item.json.body.data.messageTimestamp.toDateTime('s').toISO() }}",
              "type": "string"
            },
            {
              "id": "6f22433e-c943-4db8-a7fa-4eb454ebdaf9",
              "name": "mensagem.remoteId",
              "value": "={{ $('MesagemExterna').item.json.body.data.key.remoteJid }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        2660,
        380
      ],
      "id": "8716fccd-aebf-4b64-aeb0-9c89aa20141d",
      "name": "Variaveis Audio"
    },
    {
      "parameters": {
        "operation": "push",
        "list": "={{ $json.mensagem.remoteId }}",
        "messageData": "={{ $json.mensagem.toJsonString() }}",
        "tail": true
      },
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        3080,
        600
      ],
      "id": "735affda-3155-4072-8b44-02453a192057",
      "name": "GravaDados",
      "credentials": {
        "redis": {
          "id": "XEnRs4pc7ZeXAWoY",
          "name": "Conexao Redis"
        }
      }
    },
    {
      "parameters": {
        "operation": "get",
        "propertyName": "mensagens",
        "key": "={{ $('Merge').item.json.mensagem.remoteId }}",
        "keyType": "list",
        "options": {}
      },
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        3300,
        600
      ],
      "id": "98734a5e-569a-4ce4-84cd-89622217a522",
      "name": "Recupera",
      "credentials": {
        "redis": {
          "id": "XEnRs4pc7ZeXAWoY",
          "name": "Conexao Redis"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.mensagens.first().parseJson().id }}",
                    "rightValue": "={{ $('Merge').item.json.mensagem.id }}",
                    "operator": {
                      "type": "string",
                      "operation": "notEquals"
                    },
                    "id": "5b7d4dd8-01a7-4be3-9648-cec4cf640fd5"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "Nada a fazer"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "5fc68b37-a832-4089-ba37-303b6bf4f89f",
                    "leftValue": "={{ $json.mensagens.last().parseJson().horaEnvio }}",
                    "rightValue": "={{ $now.minus(15,\"seconds\") }}",
                    "operator": {
                      "type": "dateTime",
                      "operation": "before"
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "continua"
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra",
          "renameFallbackOutput": "espera mensagem"
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        3500,
        600
      ],
      "id": "dc3524ea-b4bd-4de4-bbb4-72df9c49494a",
      "name": "Switch1"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        3660,
        360
      ],
      "id": "369aed63-7496-49b2-9321-da6289468e11",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        3680,
        840
      ],
      "id": "b9a0dbae-367d-4f59-a00d-1ffe53145b32",
      "name": "Wait1",
      "webhookId": "8a6d9a85-688b-4be1-a113-35ecd154cbec"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "9e7e3f1d-b701-4e72-841f-74a66e7858c6",
              "name": "todasMensagens",
              "value": "={{ $('Recupera').item.json.mensagens.map(item => JSON.parse(item).texto).join('\\n') }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        4040,
        600
      ],
      "id": "3318a63c-1f50-44db-bf39-ad1db33fdf83",
      "name": "TodasMsgFormatada"
    },
    {
      "parameters": {
        "operation": "delete",
        "key": "={{ $('Webhook').item.json.body.data.key.remoteJid }}"
      },
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        3720,
        600
      ],
      "id": "95558276-4b0d-49a1-ba5a-41ccab2081e0",
      "name": "Delete",
      "credentials": {
        "redis": {
          "id": "XEnRs4pc7ZeXAWoY",
          "name": "Conexao Redis"
        }
      }
    },
    {
      "parameters": {
        "content": "## Whatsapp\n",
        "height": 840,
        "width": 2560
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        120
      ],
      "typeVersion": 1,
      "id": "eaacc5da-baaf-4736-95f9-cdd56ae3ebc9",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Buffer\n",
        "height": 960,
        "width": 1440,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2840,
        80
      ],
      "typeVersion": 1,
      "id": "5ad8c70e-1aee-473d-8898-09ef529f179b",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "##API Evolution\n",
        "height": 880,
        "width": 1240,
        "color": 3
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        5040,
        700
      ],
      "typeVersion": 1,
      "id": "94998d14-4b07-48f4-8be3-155951a8bf32",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=# O nome do lead:\n{{ $('Webhook').item.json.body.data.pushName }}\n# Mensagem do lead:\n{{ $json.todasMensagens }}\n# Dia e Hora atual:\n{{ $now.toISO() }}\n# É primeiro contato?\n{{ $('BuscaDados').item.json.isEmpty() }}",
        "options": {
          "systemMessage": "=# 🎯 GOAL (Objetivo da IA)\n\nVocê é **Pamela**, recepcionista humana da **Clínica Volghan**, e também especialista em procedimentos estéticos.  \nSeu papel é atender leads via WhatsApp com:\n\n- Profissionalismo  \n- Acolhimento  \n- Empatia  \n- Eficiência  \n\n## 🧠 Seu objetivo é:\n\n1. Iniciar a conversa com acolhimento genuíno, humana e escuta ativa, criando um ambiente de confiança.\n2. Investigar cuidadosamente o que incomoda o lead:\n   - Faça perguntas abertas e específicas, guiadas pela empatia e naturalidade.\n   - Busque compreender todas as regiões, incômodos estéticos ou objetivos que o lead deseja alcançar.\n   - Nunca avance para sugestões ou agendamentos sem antes entender completamente a queixa.\n   - **SEMPRE** utilize a tool 'ShortMemory' para obter um resumo rápido da conversa com os principais pontos.\n\n3. **SEMPRE** Utilize a tool `Think` para organizar e conduzir seu raciocínio em 4 etapas antes de responder ao lead:\n   - **Coleta**: levantar todas as dores, desejos e expectativas do lead.\n   - **Análise**: com base nas queixas, consultar a(s) tool(s) especialista(s) apropriadas.\n   - **Aprofundamento**: confirmar se há outras regiões que o lead gostaria de tratar ou dúvidas que ainda não foram abordadas.\n   - **Sugestão**: indicar com clareza o(s) procedimento(s) ou pacote mais adequado ao perfil e relato do lead.\n4. **Somente após** a análise estar **completa** (todas as queixas esclarecidas, contexto validado e desejo de avançar confirmado), e o lead demonstrar interesse claro em:\n   - Saber o valor do(s) procedimento(s),\n   - Entender as formas de pagamento,\n   - Ou agendar uma avaliação...\n\n...então **você deverá acionar a tool `EncaminhaParaHumano`**, **junto com um resumo da conversa** que permita à equipe humana dar continuidade ao atendimento com total clareza.\n\n> O simples fato de mencionar preço **não é suficiente para encaminhar**. Pamela só deve transferir após considerar que todas as informações foram devidamente levantadas e analisadas.\n> Nunca revele ou insinue que você é uma IA, chatbot ou sistema.  \n> Não use frases genéricas como “estou aqui para ajudar” ou “meu trabalho é te atender melhor”.\n\n5. Use a tool `EncaminhaParaHumano` apenas uma vez por conversa.\n---\n\n# 📤 RETURN FORMAT (Formato da Resposta)\n\n- A resposta será enviada diretamente pelo WhatsApp.\n- Use a formatação negrito para reforçar palavras-chaves.\n- Até 3–4 linhas por bloco.\n- Nunca comece todas as mensagens com o nome do lead. Use variações.\n- Você não envia o resumo da conversa para o lead, apenas para a tool `EncaminhaParaHumano`.\n- Termine com uma pergunta aberta, caso precise avançar na coleta.\n**Exemplo:**  \n> *“Você sente mais incômodo com flacidez, falta de volume ou linhas de expressão?”*\n> NUNCA adicione na resposta a ação a ser executada da tool. \n**Exemplo:**  \n> *“Encaminhando para o atendimento humano”*.\n\n---\n\n## ✨ Estilo de Resposta\n\n- Suas mensagens devem ser **naturais, diretas e empáticas**, sem parecer automáticas ou padronizadas.\n- **Evite** iniciar frases com expressões genéricas como:\n  - “Obrigada por compartilhar”\n  - “Que bom que você mencionou”\n  - “Perfeito!” (como abertura)\n  - “Legal!” ou “Ótimo!” (como introdução)\n- Em vez disso, comece a frase diretamente com o conteúdo principal, mantendo a empatia dentro do próprio corpo da resposta.\n\n### ❌ Forma a evitar:\n> “Obrigada por compartilhar, Erico! Essas rugas que você mencionou...”\n\n### ✅ Forma correta:\n> “Essas rugas que você mencionou, Erico, são frequentemente chamadas de ‘linhas da testa’. Você já considerou algum tratamento para suavizá-las?”\n\n- Se o nome do lead estiver disponível, **use-o com moderação** no meio da frase, apenas quando for natural.\n- Sempre finalize com uma **pergunta aberta**, quando precisar continuar a conversa.\n\n---\n\n# 🔁 FLUXO DE ATENDIMENTO\n\n### 1️⃣ Abertura e Coleta Inicial  \nUse variações naturais, ex.:  \n> *“Seja bem-vindo{a - depende do nome do lead} a Clínica Volghan, eu me chamo Pamela e faço parte da equipe do Dr. Alberto Volghan e vou dar continuidade ao seu atendimento🥰”*  \n\n— Se for o primeiro contato, acrescente:  \n> *“Me conta: qual área você gostaria de melhorar e como posso te ajudar?”*\n\n---\n\n### 2️⃣ Investigar Antes de Sugerir  \n- Use a tool especialista para investigar a queixa do lead e assim sugerir determinado procedimento.\nExemplos:  \n- “Queria entender melhor: você se incomoda mais com flacidez, falta de volume ou linhas finas?”  \n- “Obrigado por compartilhar! Em qual região você sente isso com mais intensidade?”\n\n---\n\n### 3️⃣ Análise e Sugestão de Pacote ou Procedimento  \n- Se for uma queixa única:  \n  > *“Nesse caso, o *botox* vai suavizar suas linhas de expressão de forma rápida.”*  \n- Se houver múltiplas queixas:  \n  > *“Vejo que flacidez e perda de volume estão te incomodando — podemos fazer um pacote de *bioestimulador + preenchimento* para resultados mais completos.”*\n\n---\n\n### 4️⃣ Aprofundamento Final  \n> *“Algo mais que você gostaria de ajustar ou saber sobre esse pacote?”*\n\n---\n\n### 5️⃣ Encaminhamento  \nSó **após** o lead pedir valores, condições ou agendamento:  \n> *“Agora vou te passar para nossa equipe de agendamento e orçamento, tudo bem? 😊”*  \nChame a tool `EncaminhaParaHumano` com o resumo da conversa.\n\n---\n\n- Não termine respostas com frases genéricas (“estou aqui para ajudar”, “meu trabalho é te atender melhor”).  \n- Se precisar questionar algo, finalize sempre com uma **pergunta aberta**.\n\n---\n\n# 📌 Procedimentos disponíveis para classificação\n\n- *Botox*\n- *Preenchimento* (olheiras, lábios, bigode chinês)\n- *Harmonização facial*\n- *Bioestimulador de colágeno*\n- *Fios de colágeno*\n- *Fios de sustentação*\n\n---\n\n# 🛠️ TOOLS DISPONÍVEIS\n\n| Procedimento                      | Tool                                                   |\n|----------------------------------|---------------------------------------------------------|\n| Botox                            | `AIBotox`                                               |\n| Preenchimento de olheiras        | `AIOlheiras`                                            |\n| Preenchimento labial             | `AILabial`                                              |\n| Preenchimento bigode chinês      | `AIBigode`                                              |\n| Harmonização facial              | `AIHarmonizacao`                                        |\n| Bioestimulador de colágeno       | `AIBioestimulador`                                      |\n| Fios de sustentação              | `AIFiosSustentacao`                                     |\n| Fios de colágeno                 | `AIFiosColageno`                                        |\n\n**Sempre que for indicar um procedimento, consulte a respectiva tool e analise o retorno com a tool `Think`.**\n\n- Utilize a resposta da tool especialista para formatar uma resposta humanizada para o lead.\n\n- Utilize a tool especialista quais queixas o lead pode ter para ser atendido por determinado procedimento.\n\n- **SEMPRE**, utilize a tool 'ShortMemory' para obter um resumo rápido da conversa com os principais pontos.\n\n---\n\n# 📍 Dados da Clínica e Dr. Alberto\n\n- **Clínica Volghan**: estética avançada com foco em naturalidade e reestruturação facial.\n- **Endereço**: Rua Barão do Rio Branco, 63 – Centro, Curitiba – Sala 210\n- **Atendimento WhatsApp**: Seg a Sex das 09h às 19h\n- **Instagram**: [@clinicavolghan](https://www.instagram.com/clinicavolghan)\n- **Link do mapa**: https://maps.app.goo.gl/1JbXrRsqBQvbgGqq5\n- **Dr. Alberto**:\n  - Biomédico esteta com mais de 10 anos de experiência\n  - Especialista internacional em harmonização facial\n  - Criador do método de Reestruturação dos Terços da Face\n\n\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        4000,
        1340
      ],
      "id": "c375c701-7313-4348-8024-b2900c7a246c",
      "name": "Atendente Clinica"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "gpt-4o-mini",
          "mode": "list",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        3200,
        1640
      ],
      "id": "82b7276a-7c76-493b-8929-d0421e32502c",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "HfdUxqvMmClpTher",
          "name": "Conta OpenAi Clinica"
        }
      }
    },
    {
      "parameters": {
        "name": "ShortMemory",
        "description": "Chame essa tool quando precisar de um resumo rápido da conversa com o lead, com os pontos importantes",
        "workflowId": {
          "__rl": true,
          "value": "cynd1jA18fkHZjCM",
          "mode": "list",
          "cachedResultName": "ShortMemoryResumo"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        3500,
        1640
      ],
      "id": "0c63f256-fa98-4898-8e5f-92a4aa0b6ac3",
      "name": "ShortMemory"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
        "tableName": "clinica_conversas",
        "contextWindowLength": 50
      },
      "type": "@n8n/n8n-nodes-langchain.memoryPostgresChat",
      "typeVersion": 1.3,
      "position": [
        3360,
        1640
      ],
      "id": "060378f1-b0b2-40f7-99a1-677f9fb53492",
      "name": "ChatMemory",
      "credentials": {
        "postgres": {
          "id": "pqZyfR4kBDjtZStT",
          "name": "Postgres Conexao Clinica SDR"
        }
      }
    },
    {
      "parameters": {
        "name": "AIBotox",
        "description": "Chame essa tool quando o procedimento sugerido for Botox.",
        "workflowId": {
          "__rl": true,
          "value": "YM9PuOo2Kp4NBUIh",
          "mode": "list",
          "cachedResultName": "Agente Especialista BotoxAI"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}",
            "motivo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('motivo', ``, 'string') }}",
            "procedimento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('procedimento', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "motivo",
              "displayName": "motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "procedimento",
              "displayName": "procedimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        3640,
        1640
      ],
      "id": "6ca42528-8ec1-48a7-a3b0-b7f563902a68",
      "name": "AIBotox"
    },
    {
      "parameters": {
        "name": "AIOlheiras",
        "description": "Chame essa tool quando o procedimento indicado é Preenchimento de olheiras.",
        "workflowId": {
          "__rl": true,
          "value": "iWlIasn0ZYZrPmrI",
          "mode": "list",
          "cachedResultName": "Agente Especialista OlheirasAI"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}",
            "motivo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('motivo', ``, 'string') }}",
            "procedimento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('procedimento', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "motivo",
              "displayName": "motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "procedimento",
              "displayName": "procedimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        3760,
        1640
      ],
      "id": "277e52be-99b9-4003-a9bc-727aa90c8a53",
      "name": "AIOlheiras"
    },
    {
      "parameters": {
        "name": "AILabial",
        "description": "Chame essa tool quando o procedimento indicado é preenchimento labial.",
        "workflowId": {
          "__rl": true,
          "value": "0f2xvhQULEAQkD8f",
          "mode": "list",
          "cachedResultName": "Agente Especialista LabialAI"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}",
            "motivo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('motivo', ``, 'string') }}",
            "procedimento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('procedimento', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "motivo",
              "displayName": "motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "procedimento",
              "displayName": "procedimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        3880,
        1640
      ],
      "id": "8f691c81-b3e3-46f2-9446-690fcb350496",
      "name": "AILabial"
    },
    {
      "parameters": {
        "name": "AIBigode",
        "description": "Chame essa tool quando o procedimento indicado é para bigode chinês.",
        "workflowId": {
          "__rl": true,
          "value": "ayyhVtgBgQiqxZb8",
          "mode": "list",
          "cachedResultName": "Agente Especialista BigodeAI"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}",
            "motivo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('motivo', ``, 'string') }}",
            "procedimento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('procedimento', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "motivo",
              "displayName": "motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "procedimento",
              "displayName": "procedimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        4000,
        1640
      ],
      "id": "39182c9b-9999-445c-9c46-032b6652a5d1",
      "name": "AIBigode"
    },
    {
      "parameters": {
        "name": "AIHarmonizacao",
        "description": "Chame essa tool quando o procedimento indicado é para harmonização facial.",
        "workflowId": {
          "__rl": true,
          "value": "zTDQ4qd1FbEAawMd",
          "mode": "list",
          "cachedResultName": "Agente Especialista HarmonizacaoAI"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}",
            "motivo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('motivo', ``, 'string') }}",
            "procedimento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('procedimento', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "motivo",
              "displayName": "motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "procedimento",
              "displayName": "procedimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        4120,
        1640
      ],
      "id": "73743738-35bd-460d-8f30-e736a7ad4e46",
      "name": "AIHarmonizacao"
    },
    {
      "parameters": {
        "name": "AIBioestimulador",
        "description": "Chame essa tool quando o procedimento indicado é para bioestimulador.",
        "workflowId": {
          "__rl": true,
          "value": "kqYvZI8GJEvzMYvc",
          "mode": "list",
          "cachedResultName": "Agente Especialista BioestimuladorAI"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}",
            "motivo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('motivo', ``, 'string') }}",
            "procedimento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('procedimento', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "motivo",
              "displayName": "motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "procedimento",
              "displayName": "procedimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        4260,
        1640
      ],
      "id": "12306021-3813-42d2-ba57-5e298baa5e37",
      "name": "AIBioestimulador"
    },
    {
      "parameters": {
        "name": "AIFiosSustentacao",
        "description": "Chame essa tool quando o procedimento indicado é para fios de sustentação.",
        "workflowId": {
          "__rl": true,
          "value": "RTdMzTuvcr5NB8n4",
          "mode": "list",
          "cachedResultName": "Agente Especialista FiosSustentacaoAI"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}",
            "motivo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('motivo', ``, 'string') }}",
            "procedimento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('procedimento', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "motivo",
              "displayName": "motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "procedimento",
              "displayName": "procedimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        4400,
        1640
      ],
      "id": "1cb73370-bd68-4623-b1a0-9a9b27c777d3",
      "name": "AIFiosSustentacao"
    },
    {
      "parameters": {
        "name": "AIFiosColageno",
        "description": "Chame essa tool quando o procedimento indicado é para fios de colageno.",
        "workflowId": {
          "__rl": true,
          "value": "vu1B6ie5wBf6HJAR",
          "mode": "list",
          "cachedResultName": "Agente Especialista FiosColagenoAI"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "whatsapID": "={{ $('Variaveis').item.json.NumeroWhatsLead }}",
            "mensagem": "={{ $json.todasMensagens }}",
            "motivo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('motivo', ``, 'string') }}",
            "procedimento": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('procedimento', ``, 'string') }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "whatsapID",
              "displayName": "whatsapID",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "motivo",
              "displayName": "motivo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            },
            {
              "id": "procedimento",
              "displayName": "procedimento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string"
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        4540,
        1640
      ],
      "id": "b448b43d-07af-46fb-a569-62aab4414ea0",
      "name": "AIFiosColageno"
    },
    {
      "parameters": {
        "name": "EncaminhaParaHumano",
        "description": "Chame essa tool quando precisar encaminhar para um humano.",
        "workflowId": {
          "__rl": true,
          "value": "JmTSAT9jNPvUYnRy",
          "mode": "list",
          "cachedResultName": "ChamaAtendente"
        },
        "workflowInputs": {
          "mappingMode": "defineBelow",
          "value": {
            "mensagem": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('mensagem', ``, 'string') }}"
          },
          "matchingColumns": [
            "mensagem"
          ],
          "schema": [
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "canBeUsedToMatch": true,
              "type": "string",
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "typeVersion": 2.1,
      "position": [
        4700,
        1640
      ],
      "id": "17497e92-d0a7-49af-9a51-1318bacf5e47",
      "name": "EncaminhaParaHumano"
    },
    {
      "parameters": {
        "description": "=Use the tool to think para processar a cadeia de pensamento para analisar a conversa com o lead. It will not obtain new information or change the database, but just append the thought to the log. Use it when complex reasoning or some cache memory is needed."
      },
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "typeVersion": 1,
      "position": [
        4840,
        1640
      ],
      "id": "b807915a-6427-4714-8829-2ec7563cecbf",
      "name": "Think"
    },
    {
      "parameters": {
        "operation": "delete",
        "key": "={{ $('Variaveis').item.json.NumeroWhatsLead }}-resumo-conversa"
      },
      "type": "n8n-nodes-base.redis",
      "typeVersion": 1,
      "position": [
        1160,
        360
      ],
      "id": "724d635b-bf69-49fc-b0f6-e0ee5688669c",
      "name": "ApagaDados",
      "credentials": {
        "redis": {
          "id": "XEnRs4pc7ZeXAWoY",
          "name": "Conexao Redis"
        }
      }
    }
  ],
  "pinData": {
    "Webhook": [
      {
        "json": {
          "headers": {
            "host": "hookautomation.ericorenato.com.br",
            "user-agent": "axios/1.7.9",
            "content-length": "931",
            "accept-encoding": "gzip, compress, deflate, br",
            "content-type": "application/json",
            "x-forwarded-for": "104.131.52.176",
            "x-forwarded-host": "hookautomation.ericorenato.com.br",
            "x-forwarded-port": "443",
            "x-forwarded-proto": "https",
            "x-forwarded-server": "6fe0bbbb227f",
            "x-real-ip": "104.131.52.176"
          },
          "params": {},
          "query": {},
          "body": {
            "event": "messages.upsert",
            "instance": "AtendimentoErico",
            "data": {
              "key": {
                "remoteJid": "558496306412@s.whatsapp.net",
                "fromMe": false,
                "id": "3AE1E086465F7FF3E5FF"
              },
              "pushName": "Erico Renato Almeida",
              "status": "DELIVERY_ACK",
              "message": {
                "conversation": "quanto fica?",
                "messageContextInfo": {
                  "deviceListMetadata": {
                    "senderKeyHash": "HsVawLXe7EFgXA==",
                    "senderTimestamp": "1744730973",
                    "recipientKeyHash": "nP+ufwn0uPRCGg==",
                    "recipientTimestamp": "1745416872"
                  },
                  "deviceListMetadataVersion": 2,
                  "messageSecret": "jFGOvNNl2X5u+k5QwpOPeNGFpcpM2GcNTZ6OXcz/Oxo="
                }
              },
              "messageType": "conversation",
              "messageTimestamp": 1745797087,
              "instanceId": "a3a1ece9-4822-4fe5-af2c-871a0566b74f",
              "source": "ios"
            },
            "destination": "https://hookautomation.ericorenato.com.br/webhook/clinica_webhook",
            "date_time": "2025-04-27T20:38:08.783Z",
            "sender": "554198520712@s.whatsapp.net",
            "server_url": "https://evolution.ericorenatoautomacao.com.br",
            "apikey": "8658A0C116F4-4C89-A3C0-4DC209CFBA31"
          },
          "webhookUrl": "https://hookautomation.ericorenato.com.br/webhook/clinica_webhook",
          "executionMode": "production"
        }
      }
    ]
  },
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "MesagemExterna",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "MesagemExterna": {
      "main": [
        [
          {
            "node": "Variaveis",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Variaveis": {
      "main": [
        [
          {
            "node": "BuscaDados",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "BuscaDados": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "SalvaDados",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "If Audio/texto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "SalvaDados": {
      "main": [
        [
          {
            "node": "If Audio/texto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        []
      ]
    },
    "ArrayResposta": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "EnviaMsg",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "EnviaMsg": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Base64": {
      "main": [
        [
          {
            "node": "Convert Base64",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert Base64": {
      "main": [
        [
          {
            "node": "TranscreveAudio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "TranscreveAudio": {
      "main": [
        [
          {
            "node": "Variaveis Audio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If Audio/texto": {
      "main": [
        [
          {
            "node": "Base64",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Varaives Texto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "GravaDados",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Varaives Texto": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Variaveis Audio": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "GravaDados": {
      "main": [
        [
          {
            "node": "Recupera",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recupera": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch1": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Delete",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait1": {
      "main": [
        [
          {
            "node": "Recupera",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "TodasMsgFormatada": {
      "main": [
        [
          {
            "node": "Atendente Clinica",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete": {
      "main": [
        [
          {
            "node": "TodasMsgFormatada",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Atendente Clinica": {
      "main": [
        [
          {
            "node": "ArrayResposta",
            "type": "main",
            "index": 0
          },
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "ShortMemory": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "ChatMemory": {
      "ai_memory": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "AIBotox": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AIOlheiras": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AILabial": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AIBigode": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AIHarmonizacao": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AIBioestimulador": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AIFiosSustentacao": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AIFiosColageno": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "EncaminhaParaHumano": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "Atendente Clinica",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "afa3dce9-658a-4e49-a429-774da7d21cc5",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "c4c7e3e169971e7879cf5656c76cde093980d47b7b10790e6489dfee65fcc6d4"
  },
  "id": "dZ7vDut5g6VikSc3",
  "tags": []
}