docs: 2단계 JSONL 3분할 리스트 + Slack Direct API 워크플로우
- scripts/stage2_lists/: 증분 인덱싱 대상 JSONL 3분할 (전체 5,038 / 제외 2,709 / 실행 2,329) - workflow/02_skills/slack_direct_api_send.md: DB 봇 토큰 → Slack API 직접 호출 경로 문서화 (260323 실측) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
35e0cb21e7
commit
4b0a464b5b
5038
scripts/stage2_lists/all_candidates.jsonl
Normal file
5038
scripts/stage2_lists/all_candidates.jsonl
Normal file
File diff suppressed because it is too large
Load Diff
2709
scripts/stage2_lists/excluded.jsonl
Normal file
2709
scripts/stage2_lists/excluded.jsonl
Normal file
File diff suppressed because it is too large
Load Diff
2329
scripts/stage2_lists/targets.jsonl
Normal file
2329
scripts/stage2_lists/targets.jsonl
Normal file
File diff suppressed because it is too large
Load Diff
86
workflow/02_skills/slack_direct_api_send.md
Normal file
86
workflow/02_skills/slack_direct_api_send.md
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
# Slack Direct API 메시지 전송 워크플로우
|
||||||
|
|
||||||
|
## 목적
|
||||||
|
|
||||||
|
에이전트(23 클로드 등)가 Slack API를 직접 호출하여 특정 워크스페이스 채널에 메시지를 보내는 경로.
|
||||||
|
n8n 브릿지(`skill_slack_send_message_bridge`)와 별개로, DB에 저장된 봇 토큰을 사용하여 직접 전송한다.
|
||||||
|
|
||||||
|
## 실측 경로 (260323 검증)
|
||||||
|
|
||||||
|
```
|
||||||
|
1. DB에서 봇 토큰 조회
|
||||||
|
└─ slack_workspace 테이블: slack_team_id → bot_token
|
||||||
|
|
||||||
|
2. Slack API 호출
|
||||||
|
└─ POST https://slack.com/api/chat.postMessage
|
||||||
|
Headers: Authorization: Bearer {bot_token}
|
||||||
|
Body: { channel, text }
|
||||||
|
|
||||||
|
3. 응답 확인
|
||||||
|
└─ ok: true → 전송 성공
|
||||||
|
└─ ok: false → error 필드 확인
|
||||||
|
```
|
||||||
|
|
||||||
|
## 워크스페이스별 봇 토큰 조회
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT slack_team_id, bot_token, is_active
|
||||||
|
FROM slack_workspace;
|
||||||
|
```
|
||||||
|
|
||||||
|
| 워크스페이스 | slack_team_id | 용도 |
|
||||||
|
|-------------|---------------|------|
|
||||||
|
| 디지털비징_로빙 | T0925SXPS4D | 내부 테스트 |
|
||||||
|
| 컴퍼니엑스 | T09C98KB933 | 실서비스 (Company X) |
|
||||||
|
|
||||||
|
## 채널 ID 확인
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 봇이 접근 가능한 DM 목록
|
||||||
|
curl -s -H "Authorization: Bearer {bot_token}" \
|
||||||
|
"https://slack.com/api/conversations.list?types=im,mpim&limit=50"
|
||||||
|
|
||||||
|
# 특정 채널 최근 메시지
|
||||||
|
curl -s -H "Authorization: Bearer {bot_token}" \
|
||||||
|
"https://slack.com/api/conversations.history?channel={channel_id}&limit=5"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 메시지 전송
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -s -X POST \
|
||||||
|
-H "Authorization: Bearer {bot_token}" \
|
||||||
|
-H "Content-Type: application/json; charset=utf-8" \
|
||||||
|
-d '{
|
||||||
|
"channel": "{channel_id}",
|
||||||
|
"text": "메시지 내용"
|
||||||
|
}' \
|
||||||
|
"https://slack.com/api/chat.postMessage"
|
||||||
|
```
|
||||||
|
|
||||||
|
## 주의사항
|
||||||
|
|
||||||
|
1. **봇 토큰으로 보내면 발신자가 Robeing** — 봇이 자기 자신에게 보내는 꼴이라 로빙이 응답하지 않음
|
||||||
|
2. **사용자에게 메시지를 보내려면** 사용자의 user_id로 `conversations.open` 후 DM 채널 생성 필요
|
||||||
|
3. **워크스페이스가 다르면 토큰도 다름** — 반드시 대상 워크스페이스의 bot_token 사용
|
||||||
|
4. **channel_not_found 에러** — 봇이 해당 채널에 접근 권한이 없거나, 다른 워크스페이스의 채널 ID를 사용한 경우
|
||||||
|
|
||||||
|
## 260323 실측 결과
|
||||||
|
|
||||||
|
| 시도 | 워크스페이스 | 채널 | 결과 |
|
||||||
|
|------|-------------|------|------|
|
||||||
|
| 1차 | 디지털비징_로빙 (T0925SXPS4D) | D09DWLAV88Y | channel_not_found (워크스페이스 불일치) |
|
||||||
|
| 2차 | 디지털비징_로빙 | D0935RJ8LLQ | 전송 성공 (CTO DM) — 단, 로빙 응답 없음 (봇→봇) |
|
||||||
|
| 3차 | 컴퍼니엑스 (T09C98KB933) | D09DWLAV88Y | 전송 성공 — 로빙 응답함 (grounding 질문만 답, 나머지 무시) |
|
||||||
|
|
||||||
|
## 로빙 응답 분석 (260323)
|
||||||
|
|
||||||
|
질문 6개 중 "컴퍼니엑스가 뭐하는 회사야?"만 답변. 나머지 5개(시간/날짜/이름/산수/대화이력) 전부 무시.
|
||||||
|
- 원인: "컴퍼니엑스" 마커에 grounding이 트리거되면 RAG 결과만 반환하고 나머지 질문 드랍
|
||||||
|
- 참고: `[24]_260323_로빙교육_못하는것3가지.md`, `[24]_260323_로빙교육_못하는것_2차진단.md`
|
||||||
|
|
||||||
|
## 관련 문서
|
||||||
|
|
||||||
|
- [skill_slack_send_message_bridge](./skill_slack_send_message_bridge.md) — n8n 브릿지 경로
|
||||||
|
- [slack_basic_dialogue](../01_conversation/slack_basic_dialogue.md) — 슬랙 대화 워크플로우
|
||||||
|
- [companyx_grounding_pipeline](../03_rag/companyx_grounding_pipeline.md) — grounding 라우팅
|
||||||
Loading…
x
Reference in New Issue
Block a user