RECIPE 014
웹사이트 신규 가입자 → CRM 자동 등록
- ▸Webhook으로 외부 앱의 에러 이벤트를 실시간으로 수신할 수 있다
- ▸에러 레벨(critical/warning/info)에 따라 알림 채널을 다르게 라우팅할 수 있다
- ▸Slack과 이메일로 에러 내용을 즉시 전달할 수 있다
✅사전 준비
- □n8n Webhook URL 생성 후 외부 앱의 에러 알림 엔드포인트에 등록
- □Slack 채널 2개 준비: #에러-critical (즉시 대응), #에러-log (기록용)
- □Gmail 자격증명 연결 완료 (critical 에러 이메일용)
- □Google Sheets에 에러 로그 저장용 시트 생성
Webhook 수신 데이터 예시 (표준 포맷 권장)
{
"level": "critical",
"message": "Database connection timeout",
"service": "api-server",
"timestamp": "2025-01-15T09:23:11Z",
"stack": "Error: connect ETIMEDOUT..."
}에러 레벨 분기 — Switch 노드 조건
Value: {{ $json.level }}
Case 1: critical → Slack #에러-critical + Gmail 발송
Case 2: warning → Slack #에러-log 발송
Case 3: info → Sheets 기록만Slack critical 알림 메시지
🚨 *CRITICAL 에러 발생* 🚨
서비스: {{ $json.service }}
메시지: {{ $json.message }}
시각: {{ $json.timestamp }}
```{{ $json.stack?.slice(0, 300) }}```Sheets 에러 로그 매핑
레벨: {{ $json.level }}
서비스: {{ $json.service }}
메시지: {{ $json.message }}
발생시각: {{ $json.timestamp }}
수신일시: {{ $now.toFormat("yyyy-MM-dd HH:mm:ss") }}⚠️ 주의Webhook URL은 외부에 노출되므로 n8n Webhook 설정에서 인증 헤더(Header Auth)를 반드시 추가하세요. 발신 앱에 동일한 헤더 값을 설정해야 합니다.
⚡
워크플로우 JSON
아래 JSON을 복사해 n8n에 바로 임포트하세요
📥 n8n 임포트 방법
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
{
"name": "recipe014_new_signup_crm_register",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "new-signup",
"options": {}
},
"id": "webhook-014-01",
"name": "웹사이트 신규 가입 Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
200,
400
]
},
{
"parameters": {
"jsCode": "const body = $json.body || $json;\nreturn [{\n json: {\n name: body.name || '',\n email: body.email || '',\n phone: body.phone || '',\n source: body.source || 'website',\n signedUpAt: $now.format('YYYY-MM-DD HH:mm')\n }\n}];"
},
"id": "code-014-02",
"name": "가입 데이터 파싱",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
420,
400
]
},
{
"parameters": {
"resource": "contact",
"operation": "upsert",
"email": "={{ $json.email }}",
"additionalFields": {
"firstName": "={{ $json.name.split(' ')[0] }}",
"lastName": "={{ $json.name.split(' ')[1] || '' }}",
"phone": "={{ $json.phone }}",
"lifecycleStage": "lead"
}
},
"id": "hubspot-014-03",
"name": "HubSpot 연락처 자동 등록",
"type": "n8n-nodes-base.hubspot",
"typeVersion": 2.1,
"position": [
640,
400
]
},
{
"parameters": {
"resource": "message",
"operation": "post",
"channel": "#sales-leads",
"text": "=🔔 새 리드가 등록됐어요!\n이름: {{ $('가입 데이터 파싱').item.json.name }}\n이메일: {{ $('가입 데이터 파싱').item.json.email }}\n유입 경로: {{ $('가입 데이터 파싱').item.json.source }}\n가입 시각: {{ $('가입 데이터 파싱').item.json.signedUpAt }}"
},
"id": "slack-014-04",
"name": "영업팀 Slack 알림",
"type": "n8n-nodes-base.slack",
"typeVersion": 2.2,
"position": [
860,
400
]
}
],
"connections": {
"웹사이트 신규 가입 Webhook": {
"main": [
[
{
"node": "가입 데이터 파싱",
"type": "main",
"index": 0
}
]
]
},
"가입 데이터 파싱": {
"main": [
[
{
"node": "HubSpot 연락처 자동 등록",
"type": "main",
"index": 0
}
]
]
},
"HubSpot 연락처 자동 등록": {
"main": [
[
{
"node": "영업팀 Slack 알림",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"timezone": "Asia/Seoul"
},
"meta": {
"chapter": 2,
"recipe": "014",
"title": "웹사이트 신규 가입자 → CRM 자동 등록",
"difficulty": "⭐⭐",
"estimatedTime": "35분",
"apps": [
"Webhook",
"HubSpot",
"Slack"
]
}
}