RECIPE 088
YouTube 댓글 자동 모니터링 → 대응 관리
- ▸YouTube 채널 신규 댓글을 주기적으로 수집
- ▸부정적/스팸 댓글을 AI로 자동 분류
- ▸중요 댓글을 Notion에 저장하고 팀에 대응 요청
✅사전 준비
- □YouTube Data API v3 키 발급 (Google Cloud Console)
- □모니터링할 채널 ID 및 영상 ID 목록 준비
- □OpenAI API 키 (댓글 분류용)
- □Notion 댓글 관리 DB 생성
YouTube 댓글 수집 API
Node: HTTP Request
Method: GET
URL: https://www.googleapis.com/youtube/v3/commentThreads
Query Parameters:
part: snippet
videoId: {{ $json.video_id }}
order: time
maxResults: 20
publishedAfter: {{ $now.minus({hours: 1}).toISO() }}
key: YOUR_YOUTUBE_API_KEY댓글 감정 분류 프롬프트
System: YouTube 댓글 분류 시스템입니다.
다음 JSON 형식으로만 응답하세요:
{
"type": "긍정|부정|질문|스팸|광고",
"priority": "높음|보통|낮음",
"needsReply": true/false,
"reason": "분류 이유 한 줄"
}
User: {{ $json.snippet.topLevelComment.snippet.textOriginal }}Notion 댓글 DB 저장
{
"parent": { "database_id": "YOUR_COMMENT_DB_ID" },
"properties": {
"댓글 내용": { "title": [{ "text": { "content": "{{ $json.commentText.slice(0, 100) }}" } }] },
"작성자": { "rich_text": [{ "text": { "content": "{{ $json.authorName }}" } }] },
"유형": { "select": { "name": "{{ $json.classification.type }}" } },
"우선순위": { "select": { "name": "{{ $json.classification.priority }}" } },
"대응필요": { "checkbox": {{ $json.classification.needsReply }} },
"영상 링크": { "url": "https://youtube.com/watch?v={{ $json.videoId }}&lc={{ $json.commentId }}" }
}
}💡 TIPYouTube Data API는 일일 할당량이 10,000 유닛입니다. commentThreads.list 호출은 1 유닛이므로, 1시간마다 영상당 1회 호출하면 영상 100개 기준으로도 일일 2,400 유닛만 사용합니다.
⚡
워크플로우 JSON
아래 JSON을 복사해 n8n에 바로 임포트하세요
📥 n8n 임포트 방법
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
{
"recipeId": "recipe088",
"title": "토스페이먼츠 결제 완료 → 자동 확인 처리",
"chapter": 8,
"category": "국내 서비스 특화 레시피",
"difficulty": "⭐⭐",
"estimatedTime": "35분",
"usedApps": [
"토스페이먼츠 Webhook",
"Google Sheets",
"Gmail"
],
"description": "토스페이먼츠 결제 완료 Webhook을 n8n이 즉시 수신해 구매자 정보·금액·상품명을 추출하고, Google Sheets 주문 시트에 자동 기록한 뒤 구매자에게 결제 완료 이메일을 자동 발송합니다.",
"apiGuide": {
"platform": "토스페이먼츠",
"issueUrl": "developers.tosspayments.com",
"steps": [
"토스페이먼츠 개발자 센터 접속 (테스트 계정으로 시작 가능)",
"API 키 발급 (테스트 키 / 라이브 키)",
"웹훅 등록 → n8n Webhook URL 입력",
"이벤트 타입: 결제 승인(DONE) 선택"
]
},
"nodes": [
{
"id": "node1",
"type": "n8n-nodes-base.webhook",
"name": "토스페이먼츠 결제 완료 수신",
"parameters": {
"path": "tosspayments-complete",
"httpMethod": "POST",
"responseMode": "lastNode"
}
},
{
"id": "node2",
"type": "n8n-nodes-base.code",
"name": "결제 정보 추출",
"parameters": {
"jsCode": "const payment = items[0].json;\nreturn [{\n json: {\n orderId: payment.orderId,\n orderName: payment.orderName,\n amount: payment.totalAmount,\n buyerName: payment.customerName || '',\n buyerEmail: payment.customerEmail || '',\n paidAt: payment.approvedAt,\n method: payment.method\n }\n}];"
}
},
{
"id": "node3",
"type": "n8n-nodes-base.googleSheets",
"name": "주문 시트 자동 기록",
"parameters": {
"operation": "appendOrUpdate",
"spreadsheetId": "={{$env.ORDER_SHEET_ID}}",
"sheetName": "주문내역",
"columns": {
"mappingMode": "defineBelow",
"value": {
"주문ID": "={{$json['orderId']}}",
"상품명": "={{$json['orderName']}}",
"결제금액": "={{$json['amount']}}",
"구매자명": "={{$json['buyerName']}}",
"구매자이메일": "={{$json['buyerEmail']}}",
"결제수단": "={{$json['method']}}",
"결제일시": "={{$json['paidAt']}}"
}
}
}
},
{
"id": "node4",
"type": "n8n-nodes-base.gmail",
"name": "구매 확인 이메일 발송",
"parameters": {
"operation": "send",
"to": "={{$json['buyerEmail']}}",
"subject": "[{{$env.BRAND_NAME}}] 결제가 완료되었습니다",
"message": "안녕하세요, {{$json['buyerName']}}님!\n\n결제가 정상적으로 완료되었습니다.\n\n주문 상품: {{$json['orderName']}}\n결제 금액: ₩{{$json['amount'].toLocaleString()}}\n결제 수단: {{$json['method']}}\n결제 일시: {{$json['paidAt']}}\n\n감사합니다.\n{{$env.BRAND_NAME}} 드림"
}
}
],
"envVariables": {
"ORDER_SHEET_ID": "Google Sheets 주문 내역 시트 ID",
"BRAND_NAME": "브랜드/상호명"
},
"tips": [
"토스페이먼츠 테스트 환경에서 먼저 Webhook 연결을 테스트한 후 라이브 키로 전환하세요.",
"레시피 045(구매 3일 후 만족도 설문 발송)와 연결하면 결제 완료 → 만족도 조사까지 전체 구매 여정이 자동화됩니다.",
"레시피 085(스마트스토어 주문 집계)와 함께 운영하면 네이버와 자체 결제 채널 매출을 통합 관리할 수 있어요."
],
"qrUrl": "www.koreaaitimes.com/books/n8n-vol2/recipe088"
}