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

CRM 미연락 리드 자동 재접촉 알림

  • ▸Google Drive의 이미지 파일 목록을 일괄 수집할 수 있다
  • ▸파일 이름을 규칙에 따라 일괄 변경할 수 있다
  • ▸외부 이미지 리사이즈 API로 파일 크기를 자동으로 최적화할 수 있다

✅사전 준비

  • □Google Drive 자격증명 연결 완료
  • □처리할 이미지가 담긴 Drive 폴더 ID 확인
  • □이름 변경 규칙 정의 (예: YYYYMMDD_순번_원본명.jpg)
  • □이미지 리사이즈 API 준비 (kraken.io 또는 imagga 무료 플랜 가능)

Drive 이미지 목록 조회 — HTTP Request

URL: https://www.googleapis.com/drive/v3/files
Method: GET
Authentication: Google OAuth2

Query Parameters:
  q:        '폴더ID' in parents and mimeType contains 'image/'
  fields:   files(id,name,mimeType,size,createdTime)
  pageSize: 100

파일 이름 일괄 변경 규칙 — Code 노드

const items = $input.all();
return items.map((item, idx) => {
  const ext = item.json.name.split('.').pop();
  const date = new Date().toISOString().slice(0,10).replace(/-/g,'');
  const seq = String(idx + 1).padStart(3, '0');
  const newName = `${date}_${seq}_${item.json.name}`;
  return { json: { ...item.json, newName } };
});

Drive 파일명 변경 — HTTP Request (PATCH)

URL: https://www.googleapis.com/drive/v3/files/{{ $json.id }}
Method: PATCH
Authentication: Google OAuth2
Body (JSON):
  { "name": "{{ $json.newName }}" }
💡 TIP이미지 리사이즈는 n8n의 Edit Image 노드(self-hosted)를 사용하면 외부 API 없이 처리할 수 있어요. n8n 클라우드라면 kraken.io나 imgix API를 HTTP Request로 호출하세요.
⚡

워크플로우 JSON

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

📥 n8n 임포트 방법
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
{
  "recipeId": "recipe029",
  "title": "CRM 미연락 리드 자동 재접촉 알림",
  "chapter": 3,
  "category": "영업 & 리드 관리 자동화",
  "difficulty": "⭐⭐",
  "estimatedTime": "30분",
  "description": "매일 오전 9시 HubSpot에서 생성 후 7일 이상 활동이 없는 리드를 조회하여 담당 영업사원 Slack DM에 재접촉 알림을 발송합니다.",
  "apps": [
    "HubSpot",
    "Slack"
  ],
  "nodes": [
    {
      "id": "trigger_schedule",
      "type": "trigger",
      "name": "Schedule Trigger - 매일 오전 9시",
      "service": "scheduleTrigger",
      "config": {
        "rule": "0 9 * * *"
      }
    },
    {
      "id": "hubspot_search",
      "type": "action",
      "name": "HubSpot - 미연락 리드 조회",
      "service": "hubspot",
      "config": {
        "operation": "searchContacts",
        "filters": [
          {
            "propertyName": "createdate",
            "operator": "LT",
            "value": "={{ $now.minus({days: 7}).toISO() }}"
          },
          {
            "propertyName": "notes_last_updated",
            "operator": "NOT_HAS_PROPERTY"
          },
          {
            "propertyName": "lifecyclestage",
            "operator": "EQ",
            "value": "lead"
          }
        ]
      }
    },
    {
      "id": "if_exists",
      "type": "condition",
      "name": "미연락 리드 존재 여부",
      "config": {
        "conditions": [
          {
            "field": "={{ $json[\"total\"] }}",
            "operator": "gt",
            "value": 0
          }
        ]
      }
    },
    {
      "id": "slack_alert",
      "type": "action",
      "name": "Slack - 재접촉 알림",
      "service": "slack",
      "config": {
        "channel": "={{ $env.SLACK_SALES_DM }}",
        "message": "⏰ 7일 이상 연락하지 않은 리드가 있어요!\n이름: {{ $json[\"firstname\"] }} {{ $json[\"lastname\"] }}\n회사: {{ $json[\"company\"] }}\n등록일: {{ $json[\"createdate\"] }}\n→ 지금 바로 연락해보세요!"
      }
    }
  ],
  "connections": [
    {
      "from": "trigger_schedule",
      "to": "hubspot_search"
    },
    {
      "from": "hubspot_search",
      "to": "if_exists"
    },
    {
      "from": "if_exists",
      "to": "slack_alert",
      "branch": "true"
    }
  ],
  "envVars": [
    {
      "key": "SLACK_SALES_DM",
      "description": "영업사원 Slack DM 채널 ID"
    }
  ],
  "qrCodeUrl": "https://www.koreaaitimes.com/books/n8n-vol2/recipe029"
}
← 이전 레시피☰ 목차다음 레시피 →