9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
5.6 KiB
5.6 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-slack-bot-development | Slack Bot Development | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
Slack Bot Development
매 한 줄
"매 Slack workspace 에 자동화/통합 logic 을 추가하는 app 개발". 매 2014 Slack API 출시, 매 2020 Bolt SDK 정식, 매 2026 현재 Block Kit 2.0 + AI Assistant App + Slack Connect 가 표준. Event-driven + interactive UI 의 양축.
매 핵심
매 App 구성요소
- Bot user: identity for messaging.
- Event subscriptions: 매 message, reaction, app_mention 등.
- Slash commands:
/deploy,/oncall. - Interactive components: buttons, modals, select menus.
- Block Kit: rich UI JSON.
- OAuth scopes:
chat:write,channels:read, etc.
매 host 모델
- HTTP (request URL): AWS Lambda, Cloudflare Worker.
- Socket Mode: WebSocket — internal tools, no public URL.
매 응용
- CI/CD notification + interactive deploy approval.
- On-call escalation bot.
- AI assistant (RAG over Slack history).
- Survey / standup automation.
- Customer support triage.
💻 패턴
Bolt SDK basic
import { App } from '@slack/bolt';
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
signingSecret: process.env.SLACK_SIGNING_SECRET,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
});
app.message('hello', async ({ message, say }) => {
await say(`Hi <@${message.user}>!`);
});
await app.start();
Slash command + modal
app.command('/deploy', async ({ ack, body, client }) => {
await ack();
await client.views.open({
trigger_id: body.trigger_id,
view: {
type: 'modal',
callback_id: 'deploy_modal',
title: { type: 'plain_text', text: 'Deploy' },
submit: { type: 'plain_text', text: 'Go' },
blocks: [
{ type: 'input', block_id: 'env',
element: { type: 'static_select', action_id: 'sel',
options: [{text:{type:'plain_text',text:'staging'},value:'stg'}]},
label: { type: 'plain_text', text: 'Environment' } }
]
}
});
});
app.view('deploy_modal', async ({ ack, view, client, body }) => {
await ack();
const env = view.state.values.env.sel.selected_option!.value;
await triggerDeploy(env);
await client.chat.postMessage({ channel: body.user.id, text: `Deploying ${env}...` });
});
Event subscription (app_mention)
app.event('app_mention', async ({ event, client }) => {
const ai = await callLLM(event.text);
await client.chat.postMessage({
channel: event.channel,
thread_ts: event.ts,
blocks: [{ type: 'section', text: { type: 'mrkdwn', text: ai }}],
});
});
Interactive button → action
app.action('approve_deploy', async ({ ack, body, client }) => {
await ack();
const action = body as any;
await client.chat.update({
channel: action.channel.id,
ts: action.message.ts,
text: `Approved by <@${action.user.id}>`,
blocks: []
});
await triggerDeploy(action.actions[0].value);
});
Block Kit message
const blocks = [
{ type: 'header', text: { type: 'plain_text', text: '🚨 Production Alert' }},
{ type: 'section', fields: [
{ type: 'mrkdwn', text: '*Service:* api' },
{ type: 'mrkdwn', text: '*Severity:* P1' },
]},
{ type: 'actions', elements: [
{ type: 'button', text: {type:'plain_text',text:'Ack'}, action_id: 'ack', style: 'primary' },
{ type: 'button', text: {type:'plain_text',text:'Page'}, action_id: 'page', style: 'danger' },
]}
];
await client.chat.postMessage({ channel: '#alerts', blocks, text: 'Alert' });
Signature verification (HTTP mode)
import crypto from 'crypto';
function verifySlack(req: Request, secret: string): boolean {
const ts = req.headers.get('x-slack-request-timestamp')!;
const sig = req.headers.get('x-slack-signature')!;
const body = req.body;
const base = `v0:${ts}:${body}`;
const expected = `v0=${crypto.createHmac('sha256', secret).update(base).digest('hex')}`;
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(sig));
}
Rate limit handling
app.error(async ({ error, ...rest }) => {
if (error.code === 'slack_webapi_rate_limited') {
await new Promise(r => setTimeout(r, error.retryAfter * 1000));
return;
}
console.error(error);
});
매 결정 기준
| 상황 | Approach |
|---|---|
| Internal tool, no public URL | Socket Mode |
| Public app distribution | HTTP + signed requests |
| High-volume events | Lambda/Workers + queue |
| Stateful conversation | Bolt + Redis state |
| AI assistant | Anthropic SDK + Bolt event handler |
기본값: Bolt-js + Socket Mode for internal, HTTP + Cloudflare Workers for public.
🔗 Graph
🤖 LLM 활용
언제: Block Kit JSON 생성, slash command boilerplate, signature verify code. 언제 X: workspace OAuth flow debugging (회사 별 admin policy 가 다양).
❌ 안티패턴
- No signature verify: spoofed requests.
- Sync long-running: 3s timeout — use ack() + async work.
- Hard-coded channel ID: env var 의 X.
- No retry on send: rate limit 시 message loss.
🧪 검증 / 중복
- Verified (Slack API docs 2026, Bolt-js v3).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Slack bot 2026 patterns |