8
n8n 한국어amn8n.com

OpenAI를 사용하여 처리 필요한 이메일 자동 감지 및 Flow 통해 Teams에 알림 전송

중급

이것은Personal Productivity, Multimodal AI분야의자동화 워크플로우로, 11개의 노드를 포함합니다.주로 If, Set, Code, HttpRequest, EmailReadImap 등의 노드를 사용하며. OpenAI로 처리 필요한 메일 자동 감지 후 Flow 통해 Teams 알림 메시지 전송

사전 요구사항
  • 대상 API의 인증 정보가 필요할 수 있음
  • OpenAI API Key
워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "meta": {
    "instanceId": "370dd47843c5d81fb49ae779f8a08c791d722f165741db5d7b2cea44ada08d1e",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "bb003676-b07c-4658-a5e4-4efcda44a567",
      "name": "OpenAI",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        140,
        -100
      ],
      "parameters": {
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "GPT-4.1-MINI"
        },
        "options": {},
        "messages": {
          "values": [
            {
              "role": "system",
              "content": "=You are my Personal Email Evaluator. When I provide you with an email's subject, body, and associated details, your task is to determine if the email is Actionable or Non-Actionable based on its content.\n\n\n\n### Criteria for Actionable Emails:\nAn email is deemed Actionable if it meets any of the following criteria and clearly suggests that immediate attention or response is required:\n\n\n\n1. **Inquiry**: Contains a meaningful question or request for significant information.\n2. **Proposal**: Includes a serious business offer or collaboration opportunity that needs review or reply.\n3. **Action Required**: Specifies urgent requests needing action, such as deadlines, bookings, or confirmations.\n4. **Follow-up Reminder**: Serves as a reminder related to a previous important discussion or commitment.\n5. **Task**: Clearly outlines a priority task or step that needs to be taken.\n6. **Urgent**: Signals critical issues or time-sensitive decisions requiring immediate attention.\n7. **Event Invite**: Represents a formal invitation that requires an RSVP for an important event.\n8. **Subscription Renewal**: Notifies about the need to renew vital services or licenses.\n9. **System Notification**: Alerts about technical issues or important status changes.\n10. **Bank Notifications**: Issues regarding financial alerts or suspicious activities needing verification.\n\n\n\n**Exclusions**: Do not classify generic, routine, or low-priority requests as actionable.\n\n\n\n**Response Format**: Return your assessment in a JSON format that includes the following:\n\n\n\n- **date**: The date the email was received.\n- **subject**: The subject line of the email.\n- **sender**: The sender's information.\n\n- **recipientEmail**: The receiver's information.\n- **actionable**: A determined status of either 'Actionable' or 'Non-Actionable'.\n\n\n\n**Example Output**:\n```json\n{\n  \"date\": \"date_value\",\n  \"subject\": \"subject_value\",\n  \"from\": \"from_value\",\n\n   \"to\":\"to_value\"\n  \"actionable\": \"Actionable/Non-Actionable\"\n}\n```\n\n\n\n### Input:\nHere is the email details:\nFrom: {{ $json.from }}  \n\nto: {{ $json.to }}\nOn date: {{ $json.date }}  \nSubject line: {{ $json.subject }}  \nEmail Body: {{ $json.textPlain }}  \n\n\n\nEvaluate the provided email details and return the appropriate JSON object with your findings."
            },
            {
              "content": "=Here are the email details:\nFrom: {{ $json.from }}\nto: {{ $json.to }}\non date :{{ $json.date }}\nSubject line: {{ $json.subject }}\nEmail Body: {{ $json.textPlain }}\n\n"
            }
          ]
        },
        "simplify": false,
        "jsonOutput": true
      },
      "credentials": {
        "openAiApi": {
          "id": "5Z0CvWzOY5DhkHX3",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.8
    },
    {
      "id": "cebd6f73-b100-40f2-9f4c-ed30c1bd4708",
      "name": "메모",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        -300
      ],
      "parameters": {
        "width": 260,
        "height": 400,
        "content": "## Trigger on Email Received\n\nAutomatically runs the workflow when a new email is received from the configured Gmail account.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "7a3ad55d-ae03-43f6-b49c-fdec7fa10a5e",
      "name": "이메일 트리거 (IMAP)",
      "type": "n8n-nodes-base.emailReadImap",
      "notes": "Listen for new mail ",
      "position": [
        -80,
        -100
      ],
      "parameters": {
        "options": {},
        "postProcessAction": "nothing"
      },
      "credentials": {
        "imap": {
          "id": "mlGxULMgNsjBaHwB",
          "name": "IMAP Gmail account"
        }
      },
      "notesInFlow": true,
      "typeVersion": 2
    },
    {
      "id": "93987fdc-2914-4a37-b6a3-aedf86b09d8d",
      "name": "메모1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        -300
      ],
      "parameters": {
        "width": 500,
        "height": 400,
        "content": "## Analyze Email Content and Extract Fields\n\n- Evaluate whether the email content qualifies as actionable based on predefined criteria using OpenAI.\n\n- Retrieves essential details such as subject, sender, recipient, and actionable status from the OpenAI evaluation result."
      },
      "typeVersion": 1
    },
    {
      "id": "49ac28cf-0c2f-4638-a40e-e3a6de0febb4",
      "name": "메모2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -300
      ],
      "parameters": {
        "height": 400,
        "content": "## Check Is Email Actionable?\n\nProceeds only if the email is classified as “Actionable” by OpenAI."
      },
      "typeVersion": 1
    },
    {
      "id": "be84addc-9633-40b4-8c7e-a52a0413095a",
      "name": "메모3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        900,
        -300
      ],
      "parameters": {
        "width": 460,
        "height": 400,
        "content": "## Send Alert to MS Teams\n\n- Builds a direct Gmail search URL using the encoded subject to help locate the email easily\n\n- Posts the email details to Microsoft Teams by triggering a Power Automate flow via its webhook URL\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "5de0a008-cbe1-4a9e-a3c3-a6ca429f7f6d",
      "name": "Extract mail details",
      "type": "n8n-nodes-base.set",
      "position": [
        460,
        -100
      ],
      "parameters": {
        "include": "selected",
        "options": {},
        "includeFields": "choices[0].message.content.date, choices[0].message.content.subject, choices[0].message.content.from, choices[0].message.content.actionable, choices[0].message.content.to",
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "13a7a0cc-3b3f-4806-b22a-5708d9452609",
      "name": "Build gmail search URL",
      "type": "n8n-nodes-base.code",
      "position": [
        960,
        -100
      ],
      "parameters": {
        "jsCode": "for (const item of $input.all()) {\n  const subject = item.json.subject;\n  const encodedSubject = encodeURIComponent(subject).replace(/%20/g, '+');\n  const searchLink = `https://mail.google.com/mail/u/0/#search/${encodedSubject}`;\n  \n  item.json.searchLink = searchLink;\n}\n\nreturn $input.all();"
      },
      "typeVersion": 2
    },
    {
      "id": "935332f0-544d-4dd0-a01e-29a0500a0327",
      "name": "Is mail actionable",
      "type": "n8n-nodes-base.if",
      "position": [
        700,
        -100
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "b51ec706-74a8-4f4c-8ae9-dc9e19523e7b",
              "operator": {
                "name": "filter.operator.equals",
                "type": "string",
                "operation": "equals"
              },
              "leftValue": "={{ $json.actionable }}",
              "rightValue": "Actionable"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d6d170ed-5ca4-480d-9e42-d0723d831e6e",
      "name": "Send alert to MS team",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1200,
        -100
      ],
      "parameters": {
        "method": "POST",
        "options": {},
        "sendBody": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "date",
              "value": "={{ $json.date }}"
            },
            {
              "name": "=subject",
              "value": "={{ $json.subject }}"
            },
            {
              "name": "sender",
              "value": "={{ $json.from.replace('<', '(').replace('>', ')') }}"
            },
            {
              "name": "=recipientEmail",
              "value": "={{ $json.to }}"
            },
            {
              "name": "=searchLink",
              "value": "={{ $json.searchLink }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ed5cfd2a-5eda-47bf-9eb3-c9852d64e1df",
      "name": "메모4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -160,
        180
      ],
      "parameters": {
        "color": 5,
        "width": 840,
        "height": 480,
        "content": "## Power Automate flow to send a message in Teams.\n\n ### **1. Trigger: When a Webhook is Received**\n   - The flow is initiated when an external system (e.g., n8n) sends an HTTP request to a                                                             Power Automate webhook URL\n- This request contains structured email data including subject, sender, recipient, date, actionability, and a search link.\n\n### **2. Parse JSON**\n- Parses the incoming JSON payload from the webhook to extract required fields such as\n  `subject`, `from`, `to`, `date`, `searchLink`\n\n### **3. Get Mention Token for a User in Microsoft Teams**\n- Fetches a special @mention token for a specific user to be used in a Teams message.\n\n###  **4. Post Message in Microsoft Teams (Chat with Flow Bot)**\n- Composes and sends a rich HTML message to the user via the Flow bot in Teams.\n- The message includes:\n   - Key email details \n   - A clickable link (searchLink) to locate the email in the mailbox\n  \n\n\n"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "bb003676-b07c-4658-a5e4-4efcda44a567": {
      "main": [
        [
          {
            "node": "5de0a008-cbe1-4a9e-a3c3-a6ca429f7f6d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "935332f0-544d-4dd0-a01e-29a0500a0327": {
      "main": [
        [
          {
            "node": "13a7a0cc-3b3f-4806-b22a-5708d9452609",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email Trigger (IMAP)": {
      "main": [
        [
          {
            "node": "bb003676-b07c-4658-a5e4-4efcda44a567",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5de0a008-cbe1-4a9e-a3c3-a6ca429f7f6d": {
      "main": [
        [
          {
            "node": "935332f0-544d-4dd0-a01e-29a0500a0327",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "13a7a0cc-3b3f-4806-b22a-5708d9452609": {
      "main": [
        [
          {
            "node": "d6d170ed-5ca4-480d-9e42-d0723d831e6e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

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

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

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

중급 - 개인 생산성, 멀티모달 AI

유료인가요?

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

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

일정 경험을 가진 사용자를 위한 6-15개 노드의 중간 복잡도 워크플로우

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34