{
  "name": "Fin_Sql_bot",
  "nodes": [
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -1088,
        912
      ],
      "id": "e7892fce-9827-48ac-a342-c8473766972e",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        -640,
        912
      ],
      "id": "2ce440be-7d4e-47d8-a373-7288b70bfbf3",
      "name": "Calculator"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Mensagem do usu\u00e1rio:\n{{ $json.message.text }} {{ $json.text }}\nA data de hoje \u00e9 :\n{{ $today }}",
        "options": {
          "systemMessage": "=Voc\u00ea \u00e9 um assistente financeiro. Sua fun\u00e7\u00e3o \u00e9 responder pergunta sobre despesas anteriores, consultando uma planilha com registros di\u00e1rios.\nVoc\u00ea tem duas ferramentas :\n- 'Planilha financeira', que retorna dados por data \n- Use o \"calculator\" para soma valores e conta registros\nSempre que a pergunta mencionar per\u00edodos como \"ontem\", \"hoje\", \"semana passada\", converta isso para uma data exata no formato DD-MM-YYYY \n** antes de usar a ferramenta da planilha\nExemplo:\n Hoje \u00e9 \"07-07-2025\" e se a pergunta for ontem voc\u00ea deve responder igual \"06-07-2025\".  \nNunca use a data de \"hoje\" se a pergunta for \"ontem\"\nUse o campo da planilha \"Data\"para filtrar.\nConsidere que a data de hoje \u00e9 {{ $now}} .\nSua frase final deve ser unica estilo Whatsapp.\nSempre respoda como um assitente atencioso."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        -992,
        672
      ],
      "id": "73c75573-4965-41c6-b05b-59601e4618e1",
      "name": "Consultar"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=Voc\u00ea \u00e9 um assistente financeiro que interpreta instru\u00e7\u00f5es em portugu\u00eas geradas pelo usuario na mensagem {{ $json.message.text }} {{ $json.text }} e gera dados estruturados para uma tabela chamada `controle financeiro`. Esta tabela possui os seguintes campos:\n\n- descricao (texto)\n- valor (n\u00famero)\n- categoria (Receita ou Despesa)\n- projeto (texto)\n- data (hoje, se n\u00e3o for informado)\n- forma de pagamento (\u00d1 informado, se n\u00e3o for informado)\n\n### Regras:\n\n1. **Categoria (Receita ou Despesa):**\n   - Se a frase contiver palavras como **\"vendi\"**, **\"ganhei\"**, **\"recebi\"** ou o s\u00edmbolo **\"+\"**, a categoria \u00e9 **Receita**.\n   - Se contiver **\"paguei\"**, **\"gastei\"**, **\"comprei\"**, o s\u00edmbolo **\"-\"**, ou se n\u00e3o houver nenhuma indica\u00e7\u00e3o clara, a categoria \u00e9 **Despesa**.\n   - Se a categoria for explicitamente informada, use o valor informado.\n\n2. **Projeto:**\n   - Se a frase contiver palavras como \"Extra\", \"Pessoal\", \"Patrim\u00f4nio\", \"Casa\", \"Pai\" o projeto n\u00e3o for informado, defina como **\"Pessoal\"**.\n\n3. **Data:**\n   - Se n\u00e3o for informada, use a data {{ $now }} atual de hoje no formato (\"AAAA/MM/DD\").\n4. \n- Inserir um gasto ou receita\n- Consultar um gasto ou receita\n- Remover um gasto ou receita\n\n### Regras para remo\u00e7\u00e3o:\n- Se a instru\u00e7\u00e3o contiver termos como: \"remover\", \"deletar\", \"apagar\", \"cancelar\", \"excluir\", \"desfazer\", entenda como uma solicita\u00e7\u00e3o para excluir uma linha da planilha.\n- Para exclus\u00e3o, gere um objeto JSON contendo os crit\u00e9rios para identificar a linha: `descricao`, `valor`, `data`, e `categoria`, se dispon\u00edveis.\n- Retorne um objeto como:\n```json\n{\n  \"acao\": \"deletar\",\n  \"descricao\": \"mercado\",\n  \"valor\": 50,\n  \"data\": \"2025/07/20\"\n}\nPara deletar ou apagar utilize \"Delete rows from sheet\"\n\n\n\n\n\n[Output]\nAp\u00f3s salvar os dados, responda com:\n\"\u2705 Despesa registrada: [descri\u00e7\u00e3o] \u2013 R$[valor] em [data].\"\n\nAp\u00f3s deletar os dados responda:\n\"\u2705 Despesa atualizada: Foram retirados  [descri\u00e7\u00e3o \u2013 R$[valor] em [data].\"\n\nAp\u00f3s listar os dados responda:\n\"\u2705 Estas s\u00e3o suas despesas de hoje, [descri\u00e7\u00e3o] \u2013 R$[valor] em [data].\" .\n\nSe houver erro, diga:\n\"\u274c N\u00e3o consegui registrar a despesa. Pode repetir com mais detalhes?\"",
        "hasOutputParser": true,
        "options": {
          "systemMessage": "Voc\u00ea \u00e9 um assistente financeiro. Seu papel \u00e9 interpretar mensagens de texto sobre despesas e extrair os dados de forma estruturada, com o objetivo de preencher automaticamente uma planilha de controle de gastos.\n\n\nAl\u00e9m disso, voc\u00ea deve gerar uma frase de confirma\u00e7\u00e3o no campo \"resumo\", em tom simp\u00e1tico e direto, como se fosse um atendente humano respondendo no WhatsApp. O texto deve confirmar que a despesa foi registrada com sucesso, citando os principais dados como valor, descri\u00e7\u00e3o, projeto e forma de pagamento. Escreva a frase em uma \u00fanica linha, sem quebras.\n"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2,
      "position": [
        -976,
        240
      ],
      "id": "9c5664ec-f0a8-4b8a-951f-1ccbcb7e4cc0",
      "name": "Inserir"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -976,
        432
      ],
      "id": "8d510c4a-d7d2-4f30-ba19-87d72b468909",
      "name": "OpenAI Chat Model1",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "cc788c26-b139-4df5-8050-744c0c114737",
              "leftValue": "={{ $json.message.from.id }}",
              "rightValue": "={{ $json.message.from.id }}",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -1632,
        368
      ],
      "id": "e94b316e-3dea-4c95-acc5-380258f07b96",
      "name": "Seletor de Id"
    },
    {
      "parameters": {
        "inputText": "=Voce vai receber uma mensagem de um usu\u00e1rio.\nClassifique a intens\u00e3o da mensagem com base nas op\u00e7\u00f5es abaixo:\n- \"registro\" : se o usuario estiver informando nova despesa. \n- \"consulta\" : se tiver pedindo para ver , consultar, saber ou buscar informa\u00e7\u00f5es financeiras anteriores.\nResponda somente com palavra: \"registro\" ou \"consulta\" .\nMensagem:{{ $json.message.text }} {{ $json.text }}\n",
        "categories": {
          "categories": [
            {
              "category": "registro",
              "description": "=Se o usu\u00e1rio estiver informando uma nova despesa, gasto, compra, pagamentos realizado, apagar, deletar.\n\n"
            },
            {
              "category": "consulta",
              "description": "=se o usu\u00e1rio estiver pedindo uma consulta ou buscar informa\u00e7\u00f5es sobre despesas passadas"
            }
          ]
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "typeVersion": 1.1,
      "position": [
        -1408,
        400
      ],
      "id": "c8321e78-1ef2-4a21-8969-34dbecd126bf",
      "name": "Text Classifier"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -1360,
        704
      ],
      "id": "046738a9-ea5f-4f9f-8f27-95f664fe1d58",
      "name": "OpenAI Chat Model2",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsonSchemaExample": "{\n  \"lancamentos\": [\n    {\n      \"acao\": \"inserir\",\n      \"descricao\": \"ra\u00e7\u00e3o\",\n      \"valor\": 30,\n      \"categoria\": \"Despesa\",\n      \"projeto\": \"Pessoal\",\n      \"data\": \"20/07/2025\",\n      \"forma de pagamento\": \"Pix\",\n      \"resumo\": \"Lan\u00e7amento registrado: R$30 com ra\u00e7\u00e3o no projeto Pessoal, pago via Pix.\"\n    }\n  ]\n}\n"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        -768,
        416
      ],
      "id": "002db393-2a44-4343-8f9e-e0b813ce668e",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU",
          "mode": "list",
          "cachedResultName": "Controle Finaceiro",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "P\u00e1gina1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Data": "={{ $json.output.lancamentos[0].data }}",
            "Descri\u00e7\u00e3o": "={{ $json.output.lancamentos[0].descricao }}",
            "Valor": "={{ $json.output.lancamentos[0].valor }}",
            "Categoria": "={{ $json.output.lancamentos[0].categoria }}",
            "Projeto": "={{ $json.output.lancamentos[0].projeto }}",
            "Forma de pagamento": "={{ $json.output.lancamentos[0]['forma de pagamento'] }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Data",
              "displayName": "Data",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Descri\u00e7\u00e3o",
              "displayName": "Descri\u00e7\u00e3o",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Valor",
              "displayName": "Valor",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Categoria",
              "displayName": "Categoria",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Projeto",
              "displayName": "Projeto",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Forma de pagamento",
              "displayName": "Forma de pagamento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "output",
              "displayName": "output",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        16,
        352
      ],
      "id": "8587e4be-bdf3-4f35-9dc7-3a33a3eef110",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "inputText": "=Voce vai receber uma mensagem de um usu\u00e1rio.\nClassifique a intens\u00e3o da mensagem com base nas op\u00e7\u00f5es abaixo:\n- \"inserir\" : se o usuario estiver informando nova despesa. \n- \"delete\" : se tiver pedindo para apagar , deletar, excluir ou tirar informa\u00e7\u00f5es financeiras anteriores.\nResponda somente com palavra: \"inserir\" ou \"delete\" .\nMensagem:\n{{ $json.output.lancamentos[0].acao }}",
        "categories": {
          "categories": [
            {
              "category": "Delete",
              "description": "=Se o usu\u00e1rio estiver informando para deletar , excluir, retirar exclua a saida Delete rows from sheet, uma por vez\n\n"
            },
            {
              "category": "inserir",
              "description": "=Se o usu\u00e1rio estiver informando uma nova despesa ou varias, gasto, compra, pagamentos realizado, lan\u00e7ar uma a uma na saida Append row in sheet "
            }
          ]
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textClassifier",
      "typeVersion": 1.1,
      "position": [
        -560,
        16
      ],
      "id": "e4526b5c-cde3-459d-821d-3d57519b4191",
      "name": "Text Classifier1"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -544,
        208
      ],
      "id": "8b1b0d4c-6a26-4cdd-b09f-c26a4584055e",
      "name": "OpenAI Chat Model3",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU",
          "mode": "list",
          "cachedResultName": "Controle Finaceiro",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "P\u00e1gina1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU/edit#gid=0"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.6,
      "position": [
        -784,
        928
      ],
      "id": "10cdb520-0e53-4198-bd0e-eb6554964f18",
      "name": "Controle Financeiro-GET",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "documentId": {
          "__rl": true,
          "value": "1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU",
          "mode": "list",
          "cachedResultName": "Controle Finaceiro",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 1305542657,
          "mode": "list",
          "cachedResultName": "P\u00e1gina2",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU/edit#gid=1305542657"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheetsTool",
      "typeVersion": 4.6,
      "position": [
        -912,
        1024
      ],
      "id": "4ab58607-ff8a-4027-8895-7565e188b056",
      "name": "Controle Financeiro-GET1",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $json.message.text }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    },
                    "id": "e02ff37b-04a7-4f38-bf46-807a4be666c1"
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "text"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "4d7e5a7c-fa5d-4cb6-8da2-c0a4e0212ed3",
                    "leftValue": "={{ $json.message.voice.file_id }}",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "voice"
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "c73619ad-ac9d-4387-80de-0560fce9731f",
                    "leftValue": "error",
                    "rightValue": "",
                    "operator": {
                      "type": "string",
                      "operation": "exists",
                      "singleValue": true
                    }
                  }
                ],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "error"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -2448,
        560
      ],
      "id": "77f16d91-7a98-4f40-a35a-f474f4015fa6",
      "name": "Switch"
    },
    {
      "parameters": {
        "resource": "audio",
        "operation": "transcribe",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.8,
      "position": [
        -1904,
        608
      ],
      "id": "3ac665e1-a5c2-4a09-aecc-ec366a0b2cb8",
      "name": "Transcribe a recording",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "updates": [
          "message"
        ],
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegramTrigger",
      "typeVersion": 1.2,
      "position": [
        -2656,
        544
      ],
      "id": "c331a1e5-9b1f-43f0-b65a-65e12d03a547",
      "name": "fin sql_bot",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('fin sql_bot').item.json.message.from.id }}",
        "text": "={{ $('Inserir').item.json.output.lancamentos[0].resumo }}",
        "replyMarkup": "=none",
        "forceReply": {},
        "replyKeyboardOptions": {},
        "replyKeyboardRemove": {},
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -240,
        416
      ],
      "id": "3627ee66-5016-4fc8-8b6a-f994cbdbcfef",
      "name": "fin sql_bot1",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "chatId": "={{ $('fin sql_bot').item.json.message.from.id }}",
        "text": "={{ $json.output }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -640,
        688
      ],
      "id": "024575f5-e91d-44f9-94ce-69b5503739f5",
      "name": "fin sql_bot2",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "file",
        "fileId": "={{ $json.message.voice.file_id }}",
        "additionalFields": {}
      },
      "type": "n8n-nodes-base.telegram",
      "typeVersion": 1.2,
      "position": [
        -2112,
        608
      ],
      "id": "7ebfcfe4-8856-466d-a30d-ccbf9de89f10",
      "name": "fin sql_bot3",
      "credentials": {
        "telegramApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "schema": {
          "__rl": true,
          "mode": "list",
          "value": "public"
        },
        "table": {
          "__rl": true,
          "value": "controle_financeiro",
          "mode": "list",
          "cachedResultName": "controle_financeiro"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "valor": "={{ $json.output.lancamentos[0].valor }}",
            "descricao": "={{ $json.output.lancamentos[0].descricao }}",
            "categoria": "={{ $json.output.lancamentos[0].categoria }}",
            "forma_de_pagamento": "={{ $json.output.lancamentos[0]['forma de pagamento'] }}",
            "Tipo": "={{ $json.output.lancamentos[0].projeto }}",
            "data": "={{ $now }}"
          },
          "matchingColumns": [
            "id"
          ],
          "schema": [
            {
              "id": "id",
              "displayName": "id",
              "required": false,
              "defaultMatch": true,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "data",
              "displayName": "data",
              "required": true,
              "defaultMatch": false,
              "display": true,
              "type": "dateTime",
              "canBeUsedToMatch": true
            },
            {
              "id": "descricao",
              "displayName": "descricao",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "valor",
              "displayName": "valor",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "number",
              "canBeUsedToMatch": true
            },
            {
              "id": "categoria",
              "displayName": "categoria",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "forma_de_pagamento",
              "displayName": "forma_de_pagamento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "created_at",
              "displayName": "created_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "time",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "source",
              "displayName": "source",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            },
            {
              "id": "Tipo",
              "displayName": "Tipo",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Projeto",
              "displayName": "Projeto",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.6,
      "position": [
        0,
        176
      ],
      "id": "47b9a2c3-48ea-4198-8b1d-22fef152c27a",
      "name": "Insert rows in a table",
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU",
          "mode": "list",
          "cachedResultName": "Controle Finaceiro",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 295815883,
          "mode": "list",
          "cachedResultName": "P\u00e1gina3",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1RjwiT3F-ubct12QHGyFu-YisARrAVQJzKCTM7VA__gU/edit#gid=295815883"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Data": "={{ $json.output.lancamentos[0].data }}",
            "Descri\u00e7\u00e3o": "={{ $json.output.lancamentos[0].descricao }}",
            "Valor": "={{ $json.output.lancamentos[0].valor }}",
            "Categoria": "={{ $json.output.lancamentos[0].categoria }}",
            "Projeto": "={{ $json.output.lancamentos[0].projeto }}",
            "Forma de pagamento": "={{ $json.output.lancamentos[0]['forma de pagamento'] }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "Data",
              "displayName": "Data",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Descri\u00e7\u00e3o",
              "displayName": "Descri\u00e7\u00e3o",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Valor",
              "displayName": "Valor",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Categoria",
              "displayName": "Categoria",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Projeto",
              "displayName": "Projeto",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Forma de pagamento",
              "displayName": "Forma de pagamento",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.6,
      "position": [
        0,
        0
      ],
      "id": "626960ce-d133-47e5-8c1b-a740514224a9",
      "name": "Append row in sheet1",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Consultar",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Consultar",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Inserir",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Consultar": {
      "main": [
        [
          {
            "node": "fin sql_bot2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Seletor de Id": {
      "main": [
        [
          {
            "node": "Text Classifier",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Text Classifier": {
      "main": [
        [
          {
            "node": "Inserir",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Consultar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "Text Classifier",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Inserir",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Inserir": {
      "main": [
        [
          {
            "node": "Text Classifier1",
            "type": "main",
            "index": 0
          },
          {
            "node": "fin sql_bot1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "Text Classifier1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Text Classifier1": {
      "main": [
        [
          {
            "node": "Append row in sheet1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Insert rows in a table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Controle Financeiro-GET": {
      "ai_tool": [
        [
          {
            "node": "Consultar",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Controle Financeiro-GET1": {
      "ai_tool": [
        [
          {
            "node": "Consultar",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Seletor de Id",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "fin sql_bot3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transcribe a recording": {
      "main": [
        [
          {
            "node": "Seletor de Id",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fin sql_bot": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "fin sql_bot3": {
      "main": [
        [
          {
            "node": "Transcribe a recording",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "f2948cb7-621a-42b6-8820-7cffe0eae48a",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "PcXmoWiPrd9Af3je",
  "tags": []
}