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

고객사 뉴스 모니터링 → 영업 기회 감지

  • ▸Slack API로 특정 채널의 메시지 이력을 주기적으로 수집할 수 있다
  • ▸수집된 메시지를 Google Sheets 또는 Notion에 아카이빙할 수 있다
  • ▸특정 키워드나 반응(이모지)이 달린 메시지만 선별 저장할 수 있다

✅사전 준비

  • □Slack Bot Token 발급 및 자격증명 등록 (channels:history, channels:read 권한 필요)
  • □아카이빙할 채널 ID 확인 (채널 이름 클릭 → 하단에서 확인)
  • □Google Sheets 자격증명 연결 완료
  • □Schedule Trigger: 매일 자정 (Cron: 0 0 * * *)

Slack 채널 메시지 수집 — HTTP Request

URL: https://slack.com/api/conversations.history
Method: GET
Headers:
  Authorization: Bearer YOUR_BOT_TOKEN

Query Parameters:
  channel: CHANNEL_ID
  oldest:  {{ $now.minus({hours:24}).toUnixInteger() }}
  limit:   200

메시지 정제 — Code 노드

const messages = $input.first().json.messages ?? [];

return messages
  .filter(m => m.type === 'message' && !m.subtype) // 봇 메시지 제외
  .map(m => ({
    json: {
      timestamp: new Date(parseFloat(m.ts) * 1000).toISOString(),
      user:      m.user ?? 'unknown',
      text:      m.text ?? '',
      reactions: m.reactions?.map(r => r.name).join(', ') ?? '',
    }
  }));

Sheets 아카이브 매핑

시각:      {{ $json.timestamp }}
작성자ID:  {{ $json.user }}
내용:      {{ $json.text }}
반응:      {{ $json.reactions }}
💡 TIPSlack 무료 플랜은 메시지 이력이 90일로 제한됩니다. 중요한 채널은 이 워크플로우로 정기 아카이빙해두는 게 좋습니다.
⚡

워크플로우 JSON

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

📥 n8n 임포트 방법
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
{
  "recipeId": "recipe033",
  "title": "고객사 뉴스 모니터링 → 영업 기회 감지",
  "chapter": 3,
  "category": "영업 & 리드 관리 자동화",
  "difficulty": "⭐⭐⭐",
  "estimatedTime": "40분",
  "description": "주요 고객사 이름으로 설정한 Google Alerts RSS를 수집하고, OpenAI로 영업 기회 관련성을 분석하여 관련성 높은 뉴스만 담당 영업사원 Slack DM에 요약 발송합니다.",
  "apps": [
    "Google Alerts RSS",
    "OpenAI",
    "Slack"
  ],
  "nodes": [
    {
      "id": "trigger_schedule",
      "type": "trigger",
      "name": "Schedule Trigger - 매일 오전 8시",
      "service": "scheduleTrigger",
      "config": {
        "rule": "0 8 * * *"
      }
    },
    {
      "id": "rss_read",
      "type": "action",
      "name": "RSS Feed Read - 고객사 뉴스 수집",
      "service": "rssFeedRead",
      "config": {
        "url": "={{ $env.CUSTOMER_ALERTS_RSS_URL }}"
      }
    },
    {
      "id": "openai_analyze",
      "type": "action",
      "name": "OpenAI - 영업 기회 관련성 분석",
      "service": "openai",
      "config": {
        "model": "gpt-4o-mini",
        "prompt": "다음 뉴스가 B2B 영업 기회(신규 투자, 인력 채용, 사업 확장 등)와 관련이 있는지 판단해줘. '관련있음' 또는 '관련없음' 중 하나와 한 줄 이유를 JSON으로 반환해줘. 형식: {\"relevance\": \"\", \"reason\": \"\"}\n\n뉴스: {{ $json[\"title\"] }} - {{ $json[\"content\"] }}"
      }
    },
    {
      "id": "if_relevant",
      "type": "condition",
      "name": "영업 기회 관련성 확인",
      "config": {
        "conditions": [
          {
            "field": "={{ $json[\"relevance\"] }}",
            "operator": "equals",
            "value": "관련있음"
          }
        ]
      }
    },
    {
      "id": "slack_notify",
      "type": "action",
      "name": "Slack - 영업 기회 알림",
      "service": "slack",
      "config": {
        "channel": "={{ $env.SLACK_SALES_DM }}",
        "message": "🔍 고객사 영업 기회 뉴스!\n제목: {{ $json[\"title\"] }}\n요약: {{ $json[\"reason\"] }}\n링크: {{ $json[\"link\"] }}"
      }
    }
  ],
  "connections": [
    {
      "from": "trigger_schedule",
      "to": "rss_read"
    },
    {
      "from": "rss_read",
      "to": "openai_analyze"
    },
    {
      "from": "openai_analyze",
      "to": "if_relevant"
    },
    {
      "from": "if_relevant",
      "to": "slack_notify",
      "branch": "true"
    }
  ],
  "envVars": [
    {
      "key": "CUSTOMER_ALERTS_RSS_URL",
      "description": "고객사 Google Alerts RSS 주소"
    },
    {
      "key": "SLACK_SALES_DM",
      "description": "영업사원 Slack DM 채널 ID"
    }
  ],
  "qrCodeUrl": "https://www.koreaaitimes.com/books/n8n-vol2/recipe033"
}
← 이전 레시피☰ 목차다음 레시피 →