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

링크드인 연결 요청 → CRM 자동 추가

  • ▸문서 저장 시 자동으로 버전 번호를 부여하고 이력을 관리할 수 있다
  • ▸Google Drive에 날짜별 버전 폴더를 자동 생성할 수 있다
  • ▸특정 버전으로 롤백하는 워크플로우를 만들 수 있다

✅사전 준비

  • □Google Drive 자격증명 연결 완료
  • □버전 관리할 문서 폴더 ID 확인
  • □Google Sheets에 버전 이력 관리 시트 생성 (버전/파일명/저장일시/설명/파일ID 컬럼)
  • □Webhook 또는 Drive Trigger 설정 (파일 변경 감지용)

버전 번호 자동 부여 — Code 노드

const history = $('Sheets Version History').all();
const fileName = $json.name;

// 같은 파일의 최대 버전 번호 찾기
const versions = history
  .filter(i => i.json.파일명 === fileName)
  .map(i => parseFloat(i.json.버전) || 0);

const lastVersion = versions.length > 0 ? Math.max(...versions) : 0;
const newVersion = (lastVersion + 0.1).toFixed(1);

return [{ json: { ...$json, 버전: newVersion } }];

버전 파일 복사 저장 — Drive 설정

버전 저장 폴더 경로 규칙:
/문서관리/[파일명]/v[버전번호]_[파일명]_[YYYYMMDD]

Drive Copy File:
  File ID:      원본 파일 ID
  New Name:     v{{ $json.버전 }}_{{ $json.name }}_{{ $now.toFormat('yyyyMMdd') }}
  Parent Folder: 버전_폴더_ID

버전 이력 Sheets 기록

버전:      {{ $json.버전 }}
파일명:    {{ $json.name }}
저장일시:  {{ $now.toFormat('yyyy-MM-dd HH:mm:ss') }}
파일ID:    {{ $json.id }}
설명:      {{ $json.versionNote ?? '자동 저장' }}
⚡

워크플로우 JSON

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

📥 n8n 임포트 방법
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
{
  "recipeId": "recipe039",
  "title": "링크드인 연결 요청 → CRM 자동 추가",
  "chapter": 3,
  "category": "영업 & 리드 관리 자동화",
  "difficulty": "⭐⭐⭐",
  "estimatedTime": "45분",
  "description": "매일 오전 10시 LinkedIn API로 신규 연결 목록을 가져와 이름·직함·회사·프로필 URL을 HubSpot Contact에 자동 저장하고, Slack에 등록 완료 알림을 보냅니다.",
  "apps": [
    "LinkedIn API",
    "HubSpot",
    "Slack"
  ],
  "nodes": [
    {
      "id": "trigger_schedule",
      "type": "trigger",
      "name": "Schedule Trigger - 매일 오전 10시",
      "service": "scheduleTrigger",
      "config": {
        "rule": "0 10 * * *"
      }
    },
    {
      "id": "linkedin_connections",
      "type": "action",
      "name": "HTTP Request - LinkedIn 신규 연결 목록",
      "service": "httpRequest",
      "config": {
        "method": "GET",
        "url": "https://api.linkedin.com/v2/connections?q=viewer&start=0&count=10&sort=RECENTLY_ADDED",
        "headers": {
          "Authorization": "Bearer {{ $env.LINKEDIN_ACCESS_TOKEN }}",
          "X-Restli-Protocol-Version": "2.0.0"
        }
      }
    },
    {
      "id": "hubspot_upsert",
      "type": "action",
      "name": "HubSpot - Contact 저장",
      "service": "hubspot",
      "config": {
        "operation": "upsert",
        "contactFields": {
          "firstname": "={{ $json[\"firstName\"] }}",
          "lastname": "={{ $json[\"lastName\"] }}",
          "jobtitle": "={{ $json[\"headline\"] }}",
          "company": "={{ $json[\"company\"] }}",
          "linkedin_url": "={{ $json[\"profileUrl\"] }}"
        }
      }
    },
    {
      "id": "slack_complete",
      "type": "action",
      "name": "Slack - CRM 등록 완료 알림",
      "service": "slack",
      "config": {
        "channel": "={{ $env.SLACK_SALES_DM }}",
        "message": "🔗 새 LinkedIn 연결 CRM 등록 완료!\n이름: {{ $json[\"firstName\"] }} {{ $json[\"lastName\"] }}\n직함: {{ $json[\"headline\"] }}\n회사: {{ $json[\"company\"] }}"
      }
    }
  ],
  "connections": [
    {
      "from": "trigger_schedule",
      "to": "linkedin_connections"
    },
    {
      "from": "linkedin_connections",
      "to": "hubspot_upsert"
    },
    {
      "from": "hubspot_upsert",
      "to": "slack_complete"
    }
  ],
  "envVars": [
    {
      "key": "LINKEDIN_ACCESS_TOKEN",
      "description": "LinkedIn API Access Token"
    },
    {
      "key": "SLACK_SALES_DM",
      "description": "영업사원 Slack DM 채널 ID"
    }
  ],
  "qrCodeUrl": "https://www.koreaaitimes.com/books/n8n-vol2/recipe039"
}
← 이전 레시피☰ 목차다음 레시피 →