{
  "name": "hashtag",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false,
        "filters": {},
        "options": {}
      },
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.3,
      "position": [
        0,
        0
      ],
      "id": "867d9eee-e451-4b26-84fd-78afc13f04ee",
      "name": "Gmail Trigger",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "2f02f67a-816e-4d12-bcb7-767b1f8837e9",
              "name": "email",
              "value": "={{ $json.from.value[0].address }}",
              "type": "string"
            },
            {
              "id": "84796d6a-46dd-4629-ad81-43ce7fde7e78",
              "name": "assunto",
              "value": "={{ $json.headers.subject }}",
              "type": "string"
            },
            {
              "id": "7750dfd6-264e-4003-8a24-761ebf4a5507",
              "name": "mensagem",
              "value": "={{ $json.text }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        0
      ],
      "id": "0019fdbc-ddf0-4bc3-95ad-832956173202",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "9966ca02-8f53-4335-bc30-80473db8bcc4",
              "leftValue": "={{ $json.mensagem }}",
              "rightValue": "coparticipa\u00e7\u00e3o",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        448,
        0
      ],
      "id": "75eabde6-feb9-45b2-9b54-ac7b35997505",
      "name": "If"
    },
    {
      "parameters": {
        "operation": "append",
        "documentId": {
          "__rl": true,
          "value": "1emBcwKoIDiT9nTEfEPfcOBSZJrzLlyw0Pcm30W6Kf6U",
          "mode": "list",
          "cachedResultName": "TESTE",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1emBcwKoIDiT9nTEfEPfcOBSZJrzLlyw0Pcm30W6Kf6U/edit?usp=drivesdk"
        },
        "sheetName": {
          "__rl": true,
          "value": 555978433,
          "mode": "list",
          "cachedResultName": "email",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1emBcwKoIDiT9nTEfEPfcOBSZJrzLlyw0Pcm30W6Kf6U/edit#gid=555978433"
        },
        "columns": {
          "mappingMode": "defineBelow",
          "value": {
            "from": "={{ $('Edit Fields').item.json.email }}",
            "assunto": "={{ $('Edit Fields').item.json.assunto }}",
            "mensagem": "={{ $('Edit Fields').item.json.mensagem }}"
          },
          "matchingColumns": [],
          "schema": [
            {
              "id": "from",
              "displayName": "from",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "assunto",
              "displayName": "assunto",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            },
            {
              "id": "mensagem",
              "displayName": "mensagem",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {}
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        672,
        0
      ],
      "id": "081306be-0a93-436c-af4c-55dff0172d18",
      "name": "Append row in sheet",
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "reply",
        "messageId": "={{ $('Gmail Trigger').item.json.id }}",
        "message": "={{ $json.output }}",
        "options": {}
      },
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.2,
      "position": [
        1248,
        0
      ],
      "id": "c5b41727-a331-413d-9ecd-21aee7153ca8",
      "name": "Reply to a message",
      "credentials": {
        "gmailOAuth2": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.mensagem }}",
        "options": {
          "systemMessage": "voc\u00ea est\u00e1 em um ambiente de n8n, ent\u00e3o responda a pergunta do email com entusiasmo sem sair do contexto da pergunta"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        896,
        0
      ],
      "id": "36bb235b-33e3-4c22-bb6a-15bd87b828de",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": "llama-3.3-70b-versatile",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "typeVersion": 1,
      "position": [
        896,
        224
      ],
      "id": "96a45a4f-f941-42d8-bfa4-f5745031e616",
      "name": "Groq Chat Model",
      "credentials": {
        "groqApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "sessionIdType": "customKey",
        "sessionKey": "={{ $json.mensagem }}"
      },
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        1008,
        304
      ],
      "id": "3179a423-da26-48a0-a1d7-1474f7ee11b4",
      "name": "Simple Memory"
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Append row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append row in sheet": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Reply to a message",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "versionId": "b0bf9c4f-451b-432a-b116-a80ee76c7b7d",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "VBORctk0yrwXtoJixgm_l",
  "tags": []
}