docs: Slack 메시지 포맷팅 가이드 강화

- 로빙 철학 반영 브리핑 구조 추가
- 레벨업/스킬/아이템 메타포 적용
- Block Kit JSON 실제 사용법 명시
- 고급 브리핑 메시지 예시 추가
- ideas 폴더로 이동
This commit is contained in:
happybell80 2025-08-28 21:00:39 +09:00
parent dc0232ae63
commit 5a3bfdd0bf

View File

@ -189,37 +189,107 @@ def markdown_to_mrkdwn(text):
## 7. 브리핑 메시지 실제 구현 ## 7. 브리핑 메시지 실제 구현
```python ### 로빙 철학 반영 브리핑 구조
def create_briefing_blocks(data): 1. **존재형 철학**: "동반자적 조언" 형식
blocks = [ 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", "type": "mrkdwn",
"text": {"type": "plain_text", "text": f"📅 {data['date']} 브리핑"} "text": "*성장 알림*: EXP +36 (INT +0.1, AGI +0.2) 다음 레벨까지 420/800"
} }
] ]
}
]
}
```
### Python 구현 예시
```python
def create_advanced_briefing(user_data, robeing_stats):
blocks = []
# 이메일 섹션 # 헤더 with 레벨
if data['emails']: blocks.append({
email_text = "*📧 받은 메일*\n" "type": "header",
for email in data['emails'][:5]: "text": {
priority = "🔴" if email['urgent'] else "⚪" "type": "plain_text",
email_text += f"{priority} {email['subject']}\n" "text": f"📊 {user_data['date']} 브리핑 - Level {robeing_stats['level']}"
}
blocks.append({ })
"type": "section",
"text": {"type": "mrkdwn", "text": email_text}
})
# 구분선 # 우선순위 알림 (시나리오 기반)
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({ blocks.append({
"type": "section", "type": "section",
"fields": [ "text": {"type": "mrkdwn", "text": priority_text}
{"type": "mrkdwn", "text": f"*📊 레벨*\n{data['level']}"}, })
{"type": "mrkdwn", "text": f"*⚡ 경험치*\n{data['exp']}"}
] # 밤사이 수행 (스킬 메타포)
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 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 사용 시 ### API 사용 시
- `text` 필드: 폴백용 (블록 미지원 클라이언트) - `text` 필드: 폴백용 (블록 미지원 클라이언트)
@ -246,8 +341,9 @@ def create_briefing_blocks(data):
--- ---
## 참고 문서 ## 10. 참고 문서
- [Block Kit Builder](https://app.slack.com/block-kit-builder) - [Block Kit Builder](https://app.slack.com/block-kit-builder) - 실시간 미리보기
- [Message Formatting](https://api.slack.com/reference/surfaces/formatting) - [Message Formatting](https://api.slack.com/reference/surfaces/formatting)
- [Block Kit Reference](https://api.slack.com/reference/block-kit) - [Block Kit Reference](https://api.slack.com/reference/block-kit)
- [mrkdwn Syntax](https://api.slack.com/reference/surfaces/formatting#basics) - [mrkdwn Syntax](https://api.slack.com/reference/surfaces/formatting#basics)
- [chat.postMessage API](https://api.slack.com/methods/chat.postMessage)