fix: Slack API 문서 기반 정확한 정보로 수정

- Events API: 시간당 30,000건 (초당 ~8건)으로 정정
- 쓰레드: message.message_replied 이벤트 존재 명시
- im:write와 chat:write 역할 명확히 구분
- 슬래시 명령: Manifest API 등록 가능 추가
- response_url: 30분 내 최대 5회 명시
- Rate Limits: 메서드별 상이함 명시
This commit is contained in:
happybell80 2025-08-28 21:03:28 +09:00
parent 5a3bfdd0bf
commit 6d9b25ef02

View File

@ -54,7 +54,7 @@ Frontend(레벨3) → auth-server → OAuth 2.0 → 봇 토큰 저장
읽기: channels:read, groups:read, channels:history,
groups:history, im:history, mpim:history
이벤트: app_mentions:read, commands
쓰기: chat:write, im:write
쓰기: chat:write (메시지 전송), im:write (DM 개설)
사용자: users:read, users:read.email
```
3. `oauth.v2.access`로 bot_access_token 획득 → 암호화 저장
@ -69,12 +69,12 @@ Slack Event → rb8001 → DB → SSE/WebSocket → Frontend
1. Events API 구독
- Request URL: `rb8001/slack/events`
- 이벤트: `message.channels`, `message.groups`, `message.im`, `message.mpim`, `app_mention`
- 쓰레드: 별도 이벤트 없음, `thread_ts` 필드로 구분
- 쓰레드: `message.message_replied` 이벤트 존재하나 `thread_ts` 확인 권장
2. **3초 규칙**: challenge 검증 및 이벤트 ACK 3초 내 필수
3. 채널 타입: C(공개), G(비공개/그룹), D(DM)
4. conversation_logs 저장: team_id, channel_id, thread_ts
5. 초기 동기화: `conversations.history`로 백필
6. **Rate Limits**: 초당 30개 이벤트, Web API 분당 50-100회
6. **Rate Limits**: Events API 시간당 30,000건 (초당 ~8건), Web API는 메서드별 상이
### Phase 4: 명령 처리 (중기 1-2주)
```
@ -83,10 +83,10 @@ Slack → @robeing 또는 /robeing → rb8001 → 응답
**구현**:
1. 멘션: `app_mention` 이벤트 → `chat.postMessage` 응답
2. 슬래시 명령 (앱 설정에서 수동 등록 필요):
2. 슬래시 명령 (앱 설정 또는 Manifest API로 등록):
- `/robeing help`, `/robeing status`, `/robeing level`
- Request URL: `rb8001/slack/commands`
3. **3초 제한**: 즉시 200 OK 필수, 긴 작업은 response_url 사용
3. **응답 처리**: 3초 내 200 OK 필수, response_url로 30분 내 최대 5회 후속 응답 가능
4. 서명 검증: X-Slack-Signature, X-Slack-Request-Timestamp (5분 윈도)
5. **Rate Limits**: 메시지 전송 채널당 초당 1회 권장
@ -121,8 +121,8 @@ ALTER TABLE conversation_logs ADD COLUMN channel_type VARCHAR(20);
- **3초 규칙**: Events API/Slash Commands 모두 3초 내 ACK
- **채널 접근**: 봇이 채널 초대되어야 이벤트 수신
- **Rate Limits**:
- Events: 초당 30개
- Web API: 분당 50-100회
- Events: 시간당 30,000건 (초당 ~8건)
- Web API: 메서드별 상이 (chat.postMessage: 채널당 초당 1회)
- 메시지: 채널당 초당 1회
---