RECIPE 047
반품·환불 요청 자동 처리 흐름
- ▸고객 리뷰나 피드백 텍스트를 OpenAI로 감성 분석할 수 있다
- ▸긍정/부정/중립으로 분류된 피드백을 Sheets에 자동 정리할 수 있다
- ▸부정 피드백 발생 시 담당자에게 즉시 알림을 보낼 수 있다
✅사전 준비
- □OpenAI API 자격증명 연결 완료
- □피드백 수집 채널 결정 (Webhook / Google Forms / 앱 API)
- □Google Sheets에 감성 분석 결과 저장용 시트 생성
- □Slack 자격증명 연결 완료 (부정 피드백 알림용)
감성 분석 — OpenAI 프롬프트
Model: gpt-4o-mini
System: 너는 고객 피드백 분석 전문가야. 반드시 JSON만 응답해.
User:
다음 리뷰를 분석해서 JSON으로 응답해.
{
"sentiment": "positive|negative|neutral",
"score": 1~5 (1:매우부정, 5:매우긍정),
"keywords": ["핵심 키워드 최대 3개"],
"category": "품질|배송|서비스|가격|기타",
"summary": "한 줄 요약"
}
리뷰: {{ $json.review }}분석 결과 파싱 — Code 노드
const raw = $input.first().json.message.content;
const cleaned = raw.replace(/```json|```/g, '').trim();
const result = JSON.parse(cleaned);
return [{ json: {
...result,
originalReview: $('Webhook').first().json.review,
reviewId: $('Webhook').first().json.id,
analyzedAt: new Date().toISOString(),
} }];부정 피드백 Slack 즉시 알림
IF 조건: {{ $json.sentiment === 'negative' && $json.score <= 2 }}
Slack 메시지:
🚨 *부정 리뷰 감지*
점수: {{ $json.score }}/5
카테고리: {{ $json.category }}
요약: {{ $json.summary }}
원문: {{ $json.originalReview?.slice(0, 200) }}⚡
워크플로우 JSON
아래 JSON을 복사해 n8n에 바로 임포트하세요
📥 n8n 임포트 방법
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
n8n 화면 우측 상단 메뉴 (⋮) → Import from JSON → 아래 JSON 전체 복사 후 붙여넣기 → Import 클릭
{
"recipeId": "recipe047",
"title": "반품·환불 요청 자동 처리 흐름",
"chapter": 4,
"category": "고객 응대 자동화",
"difficulty": "⭐⭐⭐",
"estimatedTime": "50분",
"usedApps": [
"Google Forms",
"Google Sheets",
"Gmail",
"Slack"
],
"description": "반품·환불 신청 구글 폼 제출 시 단순 환불(결제 7일 이내·미개봉)은 자동 승인 이메일을, 파손·하자 등 복잡한 케이스는 CS팀 Slack으로 검토 요청 알림을 보내 자동·수동 처리를 분기합니다.",
"nodes": [
{
"id": "trigger_sheets",
"type": "trigger",
"service": "Google Sheets",
"name": "반품 신청 폼 제출 감지",
"config": {
"event": "rowAdded",
"spreadsheetId": "{{$env.REFUND_SHEET_ID}}",
"sheetName": "반품신청"
}
},
{
"id": "parse_request",
"type": "action",
"service": "Function",
"name": "신청 데이터 파싱",
"config": {
"code": "const row = $json;\nconst orderDate = new Date(row['주문일']);\nconst today = new Date();\nconst daysDiff = Math.floor((today - orderDate) / (1000 * 60 * 60 * 24));\nreturn [{\n json: {\n ...row,\n daysSinceOrder: daysDiff,\n isSimpleCase: daysDiff <= 7 && row['개봉여부'] === '미개봉' && row['환불사유'] !== '파손' && row['환불사유'] !== '하자'\n }\n}];"
}
},
{
"id": "check_case_type",
"type": "condition",
"service": "IF",
"name": "단순/복잡 케이스 분기",
"config": {
"condition": "{{$json['isSimpleCase'] === true}}"
}
},
{
"id": "send_auto_approval",
"type": "action",
"service": "Gmail",
"name": "자동 환불 승인 이메일",
"config": {
"operation": "sendEmail",
"to": "{{$json['이메일']}}",
"subject": "[환불 승인] 요청이 정상 접수되었습니다",
"body": "안녕하세요, {{$json['고객명']}}님!\n\n반품·환불 요청이 자동 승인되었습니다. ✅\n\n📦 주문번호: {{$json['주문번호']}}\n💰 환불 예정 금액: {{$json['환불금액']}}원\n📅 환불 처리 예정일: 영업일 기준 3~5일 이내\n\n반품 상품은 아래 주소로 착불 발송해 주세요:\n{{$env.RETURN_ADDRESS}}\n\n불편을 드려 죄송합니다. 감사합니다!",
"contentType": "text"
}
},
{
"id": "update_sheet_auto",
"type": "action",
"service": "Google Sheets",
"name": "자동 승인 상태 기록",
"config": {
"operation": "updateRow",
"spreadsheetId": "{{$env.REFUND_SHEET_ID}}",
"sheetName": "반품신청",
"rowNumber": "{{$json['rowIndex']}}",
"columns": {
"처리상태": "자동 승인",
"처리일시": "{{$now.format('YYYY-MM-DD HH:mm')}}"
}
}
},
{
"id": "alert_cs_complex",
"type": "action",
"service": "Slack",
"name": "복잡 케이스 CS팀 알림",
"config": {
"operation": "sendMessage",
"channel": "{{$env.CS_SLACK_CHANNEL}}",
"message": "🔍 반품·환불 검토 요청\n\n👤 고객명: {{$json['고객명']}}\n📦 주문번호: {{$json['주문번호']}}\n📅 주문일: {{$json['주문일']}} ({{$json['daysSinceOrder']}}일 경과)\n🔖 환불 사유: {{$json['환불사유']}}\n📂 개봉 여부: {{$json['개봉여부']}}\n\n⚠️ 자동 처리 불가 케이스입니다. 담당자 직접 확인이 필요합니다.\n👉 시트에서 확인: {{$env.REFUND_SHEET_URL}}"
}
},
{
"id": "send_pending_email",
"type": "action",
"service": "Gmail",
"name": "검토 중 안내 이메일",
"config": {
"operation": "sendEmail",
"to": "{{$json['이메일']}}",
"subject": "[환불 접수] 요청을 검토 중입니다",
"body": "안녕하세요, {{$json['고객명']}}님!\n\n반품·환불 요청이 정상 접수되었습니다. 📋\n\n접수 내용을 검토하여 영업일 기준 1~2일 이내에 담당자가 직접 연락 드리겠습니다.\n\n📦 주문번호: {{$json['주문번호']}}\n🔖 접수 사유: {{$json['환불사유']}}\n\n불편을 드려 죄송합니다. 빠르게 처리하겠습니다!\n{{$env.BRAND_NAME}} CS팀 드림",
"contentType": "text"
}
}
],
"edges": [
{
"from": "trigger_sheets",
"to": "parse_request"
},
{
"from": "parse_request",
"to": "check_case_type"
},
{
"from": "check_case_type",
"to": "send_auto_approval",
"branch": "true"
},
{
"from": "send_auto_approval",
"to": "update_sheet_auto"
},
{
"from": "check_case_type",
"to": "alert_cs_complex",
"branch": "false"
},
{
"from": "alert_cs_complex",
"to": "send_pending_email"
}
],
"tips": [
"단순 환불 기준(7일, 미개봉)은 Function 노드의 isSimpleCase 조건을 수정해 업종에 맞게 조정하세요.",
"반품 신청 폼에 사진 첨부 기능을 추가하면 파손·하자 여부를 CS팀이 더 빠르게 판단할 수 있어요.",
"자동 승인된 건은 Google Sheets에 '자동 승인' 상태로 기록해 월말 환불 집계 자료로 활용할 수 있어요."
],
"qrUrl": "www.koreaaitimes.com/books/n8n-vol2/recipe047"
}