From 5a3bfdd0bfe725ad332b35a809e7f258a34f1e46 Mon Sep 17 00:00:00 2001 From: happybell80 Date: Thu, 28 Aug 2025 21:00:39 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20Slack=20=EB=A9=94=EC=8B=9C=EC=A7=80=20?= =?UTF-8?q?=ED=8F=AC=EB=A7=B7=ED=8C=85=20=EA=B0=80=EC=9D=B4=EB=93=9C=20?= =?UTF-8?q?=EA=B0=95=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 로빙 철학 반영 브리핑 구조 추가 - 레벨업/스킬/아이템 메타포 적용 - Block Kit JSON 실제 사용법 명시 - 고급 브리핑 메시지 예시 추가 - ideas 폴더로 이동 --- .../250828_slack_message_formatting_guide.md | 152 ++++++++++++++---- 1 file changed, 124 insertions(+), 28 deletions(-) rename {research => ideas}/250828_slack_message_formatting_guide.md (52%) diff --git a/research/250828_slack_message_formatting_guide.md b/ideas/250828_slack_message_formatting_guide.md similarity index 52% rename from research/250828_slack_message_formatting_guide.md rename to ideas/250828_slack_message_formatting_guide.md index 2f765eb..f54c362 100644 --- a/research/250828_slack_message_formatting_guide.md +++ b/ideas/250828_slack_message_formatting_guide.md @@ -189,37 +189,107 @@ def markdown_to_mrkdwn(text): ## 7. 브리핑 메시지 실제 구현 -```python -def create_briefing_blocks(data): - blocks = [ +### 로빙 철학 반영 브리핑 구조 +1. **존재형 철학**: "동반자적 조언" 형식 +2. **시나리오 기반**: 우선순위·밤사이 처리·오늘의 제안 +3. **레벨업 요소**: 경험치/스탯 성장 알림 +4. **스킬/아이템**: API 아이템 장착, 스킬 실행 메타포 +5. **다층 모듈**: 윤리/감정 레이어 반영 + +### 고급 브리핑 Block Kit JSON +```json +{ + "blocks": [ + { + "type": "header", + "text": { + "type": "plain_text", + "text": "📊 2025-08-29 모닝 브리핑 - Level 12", + "emoji": true + } + }, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*우선순위 알림*\n1. *[긴급]* 09:00 투자사 미팅 - 슬라이드 7, 12, 15 검토 필요\n2. *[중요]* FDA 규제 변경 분석 보고서 초안 완료 (확인 요청)\n3. *[기회]* 경쟁사 CTO 퇴사 소식 - 인재 영입 검토" + } + }, + {"type": "divider"}, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*밤사이 수행*\n• 미국 파트너 이메일 3건 자동응답 _(신뢰 +0.2)_\n• 업계 뉴스 5건 요약 완료 _(시장분석 스킬 EXP +40)_\n• 내일 팀 미팅 어젠다 작성 완료 _(조율 스킬 성장)_" + } + }, + {"type": "divider"}, + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*오늘 제안*\n- 에너지 레벨 낮음 → 오후 미팅 하나 연기 권장\n- 새로 획득한 *데이터 시각화 API* 아이템 장착 가능 _(효율 +15%)_" + } + }, + {"type": "divider"}, + { + "type": "context", + "elements": [ { - "type": "header", - "text": {"type": "plain_text", "text": f"📅 {data['date']} 브리핑"} + "type": "mrkdwn", + "text": "*성장 알림*: EXP +36 (INT +0.1, AGI +0.2) | 다음 레벨까지 420/800" } - ] + ] + } + ] +} +``` + +### Python 구현 예시 +```python +def create_advanced_briefing(user_data, robeing_stats): + blocks = [] - # 이메일 섹션 - if data['emails']: - email_text = "*📧 받은 메일*\n" - for email in data['emails'][:5]: - priority = "🔴" if email['urgent'] else "⚪" - email_text += f"{priority} {email['subject']}\n" - - blocks.append({ - "type": "section", - "text": {"type": "mrkdwn", "text": email_text} - }) + # 헤더 with 레벨 + blocks.append({ + "type": "header", + "text": { + "type": "plain_text", + "text": f"📊 {user_data['date']} 브리핑 - Level {robeing_stats['level']}" + } + }) - # 구분선 - blocks.append({"type": "divider"}) + # 우선순위 알림 (시나리오 기반) + priority_text = "*우선순위 알림*\n" + for idx, task in enumerate(user_data['priorities'], 1): + priority_text += f"{idx}. *[{task['priority']}]* {task['content']}\n" - # 통계 blocks.append({ "type": "section", - "fields": [ - {"type": "mrkdwn", "text": f"*📊 레벨*\n{data['level']}"}, - {"type": "mrkdwn", "text": f"*⚡ 경험치*\n{data['exp']}"} - ] + "text": {"type": "mrkdwn", "text": priority_text} + }) + + # 밤사이 수행 (스킬 메타포) + night_text = "*밤사이 수행*\n" + for action in user_data['night_actions']: + skill_effect = f"_({action['skill']} {action['effect']})_" + night_text += f"• {action['description']} {skill_effect}\n" + + blocks.append({"type": "divider"}) + blocks.append({ + "type": "section", + "text": {"type": "mrkdwn", "text": night_text} + }) + + # 성장 알림 (게임적 요소) + growth_text = f"*성장 알림*: EXP +{robeing_stats['exp_gained']} " + growth_text += f"(INT +{robeing_stats['int_gain']}, AGI +{robeing_stats['agi_gain']}) " + growth_text += f"| 다음 레벨까지 {robeing_stats['current_exp']}/{robeing_stats['next_level_exp']}" + + blocks.append({"type": "divider"}) + blocks.append({ + "type": "context", + "elements": [{"type": "mrkdwn", "text": growth_text}] }) return blocks @@ -227,7 +297,32 @@ def create_briefing_blocks(data): --- -## 8. 주의사항 +## 8. Block Kit 사용 방법 + +### ⚠️ 중요: JSON은 API로만 적용됨 +- **Slack 채팅창에 JSON 붙여넣기**: ❌ 텍스트로만 표시됨 +- **Block Kit Builder**: ✅ 미리보기 가능 +- **API 호출 (chat.postMessage)**: ✅ 실제 적용 + +### Block Kit Builder 사용법 +1. https://api.slack.com/tools/block-kit-builder 접속 +2. JSON 붙여넣기 → 미리보기 확인 +3. 수정 후 복사 → API 코드에 활용 + +### API 호출 예시 +```python +import requests + +url = "https://slack.com/api/chat.postMessage" +headers = {"Authorization": f"Bearer {SLACK_BOT_TOKEN}"} +payload = { + "channel": "C12345678", # 또는 DM ID + "blocks": [ ... 위의 JSON blocks 배열 ... ] +} +response = requests.post(url, headers=headers, json=payload) +``` + +## 9. 주의사항 ### API 사용 시 - `text` 필드: 폴백용 (블록 미지원 클라이언트) @@ -246,8 +341,9 @@ def create_briefing_blocks(data): --- -## 참고 문서 -- [Block Kit Builder](https://app.slack.com/block-kit-builder) +## 10. 참고 문서 +- [Block Kit Builder](https://app.slack.com/block-kit-builder) - 실시간 미리보기 - [Message Formatting](https://api.slack.com/reference/surfaces/formatting) - [Block Kit Reference](https://api.slack.com/reference/block-kit) -- [mrkdwn Syntax](https://api.slack.com/reference/surfaces/formatting#basics) \ No newline at end of file +- [mrkdwn Syntax](https://api.slack.com/reference/surfaces/formatting#basics) +- [chat.postMessage API](https://api.slack.com/methods/chat.postMessage) \ No newline at end of file