{
  "name": "pix-zap",
  "nodes": [
    {
      "parameters": {
        "public": true,
        "initialMessages": "Ol\u00e1! \ud83d\udc4b\nComo posso te ajudar?",
        "options": {
          "title": "Ola \ud83d\udc4b"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -1360,
        -880
      ],
      "id": "d2470e69-c95c-41f2-ab18-35b0e3179cac",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Edit Fields').item.json.Mensagem }}",
        "options": {
          "systemMessage": "Voc\u00ea \u00e9 um agente de suporte, seja educado, engra\u00e7ao e utilize emojis."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.8,
      "position": [
        -320,
        -900
      ],
      "id": "a1d1f74f-2cad-47db-9570-45ab2c632997",
      "name": "AI Agent1"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "51463003-beb3-42ae-a4ba-66a5436e0501",
              "name": "IdConversa",
              "value": "={{ $json.body.data.key.remoteJid }}",
              "type": "string"
            },
            {
              "id": "2d64eb86-4cf0-46a6-a502-0c308e521f32",
              "name": "Mensagem",
              "value": "={{ $json.body.data.message.conversation }}",
              "type": "string"
            },
            {
              "id": "0baaea15-4b18-4111-aa36-2538b4aaf899",
              "name": "Data",
              "value": "={{ $now }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -800,
        -900
      ],
      "id": "1243b655-a289-489d-83b8-92e0edd64e40",
      "name": "Edit Fields"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        20,
        -680
      ],
      "id": "870fda20-37ec-466e-a811-84d4258d3b3e",
      "name": "Calculator"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "typeVersion": 1,
      "position": [
        -140,
        -680
      ],
      "id": "f63c503f-d931-4270-8781-aa8b45fc0eba",
      "name": "Wikipedia"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        100,
        -900
      ],
      "id": "5a2c6e64-a94a-4ba1-b6d8-59fc6d2f9df9",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $('Edit Fields1').item.json.Mensagem }}",
        "options": {
          "systemMessage": "Voc\u00ea \u00e9 um agente de suporte, seja educado, engra\u00e7ao e utilize emojis."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.8,
      "position": [
        -300,
        -60
      ],
      "id": "bd402436-563d-48d9-800e-af9ee933676c",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "51463003-beb3-42ae-a4ba-66a5436e0501",
              "name": "IdConversa",
              "value": "={{ $('Webhook1').item.json.body.phone }}",
              "type": "string"
            },
            {
              "id": "2d64eb86-4cf0-46a6-a502-0c308e521f32",
              "name": "Mensagem",
              "value": "={{ $('Webhook1').item.json.body.text.message }}",
              "type": "string"
            },
            {
              "id": "4d5885bf-d1db-49af-86fb-22b8a5fe81c7",
              "name": "Nome",
              "value": "={{ $('Webhook1').item.json.body.chatName }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -740,
        -60
      ],
      "id": "a78b07f5-cd54-48a9-96dd-da91e17253f2",
      "name": "Edit Fields1"
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $('Edit Fields1').item.json.IdConversa }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -260,
        180
      ],
      "id": "7afb5322-004e-49ff-8c25-327382e9ddde",
      "name": "Simple Memory1"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        40,
        180
      ],
      "id": "a72bef90-faee-4876-bed1-2aed54afc438",
      "name": "Calculator1"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolWikipedia",
      "typeVersion": 1,
      "position": [
        -120,
        180
      ],
      "id": "aae8b9c0-1040-41bf-8c32-80404509a08f",
      "name": "Wikipedia1"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        320,
        -60
      ],
      "id": "6cc0e499-fce0-4bf1-b3af-c84d00dc508a",
      "name": "No Operation, do nothing1"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "3e159d22-1e35-4ac6-b7c4-23dcd61b2c65",
              "leftValue": "={{ $json.body.isGroup }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            },
            {
              "id": "b3e67eed-ee63-4f85-9e8c-31cb3c84dea5",
              "leftValue": "={{ $json.body.isNewsletter }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            },
            {
              "id": "6ee1e0b8-3aa2-4964-aecd-5c41f7417f56",
              "leftValue": "={{ $json.body.fromApi }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            },
            {
              "id": "2288f863-9d64-4a5b-8414-6dc359375d0e",
              "leftValue": "={{ $json.body.broadcast }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "false",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        -960,
        -60
      ],
      "id": "712e4109-a3d6-44ce-b7e8-f2f1f58ee096",
      "name": "If"
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        -740,
        180
      ],
      "id": "5b295ab5-fb79-4254-862d-7e14736d7692",
      "name": "No Operation, do nothing2"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.z-api.io/instances/SUA_INSTANCIA/token/SEU_TOKEN/send-text",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "client-token",
              "value": "{{security-token}}"
            }
          ]
        },
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "phone",
              "value": "5511999998888"
            },
            {
              "name": "message",
              "value": "Welcome to *Z-API*"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        80,
        -60
      ],
      "id": "e74be8bd-18eb-4536-875c-f899066b12d1",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "receber-mensagem-whatsapp",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        -1240,
        -320
      ],
      "id": "8fbda4a6-b713-4e3a-a028-caa1e9ce75a8",
      "name": "Webhook1"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1fhsa6tUsbsIcK6Ub0wHkXTdGFmluMYrQaSAgyvG-BrE",
          "mode": "list",
          "cachedResultName": "CursoN8NGratuito-Tutorial#1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fhsa6tUsbsIcK6Ub0wHkXTdGFmluMYrQaSAgyvG-BrE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Case 1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1ZIyZrOkvoxyptGpg0f4Km1FOPQNkEtliXr651pFQyuA/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "Mensagem": "={{ $json.Mensagem }}",
            "Data": "={{ $json.Data }}",
            "idConversa": "={{ $json.IdConversa }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "idConversa",
              "displayName": "idConversa",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "Mensagem",
              "displayName": "Mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Data",
              "displayName": "Data",
              "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": [
        -560,
        -900
      ],
      "id": "a9a89fb1-5cb2-462f-9639-33c4cdeb2bf8",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "1fhsa6tUsbsIcK6Ub0wHkXTdGFmluMYrQaSAgyvG-BrE",
          "mode": "list",
          "cachedResultName": "CursoN8NGratuito-Tutorial#1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fhsa6tUsbsIcK6Ub0wHkXTdGFmluMYrQaSAgyvG-BrE/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": "gid=0",
          "mode": "list",
          "cachedResultName": "Case1",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1fhsa6tUsbsIcK6Ub0wHkXTdGFmluMYrQaSAgyvG-BrE/edit#gid=0"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "idConversa": "={{ $json.IdConversa }}",
            "Mensagem": "={{ $json.Mensagem }}",
            "Data": "={{ $json.Nome }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "idConversa",
              "displayName": "idConversa",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Mensagem",
              "displayName": "Mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "Data",
              "displayName": "Data",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.5,
      "position": [
        -540,
        -60
      ],
      "id": "2b8d0be4-c3a7-42c8-8854-49ef814d2deb",
      "name": "Append or update row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "resource": "messages-api",
        "instanceName": "n8n",
        "remoteJid": "595993547294",
        "messageText": "={{ $json.output }}",
        "options_message": {}
      },
      "type": "n8n-nodes-evolution-api.evolutionApi",
      "typeVersion": 1,
      "position": [
        400,
        -900
      ],
      "id": "dcd05c82-4f64-467a-9027-24d6260e1c46",
      "name": "Enviar texto",
      "credentials": {
        "evolutionApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -400,
        180
      ],
      "id": "9898ed8b-9de8-4480-bb8c-44850b7e03f0",
      "name": "Google Gemini Chat Model",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "typeVersion": 1,
      "position": [
        -420,
        -680
      ],
      "id": "56f4397a-9ebc-48da-a2d1-01630869a795",
      "name": "Groq Chat Model",
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        []
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory1": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Calculator1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wikipedia1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "No Operation, do nothing1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Webhook1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "No Operation, do nothing": {
      "main": [
        [
          {
            "node": "Enviar texto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enviar texto": {
      "main": [
        []
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c59c8459-e2e6-4a37-a451-be05b53ea6e1",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "537IKsBWq5ajy4Bu",
  "tags": [
    {
      "createdAt": "2025-06-30T01:10:28.185Z",
      "updatedAt": "2025-06-30T01:10:28.185Z",
      "id": "MnjNIW7kUF7UYkxw",
      "name": "NoCode StartUp"
    }
  ]
}