Files
2nd/10_Wiki/Topics/Domain_Programming/Backend/Slack-Bot-Development.md
T
Antigravity Agent c24165b8bc refactor(topics): 멀티 에이전트용 지식 재편 — _Common(공통 기본기) + Domain_* 구조
에이전트 8종(대화형/프로그래머 C·S/디자이너/설계자/기획자/QA/PD/PM)에게
[공통 기본 능력 + 롤별 Specialty] 2층으로 지식을 주입하기 위한 재분류.
문서 내용·포맷은 무수정, 폴더 이동만 (6,372개 문서 수 보존 확인).

- Topic_Programming → Domain_Programming (내부 구조 보존)
- Topic_Graphic → Domain_Design
- Topic_Business → Domain_Product
- Topic_General → Domain_General
- _Common 신설: Math(구 Topic_Math_Specialty), Reasoning(구 General/From_Thinking & Reasoning),
  Reasoning_Creativity(구 General/From_창의성), Communication(Poetic_Blog_Writing + From_writing)
- 타 도메인의 From_* 폴더는 유지 (출처 표기일 뿐, 이미 도메인에 맞게 분류된 문서)
- 빈 폴더 정리 (memory/procedures)
- 에이전트→폴더 매핑은 workspace의 .astra/agent-knowledge-map.json (9개 에이전트)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-11 11:05:56 +09:00

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
Slack App
Slack Integration
Bolt SDK
none A 0.9 applied
slack
bot
integration
automation
2026-05-10 pending
language framework
typescript bolt-js

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.

매 응용

  1. CI/CD notification + interactive deploy approval.
  2. On-call escalation bot.
  3. AI assistant (RAG over Slack history).
  4. Survey / standup automation.
  5. 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