AutomationFlowsAI & RAG › Генератор Відповідей — Торти

Генератор Відповідей — Торти

Original n8n title: 🎂 Генератор Відповідей — Торти

🎂 Генератор відповідей — Торти. Uses gmailTrigger, openAi, googleDocs, gmail. Event-driven trigger; 8 nodes.

Event trigger★★★★☆ complexityAI-powered8 nodesGmail TriggerOpenAIGoogle DocsGmail
AI & RAG Trigger: Event Nodes: 8 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Gmail → Gmail Trigger 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": "\ud83c\udf82 \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u0435\u0439 \u2014 \u0422\u043e\u0440\u0442\u0438",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "simple": false
      },
      "id": "gmail-trigger",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        300
      ]
    },
    {
      "parameters": {
        "options": {},
        "text": "=\u041f\u0440\u043e\u0430\u043d\u0430\u043b\u0456\u0437\u0443\u0439 \u0446\u0435\u0439 email \u0442\u0430 \u0432\u0438\u0437\u043d\u0430\u0447, \u0447\u0438 \u0454 \u0432\u0456\u043d \u0437\u0430\u043f\u0438\u0442\u043e\u043c \u043d\u0430 \u043a\u0443\u043f\u0456\u0432\u043b\u044e \u0442\u043e\u0440\u0442\u0456\u0432.\n\n\u0412\u0456\u0434\u043f\u0440\u0430\u0432\u043d\u0438\u043a: {{ $json.from.value[0].address }}\n\u0422\u0435\u043c\u0430: {{ $json.subject }}\n\u0422\u0435\u043a\u0441\u0442 \u043b\u0438\u0441\u0442\u0430:\n{{ $json.text || $json.snippet }}\n\n\u042f\u043a\u0449\u043e \u0446\u0435 \u0437\u0430\u043f\u0438\u0442 \u043d\u0430 \u043a\u0443\u043f\u0456\u0432\u043b\u044e \u0442\u043e\u0440\u0442\u0456\u0432, \u043f\u043e\u0432\u0435\u0440\u043d\u0438 JSON \u0443 \u0442\u0430\u043a\u043e\u043c\u0443 \u0444\u043e\u0440\u043c\u0430\u0442\u0456:\n{\n  \"is_cake_order\": true,\n  \"client_name\": \"\u0456\u043c'\u044f \u043a\u043b\u0456\u0454\u043d\u0442\u0430 \u0430\u0431\u043e \u0437\u0432\u0435\u0440\u0442\u0430\u043d\u043d\u044f \u0437 \u043b\u0438\u0441\u0442\u0430\",\n  \"cake_count\": \u0447\u0438\u0441\u043b\u043e \u0442\u043e\u0440\u0442\u0456\u0432 (\u0446\u0456\u043b\u0435 \u0447\u0438\u0441\u043b\u043e),\n  \"client_email\": \"email \u0432\u0456\u0434\u043f\u0440\u0430\u0432\u043d\u0438\u043a\u0430\"\n}\n\n\u042f\u043a\u0449\u043e \u0446\u0435 \u041d\u0415 \u0437\u0430\u043f\u0438\u0442 \u043d\u0430 \u043a\u0443\u043f\u0456\u0432\u043b\u044e \u0442\u043e\u0440\u0442\u0456\u0432, \u043f\u043e\u0432\u0435\u0440\u043d\u0438:\n{\n  \"is_cake_order\": false\n}\n\n\u041f\u043e\u0432\u0435\u0440\u043d\u0438 \u0422\u0406\u041b\u042c\u041a\u0418 JSON, \u0431\u0435\u0437 \u0456\u043d\u0448\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0443.",
        "promptType": "define"
      },
      "id": "ai-classifier",
      "name": "AI \u041a\u043b\u0430\u0441\u0438\u0444\u0456\u043a\u0430\u0446\u0456\u044f \u043b\u0438\u0441\u0442\u0430",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        300,
        300
      ]
    },
    {
      "parameters": {
        "jsCode": "// \u041f\u0430\u0440\u0441\u0438\u043c\u043e \u0432\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u044c AI\nlet aiResponse = $input.first().json.text || $input.first().json.content || '';\n\n// \u0412\u0438\u0434\u0430\u043b\u044f\u0454\u043c\u043e markdown code blocks \u044f\u043a\u0449\u043e \u0454\naiResponse = aiResponse.replace(/```json\\n?/g, '').replace(/```\\n?/g, '').trim();\n\nlet parsed;\ntry {\n  parsed = JSON.parse(aiResponse);\n} catch(e) {\n  // \u0421\u043f\u0440\u043e\u0431\u0443\u0454\u043c\u043e \u0437\u043d\u0430\u0439\u0442\u0438 JSON \u0432 \u0442\u0435\u043a\u0441\u0442\u0456\n  const match = aiResponse.match(/\\{[\\s\\S]*\\}/);\n  if (match) {\n    parsed = JSON.parse(match[0]);\n  } else {\n    parsed = { is_cake_order: false };\n  }\n}\n\n// \u0420\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a \u0432\u0430\u0440\u0442\u043e\u0441\u0442\u0456\nconst cakeCount = parseInt(parsed.cake_count) || 0;\nconst totalPrice = cakeCount * 1000;\n\nreturn [{\n  json: {\n    is_cake_order: parsed.is_cake_order || false,\n    client_name: parsed.client_name || '\u0428\u0430\u043d\u043e\u0432\u043d\u0438\u0439 \u043a\u043b\u0456\u0454\u043d\u0442\u0435',\n    cake_count: cakeCount,\n    client_email: parsed.client_email || '',\n    total_price: totalPrice,\n    price_formatted: totalPrice.toLocaleString('uk-UA') + ' \u0433\u0440\u043d',\n    date: new Date().toLocaleDateString('uk-UA')\n  }\n}];"
      },
      "id": "code-parse",
      "name": "\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        550,
        300
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "cake-check",
              "leftValue": "={{ $json.is_cake_order }}",
              "rightValue": true,
              "operator": {
                "type": "boolean",
                "operation": "true"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "if-cake",
      "name": "\u0426\u0435 \u0437\u0430\u043c\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0442\u043e\u0440\u0442\u0456\u0432?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        800,
        300
      ]
    },
    {
      "parameters": {
        "operation": "copy",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": ""
        },
        "title": "=\u041a\u043e\u043c\u0435\u0440\u0446\u0456\u0439\u043d\u0430 \u043f\u0440\u043e\u043f\u043e\u0437\u0438\u0446\u0456\u044f \u2014 {{ $json.client_name }} \u2014 {{ $json.date }}"
      },
      "id": "gdocs-copy",
      "name": "\u041a\u043e\u043f\u0456\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0443 Google Docs",
      "type": "n8n-nodes-base.googleDocs",
      "typeVersion": 2,
      "position": [
        1050,
        200
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "documentId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "actionsUi": {
          "actionFields": [
            {
              "action": "replaceAll",
              "text": "{{CLIENT_NAME}}",
              "replaceText": "={{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.client_name }}"
            },
            {
              "action": "replaceAll",
              "text": "{{CAKE_COUNT}}",
              "replaceText": "={{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.cake_count }}"
            },
            {
              "action": "replaceAll",
              "text": "{{TOTAL_PRICE}}",
              "replaceText": "={{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.price_formatted }}"
            },
            {
              "action": "replaceAll",
              "text": "{{DATE}}",
              "replaceText": "={{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.date }}"
            },
            {
              "action": "replaceAll",
              "text": "{{CLIENT_EMAIL}}",
              "replaceText": "={{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.client_email }}"
            }
          ]
        }
      },
      "id": "gdocs-update",
      "name": "\u0417\u0430\u043f\u043e\u0432\u043d\u0435\u043d\u043d\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0443",
      "type": "n8n-nodes-base.googleDocs",
      "typeVersion": 2,
      "position": [
        1300,
        200
      ]
    },
    {
      "parameters": {
        "sendTo": "={{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.client_email }}",
        "subject": "=\u041a\u043e\u043c\u0435\u0440\u0446\u0456\u0439\u043d\u0430 \u043f\u0440\u043e\u043f\u043e\u0437\u0438\u0446\u0456\u044f \u2014 \u0422\u043e\u0440\u0442\u0438 \u043d\u0430 \u0437\u0430\u043c\u043e\u0432\u043b\u0435\u043d\u043d\u044f \ud83c\udf82",
        "emailType": "html",
        "message": "=<div style=\"font-family: Arial, sans-serif; max-width: 600px; margin: 0 auto;\">\n<h2 style=\"color: #d4956a;\">\ud83c\udf82 \u0414\u044f\u043a\u0443\u0454\u043c\u043e \u0437\u0430 \u0432\u0430\u0448 \u0437\u0430\u043f\u0438\u0442!</h2>\n<p>\u0428\u0430\u043d\u043e\u0432\u043d\u0438\u0439(\u0430) <strong>{{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.client_name }}</strong>,</p>\n<p>\u0414\u044f\u043a\u0443\u0454\u043c\u043e \u0437\u0430 \u0456\u043d\u0442\u0435\u0440\u0435\u0441 \u0434\u043e \u043d\u0430\u0448\u0438\u0445 \u0442\u043e\u0440\u0442\u0456\u0432! \u041c\u0438 \u043f\u0456\u0434\u0433\u043e\u0442\u0443\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u0432\u0430\u0441 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0456\u0437\u043e\u0432\u0430\u043d\u0443 \u043a\u043e\u043c\u0435\u0440\u0446\u0456\u0439\u043d\u0443 \u043f\u0440\u043e\u043f\u043e\u0437\u0438\u0446\u0456\u044e.</p>\n<p><strong>\u0414\u0435\u0442\u0430\u043b\u0456 \u0437\u0430\u043c\u043e\u0432\u043b\u0435\u043d\u043d\u044f:</strong></p>\n<ul>\n<li>\u041a\u0456\u043b\u044c\u043a\u0456\u0441\u0442\u044c \u0442\u043e\u0440\u0442\u0456\u0432: <strong>{{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.cake_count }}</strong></li>\n<li>\u0417\u0430\u0433\u0430\u043b\u044c\u043d\u0430 \u0432\u0430\u0440\u0442\u0456\u0441\u0442\u044c: <strong>{{ $('\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a').item.json.price_formatted }}</strong></li>\n</ul>\n<p>\ud83d\udcc4 <a href=\"https://docs.google.com/document/d/{{ $json.id }}\" style=\"color: #d4956a; font-weight: bold;\">\u041f\u0435\u0440\u0435\u0433\u043b\u044f\u043d\u0443\u0442\u0438 \u043a\u043e\u043c\u0435\u0440\u0446\u0456\u0439\u043d\u0443 \u043f\u0440\u043e\u043f\u043e\u0437\u0438\u0446\u0456\u044e</a></p>\n<p>\u0417 \u043f\u043e\u0432\u0430\u0433\u043e\u044e,<br><strong>\u041a\u043e\u043d\u0434\u0438\u0442\u0435\u0440\u0441\u044c\u043a\u0430 \"\u0421\u043e\u043b\u043e\u0434\u043a\u0438\u0439 \u0420\u0430\u0439\"</strong></p>\n</div>",
        "options": {}
      },
      "id": "gmail-send",
      "name": "\u0412\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u044c \u043a\u043b\u0456\u0454\u043d\u0442\u0443",
      "type": "n8n-nodes-base.gmail",
      "typeVersion": 2.1,
      "position": [
        1550,
        200
      ]
    },
    {
      "parameters": {},
      "id": "no-op",
      "name": "\u041d\u0435 \u0437\u0430\u043c\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u2014 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0454\u043c\u043e",
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        1050,
        450
      ]
    }
  ],
  "connections": {
    "Gmail Trigger": {
      "main": [
        [
          {
            "node": "AI \u041a\u043b\u0430\u0441\u0438\u0444\u0456\u043a\u0430\u0446\u0456\u044f \u043b\u0438\u0441\u0442\u0430",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI \u041a\u043b\u0430\u0441\u0438\u0444\u0456\u043a\u0430\u0446\u0456\u044f \u043b\u0438\u0441\u0442\u0430": {
      "main": [
        [
          {
            "node": "\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0442\u0430 \u0440\u043e\u0437\u0440\u0430\u0445\u0443\u043d\u043e\u043a": {
      "main": [
        [
          {
            "node": "\u0426\u0435 \u0437\u0430\u043c\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0442\u043e\u0440\u0442\u0456\u0432?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0426\u0435 \u0437\u0430\u043c\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u0442\u043e\u0440\u0442\u0456\u0432?": {
      "main": [
        [
          {
            "node": "\u041a\u043e\u043f\u0456\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0443 Google Docs",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "\u041d\u0435 \u0437\u0430\u043c\u043e\u0432\u043b\u0435\u043d\u043d\u044f \u2014 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0454\u043c\u043e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u041a\u043e\u043f\u0456\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0443 Google Docs": {
      "main": [
        [
          {
            "node": "\u0417\u0430\u043f\u043e\u0432\u043d\u0435\u043d\u043d\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0443",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u0417\u0430\u043f\u043e\u0432\u043d\u0435\u043d\u043d\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u0443": {
      "main": [
        [
          {
            "node": "\u0412\u0456\u0434\u043f\u043e\u0432\u0456\u0434\u044c \u043a\u043b\u0456\u0454\u043d\u0442\u0443",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  }
}
Pro

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

About this workflow

🎂 Генератор відповідей — Торти. Uses gmailTrigger, openAi, googleDocs, gmail. Event-driven trigger; 8 nodes.

Source: https://github.com/neuron7xLab/ai-automation-portfolio/blob/main/smb-templates/email-to-doc-pipeline/workflow.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

Openai Workflow. Uses openAi, gmailTrigger, gmail, crypto. Event-driven trigger; 49 nodes.

OpenAI, Gmail Trigger, Gmail +2
AI & RAG

Complete AI-powered sales system Automates lead capture, qualification, and follow-up from multiple channels. AI INTELLIGENCE:

Gmail Trigger, Google Sheets, OpenAI +3
AI & RAG

This workflow watches a Notion CRM for leads ready to contact, checks Gmail to avoid duplicate outreach, then sends or drafts an email with Google Drive PDF attachments and updates the lead status in

Notion Trigger, Gmail, Notion +4
AI & RAG

An automated quote generation system that monitors your inbox, classifies quote requests using AI, calculates intelligent pricing based on historical data, and provides a professional dashboard for re

Gmail Trigger, OpenAI, Supabase +2
AI & RAG

LeadInboxTriageBot_GT. Uses gmailTrigger, openAi, googleSheets, gmail. Event-driven trigger; 36 nodes.

Gmail Trigger, OpenAI, Google Sheets +2