8
n8n 한국어amn8n.com

매일 Gmail 인보ックス 요약을 Discord으로 전송 (GPT-4.1-mini + PDF 변환)

고급

이것은Miscellaneous, AI Summarization, Multimodal AI분야의자동화 워크플로우로, 18개의 노드를 포함합니다.주로 Code, Gmail, Discord, Markdown, Aggregate 등의 노드를 사용하며. GPT-4.1-mini와 PDF 변환을 사용한 매일 Gmail 받은 편지함 요약을 Discord로 전송

사전 요구사항
  • Google 계정 및 Gmail API 인증 정보
  • Discord Bot Token 또는 Webhook
  • 대상 API의 인증 정보가 필요할 수 있음
  • OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "meta": {
    "instanceId": "004a8f4f776326f6308ea533268fac22ea60e1995204a49569b21eb0ebbf949b",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "3b5b2708-da04-420a-aa33-498cd726ab8d",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        -224
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 20
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "602ac44e-3936-4cfe-81fc-0c89aa180904",
      "name": "Discord",
      "type": "n8n-nodes-base.discord",
      "position": [
        2272,
        -224
      ],
      "webhookId": "22e13d55-f814-4fcc-a6d1-64532a1a272d",
      "parameters": {
        "files": {
          "values": [
            {}
          ]
        },
        "content": "= {{ $('separate text and markdown').item.json.plainText }}",
        "options": {},
        "authentication": "webhook"
      },
      "credentials": {
        "discordWebhookApi": {
          "id": "jKpjyXPQk0ZHSthc",
          "name": "Discord Webhook account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "cab9950b-4b4f-418b-ae4c-bd29a4966bb5",
      "name": "OpenAI Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        880,
        -64
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "FjFA8XKFHNhB1RJV",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "85dde31c-3895-4ece-bb8c-ee5f21f55c89",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1920,
        -224
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "a49d8c5b-f638-4309-add4-7524c347e9cb",
      "name": "Summarization Chain",
      "type": "@n8n/n8n-nodes-langchain.chainSummarization",
      "position": [
        896,
        -224
      ],
      "parameters": {
        "options": {
          "summarizationMethodAndPrompts": {
            "values": {
              "prompt": "You will receive a collection of emails.\n\nSummarize them in **two formats**:\n\n1. **Plain Text Digest**  \n   - Use clear sentences.  \n   - Separate different senders with line breaks.  \n   - Keep it compact but readable.  \n   - Mention only the most important details (credentials, OTPs, deadlines, required actions).  \n   - Mark urgent items with [Action Required].  \n\n2. **Markdown Digest**  \n   - Use headings for senders.  \n   - Bullets for details.  \n   - Highlight actions with **[Action Required]**.  \n\nHere are the emails:\n\n\"{text}\"\n\nNow output:\n\nPLAIN TEXT:\n...\n\nMARKDOWN:\n...\n",
              "summarizationMethod": "stuff"
            }
          }
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "7f9ab61d-ffd9-477e-8886-2472e5d4a1ab",
      "name": "PDFco Api",
      "type": "n8n-nodes-pdfco.PDFco Api",
      "position": [
        1696,
        -224
      ],
      "parameters": {
        "html": "={{ $json.data }}",
        "operation": "URL/HTML to PDF",
        "convertType": "htmlToPDF",
        "advancedOptions": {}
      },
      "credentials": {
        "pdfcoApi": {
          "id": "vCEaG1kMANv6I2pX",
          "name": "PDF.co account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "156e95b9-c5c7-477d-b1a4-0c3545a56669",
      "name": "Markdown",
      "type": "n8n-nodes-base.markdown",
      "position": [
        1472,
        -224
      ],
      "parameters": {
        "mode": "markdownToHtml",
        "options": {},
        "markdown": "=\n{{ $json.markdown }}"
      },
      "typeVersion": 1
    },
    {
      "id": "190586e3-685c-4c95-87f1-882dba9e54ca",
      "name": "Aggregate",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        672,
        -224
      ],
      "parameters": {
        "include": "specifiedFields",
        "options": {},
        "aggregate": "aggregateAllItemData",
        "fieldsToInclude": "subject, from, plainText"
      },
      "typeVersion": 1
    },
    {
      "id": "9c7247ee-9811-4ad4-bb4a-bbc53a23ab38",
      "name": "필요 섹션 메일 추출",
      "type": "n8n-nodes-base.code",
      "position": [
        448,
        -224
      ],
      "parameters": {
        "jsCode": "// n8n Code node (JavaScript)\n\n// Helper: decode Gmail's base64url\nfunction decodeBase64Url(str) {\n  if (!str) return \"\";\n  str = str.replace(/-/g, '+').replace(/_/g, '/');\n  return Buffer.from(str, 'base64').toString('utf8');\n}\n\n// Helper: clean text\nfunction cleanText(txt) {\n  if (!txt) return \"\";\n\n  return txt\n    // remove long URLs\n    .replace(/https?:\\/\\/\\S+/g, \"\")\n    // remove multiple stars/dashes\n    .replace(/[*]{3,}|[-]{3,}/g, \"\")\n    // remove extra blank lines\n    .replace(/\\n\\s*\\n\\s*\\n+/g, \"\\n\\n\")\n    // trim\n    .trim();\n}\n\nconst items = $input.all();\nconst returnData = [];\n\nfor (let i = 0; i < items.length; i++) {\n  const email = items[i].json;\n  let plainText = \"\";\n\n  // Case 1: direct body\n  if (email?.payload?.body?.data) {\n    plainText = decodeBase64Url(email.payload.body.data);\n  }\n\n  // Case 2: multipart body\n  if (!plainText && Array.isArray(email?.payload?.parts)) {\n    for (const part of email.payload.parts) {\n      if (part.mimeType === \"text/plain\" && part.body?.data) {\n        plainText = decodeBase64Url(part.body.data);\n        break;\n      }\n    }\n  }\n\n  // Fallback if you already had email.text\n  if (!plainText && email.text) {\n    plainText = email.text;\n  }\n\n  const extractedData = {\n    id: email.id || \"\",\n    subject: email.subject || email.payload?.headers?.find(h => h.name === \"Subject\")?.value || \"\",\n    from: email.from?.text || email.from || email.payload?.headers?.find(h => h.name === \"From\")?.value || \"\",\n    to: email.to?.text || email.to || email.payload?.headers?.find(h => h.name === \"To\")?.value || \"\",\n    plainText: cleanText(plainText),\n  };\n\n  returnData.push({ json: extractedData });\n}\n\nreturn returnData;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "157ef58a-86fa-41fc-96d4-b058684d513f",
      "name": "지난 24시간 메일 가져오기",
      "type": "n8n-nodes-base.gmail",
      "position": [
        224,
        -224
      ],
      "webhookId": "9b3a82a5-af1e-4a65-b285-ef679fe139cb",
      "parameters": {
        "simple": false,
        "filters": {
          "labelIds": [
            "INBOX",
            "IMPORTANT"
          ],
          "receivedAfter": "={{$now.minus({days: 1}).toISO()}}"
        },
        "options": {},
        "operation": "getAll",
        "returnAll": true
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "TRunAyOQrZYegEJX",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "0df5a671-79aa-4c7d-bbd7-296a214b4c9c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        416,
        -368
      ],
      "parameters": {
        "width": 400,
        "height": 320,
        "content": "## extract fields and aggregate\n- sender\n- subject\n- body"
      },
      "typeVersion": 1
    },
    {
      "id": "5a0a95ad-14a7-484a-94c2-ef6a582151fa",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        -304
      ],
      "parameters": {
        "width": 208,
        "height": 208,
        "content": "## get mails\n- Important and inbox"
      },
      "typeVersion": 1
    },
    {
      "id": "2335cdb8-b1e1-4d7c-98f7-e84dfec2e4c0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -320
      ],
      "parameters": {
        "width": 192,
        "height": 256,
        "content": "## daily trigger"
      },
      "typeVersion": 1
    },
    {
      "id": "b82da96e-aa95-45fd-b13e-51f998143f6c",
      "name": "텍스트와 마크다운 분리",
      "type": "n8n-nodes-base.code",
      "position": [
        1248,
        -224
      ],
      "parameters": {
        "jsCode": "const output = $json[\"output\"][\"text\"];\n\n// Match plain text - works for both \"PLAIN TEXT\" and \"PLAIN TEXT DIGEST\"\nconst plainText = output.match(/PLAIN TEXT(?: DIGEST)?:\\s*([\\s\\S]*?)(?:\\n\\n---\\n\\nMARKDOWN DIGEST:|\\n\\nMARKDOWN:)/)?.[1]?.trim();\n\n// Match markdown - works for both \"MARKDOWN\" and \"MARKDOWN DIGEST\"\nconst markdown = output.match(/MARKDOWN(?: DIGEST)?:\\s*([\\s\\S]*)/)?.[1]?.trim();\n\nreturn [{\n  plainText,\n  markdown\n}];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "44150497-0310-40d3-bb8d-8bd7624ab4c1",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        832,
        -384
      ],
      "parameters": {
        "width": 320,
        "height": 480,
        "content": "## summarize all mails\n- ### model used gpt 4o-mini"
      },
      "typeVersion": 1
    },
    {
      "id": "e77850b7-6d9c-44da-8c36-33ab2cac645f",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        -304
      ],
      "parameters": {
        "width": 432,
        "height": 240,
        "content": "## convert markdown to html and convert html to pdf using PDFco Api"
      },
      "typeVersion": 1
    },
    {
      "id": "24c297f1-9195-43e2-b27d-208aaad5b518",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1856,
        -400
      ],
      "parameters": {
        "height": 336,
        "content": "## Download PDF\n- ### using link generated from pdfco"
      },
      "typeVersion": 1
    },
    {
      "id": "31e1f02c-4b0a-49c6-ad17-3d8bef1fc35c",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2192,
        -352
      ],
      "parameters": {
        "width": 336,
        "height": 304,
        "content": "## Send discord\n- using webhook\n- result will contain summary and a pdf of summary"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "156e95b9-c5c7-477d-b1a4-0c3545a56669": {
      "main": [
        [
          {
            "node": "7f9ab61d-ffd9-477e-8886-2472e5d4a1ab",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "190586e3-685c-4c95-87f1-882dba9e54ca": {
      "main": [
        [
          {
            "node": "a49d8c5b-f638-4309-add4-7524c347e9cb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7f9ab61d-ffd9-477e-8886-2472e5d4a1ab": {
      "main": [
        [
          {
            "node": "85dde31c-3895-4ece-bb8c-ee5f21f55c89",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "85dde31c-3895-4ece-bb8c-ee5f21f55c89": {
      "main": [
        [
          {
            "node": "602ac44e-3936-4cfe-81fc-0c89aa180904",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3b5b2708-da04-420a-aa33-498cd726ab8d": {
      "main": [
        [
          {
            "node": "157ef58a-86fa-41fc-96d4-b058684d513f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cab9950b-4b4f-418b-ae4c-bd29a4966bb5": {
      "ai_languageModel": [
        [
          {
            "node": "a49d8c5b-f638-4309-add4-7524c347e9cb",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "a49d8c5b-f638-4309-add4-7524c347e9cb": {
      "main": [
        [
          {
            "node": "b82da96e-aa95-45fd-b13e-51f998143f6c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "157ef58a-86fa-41fc-96d4-b058684d513f": {
      "main": [
        [
          {
            "node": "9c7247ee-9811-4ad4-bb4a-bbc53a23ab38",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b82da96e-aa95-45fd-b13e-51f998143f6c": {
      "main": [
        [
          {
            "node": "156e95b9-c5c7-477d-b1a4-0c3545a56669",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9c7247ee-9811-4ad4-bb4a-bbc53a23ab38": {
      "main": [
        [
          {
            "node": "190586e3-685c-4c95-87f1-882dba9e54ca",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

고급 - 기타, AI 요약, 멀티모달 AI

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
고급
노드 수18
카테고리3
노드 유형11
난이도 설명

고급 사용자를 위한 16+개 노드의 복잡한 워크플로우

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34