AutomationFlowsAI & RAG › AI Gmail Auto-Reply with Google Sheets

AI Gmail Auto-Reply with Google Sheets

Original n8n title: Hashtag

hashtag. Uses gmailTrigger, googleSheets, gmail, agent. Event-driven trigger; 8 nodes.

Event trigger★★★★☆ complexityAI-powered8 nodesGmail TriggerGoogle SheetsGmailAgentGroq ChatMemory Buffer Window
AI & RAG Trigger: Event Nodes: 8 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Agent → Gmail recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "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": []
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

hashtag. Uses gmailTrigger, googleSheets, gmail, agent. Event-driven trigger; 8 nodes.

Source: https://github.com/ABCS89/AI_AGENTS/blob/1e114010d5f6926b0d399700cb68ad61a440b8ee/n8n/workflows/hashtag.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

ITfest. Uses telegramTrigger, telegram, textClassifier, agent. Event-driven trigger; 70 nodes.

Telegram Trigger, Telegram, Text Classifier +6
AI & RAG

Streamline your HR recruitment process with this intelligent automation that reads candidate emails and resumes, analyzes them using GPT-4, and automatically shortlists or rejects applicants based on

Gmail, Gmail Trigger, HTTP Request +7
AI & RAG

This workflow is perfect for: Small to medium businesses looking to automate customer support E-commerce stores handling order inquiries and customer questions SaaS companies providing technical suppo

Telegram Trigger, Agent, OpenAI Chat +8
AI & RAG

This workflow automatically organizes your Gmail inbox using AI. It reads every incoming email, classifies it into Work, Personal, Financial or Newsletter, applies the correct Gmail label, logs the em

Gmail, Groq Chat, Agent +3
AI & RAG

This workflow monitors incoming Gmail messages for refund requests and uses AI to extract the order ID and reason. It then retrieves order details from Shopify to evaluate refund eligibility. Based on

Gmail Trigger, Groq Chat, Gmail +3