Respuesta automática de Gmail AI

Intermedio

Este es unMultimodal AIflujo de automatización del dominio deautomatización que contiene 11 nodos.Utiliza principalmente nodos como If, Set, Gmail, GmailTrigger, Agent. Generador de respuestas automáticas para Gmail, utilizando GPT-4o-mini

Requisitos previos
  • Cuenta de Google y credenciales de API de Gmail
  • Clave de API de OpenAI

Categoría

Vista previa del flujo de trabajo
Visualización de las conexiones entre nodos, con soporte para zoom y panorámica
Exportar flujo de trabajo
Copie la siguiente configuración JSON en n8n para importar y usar este flujo de trabajo
{
  "name": "Gmail Auto-Reply with AI",
  "tags": [],
  "nodes": [
    {
      "id": "50972917-6da6-4b55-b18b-0bd96445e9f8",
      "name": "Activar con Nuevo Correo",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        -352
      ],
      "parameters": {
        "filters": {
          "readStatus": "unread"
        },
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "f42bb871-a182-4708-aa12-65f6c9c5ee28",
      "name": "Obtener Correo No Leído",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        -352
      ],
      "parameters": {
        "simple": false,
        "options": {},
        "messageId": "={{ $json.id }}",
        "operation": "get"
      },
      "typeVersion": 2.1
    },
    {
      "id": "c0ce4d37-a5ce-4926-9edf-5aa68d80426a",
      "name": "Obtener Campos Requeridos",
      "type": "n8n-nodes-base.set",
      "position": [
        448,
        -352
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "name": "threadId",
              "type": "string",
              "value": "={{ $json.threadId }}"
            },
            {
              "name": "id",
              "type": "string",
              "value": "={{ $json.id }}"
            },
            {
              "name": "From",
              "type": "string",
              "value": "={{ $json.headers.from }}"
            },
            {
              "name": "message",
              "type": "string",
              "value": "={{ $json.text }}"
            },
            {
              "name": "subject",
              "type": "string",
              "value": "={{ $json.subject }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
      "name": "Agente de IA",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        672,
        -352
      ],
      "parameters": {
        "text": "=You are an assistant that helps draft email replies.\n\nYour task:\n1. Read the email message below:\n\"{{ $json.message }}\"\n\n2. Decide if this is an email that requires a reply.  \n   - If it's spam, a notification, or irrelevant, set `isReply` to false.  \n   - If it's a genuine message that can be replied to, set `isReply` to true.  \n\n3. If `isReply` is true, draft a short and polite reply that:  \n   - Acknowledges the sender.  \n   - Is under 120 words.  \n   - Does not promise action you cannot take.  \n\n4. Return the result **only in valid JSON**, no extra text.\n\nJSON format to return:\n{\n  \"isReply\": true | false,\n  \"response\": \"string or empty if isReply is false\"\n}",
        "options": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "5673e94b-82b0-407f-9db4-60b35dfb8253",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        680,
        -128
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "typeVersion": 1.2
    },
    {
      "id": "00fe0a38-cc10-492e-86d6-af0494c8afc9",
      "name": "Salida Estructurada",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        808,
        -128
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"isReply\": {\n      \"type\": \"boolean\",\n      \"description\": \"Whether the email requires a reply\"\n    },\n    \"response\": {\n      \"type\": \"string\",\n      \"description\": \"The drafted reply text if isReply is true, otherwise empty\"\n    }\n  },\n  \"required\": [\"isReply\", \"response\"]\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "7fd55349-a8a3-4c1b-8dc8-221a50915a5e",
      "name": "¿Puede Responder el Agente de IA?",
      "type": "n8n-nodes-base.if",
      "position": [
        1024,
        -352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.output.isReply }}",
              "rightValue": "true"
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.2
    },
    {
      "id": "ba0480ca-4f1d-4813-b6d8-674ec1f2bafe",
      "name": "Crear un borrador",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1248,
        -352
      ],
      "parameters": {
        "message": "={{ $json.output.response }}",
        "options": {
          "threadId": "={{ $('Get Required Fields').item.json.threadId }}"
        },
        "subject": "={{ $('Get Required Fields').item.json.subject }}",
        "resource": "draft"
      },
      "typeVersion": 2.1
    },
    {
      "id": "be177f90-54e7-472f-8b30-3dd6c8c1f4a3",
      "name": "Etiquetar Correo como \"Acción\"",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1472,
        -352
      ],
      "parameters": {
        "labelIds": [
          "Label_4601850039988562325"
        ],
        "resource": "thread",
        "threadId": "={{ $('Get Required Fields').item.json.threadId }}",
        "operation": "addLabels"
      },
      "typeVersion": 2.1
    },
    {
      "id": "434ebfe4-410a-4f49-9285-cfd6256abb6f",
      "name": "Nota Adhesiva",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -192,
        0
      ],
      "parameters": {
        "width": 336,
        "content": "## 🛠️ Setup Instructions\n  - Connect Gmail and OpenAI credentials before activating.\n  - Make sure your Gmail has a label called `Action`."
      },
      "typeVersion": 1
    },
    {
      "id": "77831399-3e74-454e-8e27-b9d6e2af638c",
      "name": "Nota Adhesiva1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        608,
        -576
      ],
      "parameters": {
        "color": 5,
        "width": 368,
        "height": 656,
        "content": "## ⚠️ Reply Logic\n  - AI won't reply to spam, notifications, or irrelevant messages.\n  - Only genuine messages get responses. You can review drafts before sending.\n  - Tweak the AI agent's prompt to match your brand voice."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "5673e94b-82b0-407f-9db4-60b35dfb8253": {
      "ai_languageModel": [
        [
          {
            "node": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112": {
      "main": [
        [
          {
            "node": "7fd55349-a8a3-4c1b-8dc8-221a50915a5e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "ba0480ca-4f1d-4813-b6d8-674ec1f2bafe": {
      "main": [
        [
          {
            "node": "be177f90-54e7-472f-8b30-3dd6c8c1f4a3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f42bb871-a182-4708-aa12-65f6c9c5ee28": {
      "main": [
        [
          {
            "node": "c0ce4d37-a5ce-4926-9edf-5aa68d80426a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "00fe0a38-cc10-492e-86d6-af0494c8afc9": {
      "ai_outputParser": [
        [
          {
            "node": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "c0ce4d37-a5ce-4926-9edf-5aa68d80426a": {
      "main": [
        [
          {
            "node": "64d9c2c7-0ef8-49f2-9c6c-5b0aabd27112",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "50972917-6da6-4b55-b18b-0bd96445e9f8": {
      "main": [
        [
          {
            "node": "f42bb871-a182-4708-aa12-65f6c9c5ee28",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7fd55349-a8a3-4c1b-8dc8-221a50915a5e": {
      "main": [
        [
          {
            "node": "ba0480ca-4f1d-4813-b6d8-674ec1f2bafe",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Preguntas frecuentes

¿Cómo usar este flujo de trabajo?

Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.

¿En qué escenarios es adecuado este flujo de trabajo?

Intermedio - IA Multimodal

¿Es de pago?

Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.

Información del flujo de trabajo
Nivel de dificultad
Intermedio
Número de nodos11
Categoría1
Tipos de nodos8
Descripción de la dificultad

Adecuado para usuarios con experiencia intermedia, flujos de trabajo de complejidad media con 6-15 nodos

Autor
Matt Chong | n8n Creator

Matt Chong | n8n Creator

@mattxchong

Automation nerd fueled by good coffee, deep curiosity, and clean flows.

Enlaces externos
Ver en n8n.io

Compartir este flujo de trabajo

Categorías

Categorías: 34