{
  "name": "UniTV WhatsApp AI + Redis + Pix",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "unitvia",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "unitv-webhook-v2",
      "name": "Webhook WhatsApp",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -900,
        0
      ],
      "webhookId": "unitvia"
    },
    {
      "parameters": {
    "jsCode": "const root=$json.body??$json;\n\nfunction valueByKeys(obj,keys,depth=0){\n  if(!obj||typeof obj!==\"object\"||depth>7)return \"\";\n  const wanted=new Set(keys.map(k=>String(k).toLowerCase()));\n  for(const [key,value] of Object.entries(obj)){\n    if(wanted.has(String(key).toLowerCase())&&(typeof value===\"string\"||typeof value===\"number\")){\n      const result=String(value).trim();\n      if(result)return result;\n    }\n  }\n  for(const value of Object.values(obj)){\n    if(value&&typeof value===\"object\"){\n      const result=valueByKeys(value,keys,depth+1);\n      if(result)return result;\n    }\n  }\n  return \"\";\n}\n\nfunction boolByKeys(obj,keys,depth=0){\n  if(!obj||typeof obj!==\"object\"||depth>7)return null;\n  const wanted=new Set(keys.map(k=>String(k).toLowerCase()));\n  for(const [key,value] of Object.entries(obj)){\n    if(wanted.has(String(key).toLowerCase())&&typeof value===\"boolean\")return value;\n  }\n  for(const value of Object.values(obj)){\n    if(value&&typeof value===\"object\"){\n      const result=boolByKeys(value,keys,depth+1);\n      if(result!==null)return result;\n    }\n  }\n  return null;\n}\n\nconst fromMe=boolByKeys(root,[\"fromMe\",\"isFromMe\",\"wasSentByApi\"]);\nconst isGroup=boolByKeys(root,[\"isGroup\",\"wa_isGroup\"]);\nif(fromMe===true||isGroup===true)return [];\n\nconst text=valueByKeys(root,[\"text\",\"content\",\"conversation\",\"messageText\"]);\nconst rawPhone=valueByKeys(root,[\"chatid\",\"chat\",\"remoteJid\",\"sender_pn\",\"phone\",\"sender\"]);\nconst messageId=valueByKeys(root,[\"messageid\",\"message_id\",\"id\",\"track_id\"]);\nconst phone=String(rawPhone).split(\"@\")[0].replace(/\\D/g,\"\");\nif(!text)return [];\nreturn [{json:{text,phone,messageId,sessionKey:(phone||\"unknown\")+\"_unitv\",receivedAt:new Date().toISOString()}}];"
      },
      "id": "unitv-normalize-v2",
      "name": "Normalizar entrada",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -680,
        0
      ]
    },
  {
    "parameters": {
        "jsCode": "const phone = String($json.phone ?? '').trim();\nconst text = String($json.text ?? '').trim();\nreturn [{ json: { input: `[Telefone do WhatsApp: ${phone}]\\n${text}` } }];"
    },
    "id": "unitv-agent-input-v2",
    "name": "Preparar entrada do agente",
    "type": "n8n-nodes-base.code",
    "typeVersion": 2,
    "position": [
      -40,
      0
    ]
  },
  {
    "parameters": {
      "promptType": "define",
      "text": "={{ $json.input }}",
        "options": {
      "systemMessage": "Você é um assistente de operações UniTV via WhatsApp.\n\nIntenções: consultar conta, renovar conta, comprar/criar conta, gerar Pix e consultar pagamento.\n\nConsulta:\n1. Use unitv_conexoes se precisar identificar o painel.\n2. Use unitv_consultar_conta.\n3. Informe usuário, nome, vencimento e status.\n4. Só use unitv_consultar_senha quando o usuário pedir explicitamente.\n\nRenovação e compra:\n1. Colete SN ou nome, período e, para compra, nome e WhatsApp.\n2. O período é OBRIGATÓRIO e deve ser informado explicitamente pelo usuário. Aceite somente: 1m (1 mês), 3m (3 meses), 6m (6 meses) ou 1y (1 ano).\n3. Se o usuário não informar o período, ou disser apenas renovar/comprar, NÃO chame simulação, Pix ou qualquer outra ferramenta de cobrança. Pergunte exatamente: Qual período deseja? 1 mês, 3 meses, 6 meses ou 1 ano?\n4. Nunca escolha 1y, 1m ou outro período por conta própria, pelo saldo, pelo preço ou pelo histórico do Redis.\n5. Somente depois de receber uma resposta explícita de período, converta 1 mês para 1m, 3 meses para 3m, 6 meses para 6m e 1 ano para 1y e faça a simulação correspondente.\n6. Informe conta, período, custo e saldo.\n7. Aguarde a resposta exata CONFIRMO.\n8. Depois de CONFIRMO, gere Pix com gerar_pix_renovacao ou gerar_pix_criacao.\n9. Não execute renovar ou criar_conta diretamente antes do pagamento. O processador do Renovar executa somente após confirmação do Mercado Pago.\n10. Envie public_id, Pix copia e cola e link de pagamento.\n11. Quando o usuário disser que pagou, use unitv_status_pagamento. Nunca confie apenas na mensagem.\n12. Só entregue usuário e senha quando state=completed e account.password existir.\n13. Em RETRY, consulte novamente; nunca gere outra cobrança ou conta automaticamente.\n14. Use uma idempotency_key única quando uma ferramenta exigir.\n\nSegurança:\n- Nunca revele tokens, headers internos ou credenciais.\n- Nunca crie ou renove por iniciativa própria.\n- Não repita uma operação com a mesma idempotency_key.\n- Use texto simples para WhatsApp.\n- Use *texto* para negrito.\n- Nunca use **texto**, títulos Markdown, crases, tabelas ou listas complexas."
        }
      },
      "id": "unitv-agent-v2",
      "name": "AI Agent UniTV",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        520,
        0
      ]
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "id": "unitv-openai-v2",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        400,
        300
      ],
      "credentials": {
        "openAiApi": {
          "id": "rIStM7VnFyWSJ17v",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
      "sessionKey": "={{ $('Normalizar entrada').first().json.sessionKey }}",
        "sessionTTL": 31536000
      },
      "id": "unitv-redis-v2",
      "name": "Redis Chat Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryRedisChat",
      "typeVersion": 1.5,
      "position": [
        560,
        300
      ],
      "credentials": {
        "redis": {
          "id": "Q8H0hLGtzonWSDBh",
          "name": "Redis account"
        }
      }
    },
    {
      "parameters": {
    "jsCode": "const texto=String($json.output??'').trim(); const whatsapp=texto.replace(/\\*\\*(.*?)\\*\\*/gs,'*$1*').replace(/^#{1,6}\\s*/gm,'').replace(/!\\[[^\\]]*\\]\\(data:image\\/[^)]*\\)/gi,'').replace(/^\\s*[-•]\\s*\\*?QR Code\\*?\\s*:\\s*(?:\\n|$)/gim,'').replace(/^\\s*[-•]\\s*\\*?saldo(?: disponível)?\\*?\\s*:[^\\n]*(?:\\n|$)/gim,'').replace(/\\n{3,}/g,'\\n\\n').trim(); function tlv(value){const out={}; let pos=0; while(pos+4<=value.length){const id=value.slice(pos,pos+2); const len=Number(value.slice(pos+2,pos+4)); if(!Number.isFinite(len)||len<0||pos+4+len>value.length)break; out[id]=value.slice(pos+4,pos+4+len); pos+=4+len;} return out;} function pixMeta(code){const root=tlv(code); const merchant=tlv(root['26']||root['27']||''); const key=String(merchant['01']||'').trim(); if(!key)return null; let pixType='EVP'; if(/^[^@\\s]+@[^@\\s]+$/.test(key))pixType='EMAIL'; else if(/^\\d{11}$/.test(key))pixType='CPF'; else if(/^\\d{14}$/.test(key))pixType='CNPJ'; else if(/^\\+?\\d{10,15}$/.test(key))pixType='PHONE'; return {pixKey:key,pixType,pixName:String(root['59']||'Pix').trim()||'Pix'};} const pixMatch=whatsapp.match(/(?:`)?(000201[^\\s`]+)(?:`)?/i); if(!pixMatch)return[{json:{...$json,send_mode:'text',whatsapp_text:whatsapp}}]; const codigo=pixMatch[1]; const meta=pixMeta(codigo); const antes=whatsapp.slice(0,pixMatch.index).replace(/(?:[-•]\\s*)?\\*?(?:c[oó]digo|pix)\\s*(?:pix|copia e cola)?\\*?\\s*:?\\s*$/i,'').trim(); const depois=whatsapp.slice((pixMatch.index??0)+pixMatch[0].length).replace(/^\\s*[-:)]*\\s*/,'').trim(); const itens=[]; if(antes)itens.push({json:{...$json,send_mode:'text',whatsapp_text:antes}}); if(meta){itens.push({json:{...$json,send_mode:'pix',pixKey:meta.pixKey,pixType:meta.pixType,pixName:meta.pixName,pixCode:codigo,whatsapp_text:''}}); itens.push({json:{...$json,send_mode:'text',whatsapp_text:codigo,pix_code_only:true}});} else itens.push({json:{...$json,send_mode:'text',whatsapp_text:'*Pix copia e cola:*\\n'+codigo}}); if(depois)itens.push({json:{...$json,send_mode:'text',whatsapp_text:depois}}); return itens;"
      },
      "id": "unitv-normalize-output-v2",
      "name": "Normalizar resposta WhatsApp",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        820,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://tectonny.uazapi.com/send/text",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ number: $('Normalizar entrada').first().json.phone, delay: 1200, text: $json.whatsapp_text }) }}",
        "options": {}
      },
      "id": "unitv-send-v2",
      "name": "Uazapi - Enviar resposta",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        1060,
        0
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_UAZAPI_HEADER_CREDENTIAL",
          "name": "Uazapi Header"
        }
      }
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {"caseSensitive": false, "leftValue": "", "typeValidation": "strict"},
                "conditions": [{"leftValue": "={{$json.send_mode}}", "rightValue": "pix", "operator": {"type": "string", "operation": "equals"}}],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "pix"
            },
            {
              "conditions": {
                "options": {"caseSensitive": false, "leftValue": "", "typeValidation": "strict"},
                "conditions": [{"leftValue": "={{$json.send_mode}}", "rightValue": "text", "operator": {"type": "string", "operation": "equals"}}],
                "combinator": "and"
              },
              "renameOutput": true,
              "outputKey": "text"
            }
          ]
        },
        "options": {"fallbackOutput": "extra"}
      },
      "id": "unitv-send-switch-v2",
      "name": "Switch tipo de envio",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        1040,
        0
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://tectonny.uazapi.com/send/request-payment",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ (() => { const source = String($json.output ?? $json.whatsapp_text ?? ''); const pixCode = String($json.pixCode ?? source.match(/000201[^\\s`]+/i)?.[0] ?? ''); const amountMatch = source.match(/(?:valor|total)[^R$]{0,40}R\\$\\s*([\\d.]+(?:,[\\d]{1,2})?)/i); const amount = amountMatch ? Number(amountMatch[1].replace(/\\./g, '').replace(',', '.')) : 0; const pixKey = String($json.pixKey ?? ''); if (!pixCode || !amount) throw new Error('Código Pix ou valor da cobrança não encontrado'); return JSON.stringify({ number: $('Normalizar entrada').first().json.phone, amount, text: $json.whatsapp_text || 'Pagamento da renovação UniTV', pixKey: pixKey || pixCode, pixCode, pixType: pixKey ? ($json.pixType || 'EMAIL') : 'EVP', pixName: $json.pixName || 'POSTOAUTORIZADORJ', delay: 1200, readchat: true }); })() }}",
        "options": {}
      },
      "id": "unitv-send-pix-button-v2",
      "name": "Uazapi - Solicitar pagamento",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        1280,
        -120
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_UAZAPI_HEADER_CREDENTIAL",
          "name": "Uazapi Header"
        }
      }
    },
    {
      "parameters": {
        "toolDescription": "Lista as conexões UniTV disponíveis.",
        "url": "https://automation.tectonny.com.br/api.php",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "action",
              "value": "conexoes"
            }
          ]
        }
      },
      "id": "tool-unitv_conexoes",
      "name": "unitv_conexoes",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        260,
        450
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "ZGF0cyVDgyMF2hxE",
          "name": "Automation Bearer"
        }
      }
    },
    {
      "parameters": {
        "toolDescription": "Consulta uma conta UniTV pelo SN sem senha.",
        "url": "https://automation.tectonny.com.br/api.php",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "action",
              "value": "contas"
            },
            {
              "name": "q",
              "value": "={{$fromAI('sn','Código SN da conta UniTV','string')}}"
            },
            {
              "name": "page",
              "value": "1"
            },
            {
              "name": "page_size",
              "value": "100"
            },
            {
              "name": "incluir_senha",
              "value": "0"
            }
          ]
        }
      },
      "id": "tool-unitv_consultar_conta",
      "name": "unitv_consultar_conta",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        380,
        540
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "ZGF0cyVDgyMF2hxE",
          "name": "Automation Bearer"
        }
      }
    },
    {
      "parameters": {
        "toolDescription": "Consulta a senha atual somente quando solicitado.",
        "url": "https://automation.tectonny.com.br/api.php",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "action",
              "value": "contas"
            },
            {
              "name": "q",
              "value": "={{$fromAI('sn','Código SN da conta UniTV','string')}}"
            },
            {
              "name": "page",
              "value": "1"
            },
            {
              "name": "page_size",
              "value": "100"
            },
            {
              "name": "incluir_senha",
              "value": "1"
            }
          ]
        }
      },
      "id": "tool-unitv_consultar_senha",
      "name": "unitv_consultar_senha",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        500,
        630
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "ZGF0cyVDgyMF2hxE",
          "name": "Automation Bearer"
        }
      }
    },
    {
  "parameters": {
    "toolDescription": "Simula renovação e retorna custo, saldo e elegibilidade. Só chame depois que o usuário informar explicitamente sn e um período válido: 1m, 3m, 6m ou 1y. Nunca escolha o período.",
    "method": "POST",
    "url": "https://automation.tectonny.com.br/api.php",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "action",
              "value": "simular"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ (() => { const sn = $fromAI('sn', 'Código SN da conta', 'string'); const periodo = $fromAI('periodo', 'Período explicitamente confirmado: use 1m, 3m, 6m ou 1y; nunca presumir', 'string'); const conexao = Number($fromAI('conexao_id', 'ID da conexão; se não souber, use a conexão padrão', 'number')); return JSON.stringify({ sn, periodo, ...(conexao > 0 ? { conexao_id: conexao } : {}), operacao_direta: true, incluir_senha: false }); })() }}"
      },
      "id": "tool-unitv_simular_renovacao",
      "name": "unitv_simular_renovacao",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        620,
        720
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "ZGF0cyVDgyMF2hxE",
          "name": "Automation Bearer"
        }
      }
    },
    {
  "parameters": {
    "toolDescription": "Simula criação sem consumir pontos. Só chame depois que o usuário informar explicitamente nome, WhatsApp e um período válido: 1m, 3m, 6m ou 1y. Nunca escolha o período.",
    "method": "POST",
    "url": "https://automation.tectonny.com.br/api.php",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "action",
              "value": "simular_criacao"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ (() => { const cliente_nome = $fromAI('cliente_nome', 'Nome do cliente', 'string'); const telefone = $fromAI('telefone', 'WhatsApp do cliente', 'string'); const referencia_externa = $fromAI('referencia_externa', 'Referência única', 'string'); const periodo = $fromAI('periodo', 'Período explicitamente confirmado: use 1m, 3m, 6m ou 1y; nunca presumir', 'string'); const conexao = Number($fromAI('conexao_id', 'ID da conexão; se não souber, use a conexão padrão', 'number')); return JSON.stringify({ cliente_nome, telefone, referencia_externa, periodo, ...(conexao > 0 ? { conexao_id: conexao } : {}) }); })() }}"
      },
      "id": "tool-unitv_simular_criacao",
      "name": "unitv_simular_criacao",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        740,
        810
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "ZGF0cyVDgyMF2hxE",
          "name": "Automation Bearer"
        }
      }
    },
    {
  "parameters": {
    "toolDescription": "Gera cobrança Pix para renovação; só chame depois da confirmação do usuário e com período explicitamente informado (1m, 3m, 6m ou 1y). Nunca use um período presumido.",
    "method": "POST",
    "url": "https://renovar.tectonny.com.br/internal_pix.php",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
    "jsonBody": "={{ JSON.stringify({ mode: 'renew', sn: $fromAI('sn', 'Código da conta UniTV', 'string'), period: $fromAI('periodo', 'Período explicitamente confirmado: use 1m, 3m, 6m ou 1y; nunca presumir', 'string') }) }}"
      },
      "id": "tool-gerar_pix_renovacao",
      "name": "gerar_pix_renovacao",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        860,
        450
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_RENOVAR_INTERNAL_CREDENTIAL",
          "name": "Renovar Internal Header"
        }
      }
    },
    {
  "parameters": {
    "toolDescription": "Gera cobrança Pix para conta nova; só chame depois da confirmação do usuário e com período explicitamente informado (1m, 3m, 6m ou 1y). Nunca use um período presumido.",
    "method": "POST",
    "url": "https://renovar.tectonny.com.br/internal_pix.php",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
    "jsonBody": "={{ JSON.stringify({ mode: 'new', customer_name: $fromAI('cliente_nome', 'Nome do cliente', 'string'), phone: $fromAI('telefone', 'WhatsApp do cliente', 'string'), period: $fromAI('periodo', 'Período explicitamente confirmado: use 1m, 3m, 6m ou 1y; nunca presumir', 'string') }) }}"
      },
      "id": "tool-gerar_pix_criacao",
      "name": "gerar_pix_criacao",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        980,
        540
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_RENOVAR_INTERNAL_CREDENTIAL",
          "name": "Renovar Internal Header"
        }
      }
    },
    {
  "parameters": {
    "toolDescription": "Consulta pedido Pix pelo public_id.",
    "method": "GET",
        "url": "https://renovar.tectonny.com.br/internal_status.php",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "pedido",
              "value": "={{$fromAI('pedido','Código public_id do pedido Pix','string')}}"
            }
          ]
        }
      },
      "id": "tool-unitv_status_pagamento",
      "name": "unitv_status_pagamento",
      "type": "n8n-nodes-base.httpRequestTool",
      "typeVersion": 4.4,
      "position": [
        1100,
        630
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "REPLACE_RENOVAR_INTERNAL_CREDENTIAL",
          "name": "Renovar Internal Header"
        }
      }
    }
  ],
  "connections": {
    "Webhook WhatsApp": {
      "main": [
        [
          {
            "node": "Normalizar entrada",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
  "Normalizar entrada": {
    "main": [
      [
        {
          "node": "Preparar entrada do agente",
          "type": "main",
          "index": 0
        }
      ]
    ]
  },
  "Preparar entrada do agente": {
    "main": [
      [
        {
          "node": "AI Agent UniTV",
          "type": "main",
          "index": 0
        }
      ]
    ]
  },
    "AI Agent UniTV": {
      "main": [
        [
          {
            "node": "Normalizar resposta WhatsApp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalizar resposta WhatsApp": {
      "main": [
        [
          {
            "node": "Switch tipo de envio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch tipo de envio": {
      "main": [
        [
          {
            "node": "Uazapi - Solicitar pagamento",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Uazapi - Enviar resposta",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Redis Chat Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "unitv_conexoes": {
      "ai_tool": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "unitv_consultar_conta": {
      "ai_tool": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "unitv_consultar_senha": {
      "ai_tool": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "unitv_simular_renovacao": {
      "ai_tool": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "unitv_simular_criacao": {
      "ai_tool": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "gerar_pix_renovacao": {
      "ai_tool": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "gerar_pix_criacao": {
      "ai_tool": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "unitv_status_pagamento": {
      "ai_tool": [
        [
          {
            "node": "AI Agent UniTV",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "unitv-whatsapp-ai-redis-pix-v2",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
