발행일: 2026-10-06(화) 11:44
← 목차로 돌아가기|하루 30분 n8n 시리즈 ② 실무 자동화 레시피 100
RECIPE 002

이메일 키워드 감지 → Slack 즉시 알림

  • ▸RSS 피드에서 특정 키워드 포함 기사만 필터링할 수 있다
  • ▸IF 노드로 조건 분기 처리를 할 수 있다
  • ▸Slack으로 포맷된 알림 메시지를 발송할 수 있다

✅사전 준비

  • □Slack 자격증명(Credentials) 연결 완료
  • □알림 받을 Slack 채널 생성 (예: #뉴스-모니터링)
  • □모니터링할 키워드 목록 준비 (예: AI, ChatGPT, 자동화)

IF 노드 — 키워드 필터 조건식

단일 키워드:
{{ $json.title.toLowerCase().includes("ai") }}

여러 키워드 중 하나라도 포함:
{{ ["ai","chatgpt","자동화"].some(k => $json.title.toLowerCase().includes(k)) }}

Slack 노드 — 메시지 포맷

*{{ $json.title }}*
{{ $json.link }}
📅 {{ $json.pubDate }}
💡 TIP키워드를 Code 노드의 변수로 관리하면 나중에 수정하기 훨씬 편합니다. const keywords = ['AI', 'GPT', '자동화'] 형태로 상단에 선언하세요.
⚠️ 주의Schedule Trigger 간격을 너무 짧게(5분 이하) 설정하면 Slack 메시지가 폭주할 수 있습니다. 최소 30분~1시간 간격을 권장합니다.
⚡

워크플로우 JSON

아래 JSON을 복사해 n8n에 바로 임포트하세요

📥 n8n 임포트 방법
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
{
  "name": "recipe002_email_keyword_slack_alert",
  "nodes": [
    {
      "parameters": {
        "pollTimes": {
          "item": [
            {
              "mode": "everyX",
              "value": 5,
              "unit": "minutes"
            }
          ]
        },
        "filters": {}
      },
      "id": "gmail-trig-002-01",
      "name": "Gmail 새 이메일 감지",
      "type": "n8n-nodes-base.gmailTrigger",
      "typeVersion": 1.2,
      "position": [
        200,
        400
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": false,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "cond-keyword",
              "leftValue": "={{ $json.subject }}",
              "rightValue": "긴급|VIP|계약|클레임|환불",
              "operator": {
                "type": "string",
                "operation": "regex"
              }
            }
          ],
          "combinator": "and"
        }
      },
      "id": "if-002-02",
      "name": "중요 키워드 포함 여부 확인",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        420,
        400
      ]
    },
    {
      "parameters": {
        "jsCode": "const subject = $json.subject || '(제목 없음)';\nconst from = $json.from || '알 수 없음';\nconst snippet = $json.snippet || $json.text || '';\nconst preview = snippet.slice(0, 200);\nreturn [{\n  json: {\n    message: `🚨 *중요 이메일 도착!*\\n\\n*발신자:* ${from}\\n*제목:* ${subject}\\n*내용 미리보기:*\\n${preview}\\n\\n📌 즉시 확인이 필요합니다!`\n  }\n}];"
      },
      "id": "code-002-03",
      "name": "알림 메시지 포맷",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        640,
        280
      ]
    },
    {
      "parameters": {
        "resource": "message",
        "operation": "post",
        "channel": "#urgent-alerts",
        "text": "={{ $json.message }}",
        "otherOptions": {}
      },
      "id": "slack-002-04",
      "name": "Slack 긴급 알림 발송",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        860,
        280
      ]
    }
  ],
  "connections": {
    "Gmail 새 이메일 감지": {
      "main": [
        [
          {
            "node": "중요 키워드 포함 여부 확인",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "중요 키워드 포함 여부 확인": {
      "main": [
        [
          {
            "node": "알림 메시지 포맷",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "알림 메시지 포맷": {
      "main": [
        [
          {
            "node": "Slack 긴급 알림 발송",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "timezone": "Asia/Seoul"
  },
  "meta": {
    "chapter": 1,
    "recipe": "002",
    "title": "이메일 키워드 감지 → Slack 즉시 알림",
    "difficulty": "⭐",
    "estimatedTime": "20분",
    "apps": [
      "Gmail",
      "Slack"
    ],
    "workflowUrl": "www.koreaaitimes.com/books/n8n-vol2/recipe002"
  }
}
← 이전 레시피☰ 목차다음 레시피 →