workhub-bot-sdk
v0.3.0
Published
Workhub Bot SDK — Build bots for the Workhub collaboration platform
Maintainers
Readme
workhub-bot-sdk
Workhub 협업 플랫폼용 TypeScript/Node.js Bot SDK
설치
npm install workhub-bot-sdk빠른 시작
import { WorkhubBot } from "workhub-bot-sdk";
const bot = new WorkhubBot({
baseUrl: "https://your-workhub.com",
apiKey: "whb_xxxxxxxx_live_xxxxxxxxxxxxxxxx",
});
// 메시지 보내기
await bot.sendMessage({ channel_id: "...", content: "안녕하세요!" });
// 태스크 생성
await bot.createTask({ topic_id: "...", title: "새 태스크", priority: "high" });
// 검색
const result = await bot.search({ query: "배포", type: "tasks" });
console.log(`${result.total}건 검색됨`);웹훅 이벤트 수신
import { WorkhubBot, WebhookServer } from "workhub-bot-sdk";
const bot = new WorkhubBot({ baseUrl: "http://localhost:8080", apiKey: "whb_xxx" });
const webhook = new WebhookServer({ port: 9000, secret: "your-secret" });
webhook.on("message.created", async (event) => {
await bot.sendMessage({
channel_id: event.data.channel_id as string,
content: "수신 확인!",
});
});
webhook.start();API 레퍼런스
인증 / 세션
| 메서드 | 설명 |
|--------|------|
| authenticate(options?) | 봇 인증 (웹훅 URL / 이벤트 등록) |
| initialize() | MCP 세션 초기화 |
| listTools() | 사용 가능한 MCP 도구 목록 |
| ping() | 서버 헬스체크 |
메시지
| 메서드 | 설명 |
|--------|------|
| sendMessage(params) | 메시지 발송 |
| readMessages(params) | 메시지 읽기 |
| addReaction(messageId, emoji) | 반응 추가 (v0.2.0) |
| removeReaction(messageId, emoji) | 반응 제거 (v0.2.0) |
| getReactions(messageId) | 반응 목록 조회 (v0.2.0) |
| pinMessage(messageId) | 메시지 고정 (v0.2.0) |
| unpinMessage(messageId) | 고정 해제 (v0.2.0) |
| listThread(messageId) | 스레드 답글 조회 (v0.2.0) |
채널
| 메서드 | 설명 |
|--------|------|
| listChannels(params) | 채널 목록 |
| listChannelMembers(channelId) | 채널 멤버 조회 |
| listChannelFiles(channelId, filter?) | 채널 파일 목록 |
| createChannel(params) | 채널 생성 (v0.2.0) |
| updateChannel(channelId, params) | 채널 수정 (v0.2.0) |
| deleteChannel(channelId) | 채널 삭제 (v0.2.0) |
| joinChannel(channelId) | 채널 참여 (v0.2.0) |
| leaveChannel(channelId) | 채널 나가기 (v0.2.0) |
| addChannelMember(channelId, userId) | 멤버 추가 (v0.2.0) |
| removeChannelMember(channelId, userId) | 멤버 제거 (v0.2.0) |
북마크
| 메서드 | 설명 |
|--------|------|
| createBookmark(channelId, messageId) | 북마크 생성 |
| deleteBookmark(channelId, messageId) | 북마크 제거 |
| listBookmarks(channelId, filter?) | 북마크 목록 |
DM
| 메서드 | 설명 |
|--------|------|
| getDMRoom(userId) | 1:1 DM 방 조회/생성 |
| createDMRoom(params) | 1:1/그룹 DM 방 생성 (v0.2.0) |
| listDMRooms() | DM 방 목록 (v0.2.0) |
| sendDMMessage(roomId, content) | DM 메시지 발송 (v0.2.0) |
| listDMMessages(roomId, options?) | DM 메시지 목록 (v0.2.0) |
| leaveDMRoom(roomId) | DM 방 나가기 (v0.2.0) |
태스크
| 메서드 | 설명 |
|--------|------|
| createTask(params) | 태스크 생성 |
| updateTask(params) | 태스크 수정 |
| listTasks(params) | 태스크 목록 |
| updateTaskStatus(taskId, status) | 상태 변경 (todo/in_progress/review/done) (v0.2.0) |
| setTaskDependencies(taskId, dependsOn) | 선행 태스크 설정 (v0.2.0) |
| deleteTask(taskId) | 태스크 삭제 (v0.2.0) |
| addTaskAssignee(taskId, userId) | 담당자 추가 (v0.2.0) |
| removeTaskAssignee(taskId, userId) | 담당자 제거 (v0.2.0) |
작업일지 (Work Log)
| 메서드 | 설명 |
|--------|------|
| listWorkLogs(params?) | 작업일지 조회 (v0.2.0) |
| createWorkLog(params) | 작업일지 작성 (v0.2.0) |
| deleteWorkLog(workLogId) | 작업일지 삭제 (v0.2.0) |
Topic / Project
| 메서드 | 설명 |
|--------|------|
| listTopics(projectId) | 토픽 목록 (v0.2.0) |
| updateTopicStatus(topicId, status) | 토픽 상태 변경 (v0.2.0) |
| deleteTopic(topicId, confirmName) | 토픽 삭제 (v0.2.0) |
| listProjects(options?) | 프로젝트 목록 (v0.2.0) |
| getProject(projectId) | 프로젝트 상세 (v0.2.0) |
User / Organization
| 메서드 | 설명 |
|--------|------|
| getUser(params) | 사용자 정보 |
| listUsers(params) | 사용자 목록 |
| getMe() | 현재 인증 컨텍스트 (v0.2.0) |
| listDepartments() | 부서 목록 (v0.2.0) |
알림
| 메서드 | 설명 |
|--------|------|
| listNotifications(options?) | 알림 목록 (v0.2.0) |
| markNotificationRead(notificationId) | 알림 읽음 처리 (v0.2.0) |
| getUnreadCount() | 읽지 않은 알림 수 (v0.2.0) |
검색 / 멘션 / 해시태그
| 메서드 | 설명 |
|--------|------|
| search(params) | 통합 검색 |
| searchMentions(params) | 멘션 타겟 검색 |
| searchHashtags(query) | 해시태그 검색 |
| getHashtagPreview(type, id) | 해시태그 미리보기 |
파일
| 메서드 | 설명 |
|--------|------|
| uploadFile(file, filename, options?) | 파일 업로드 |
| downloadFile(fileId) | 파일 다운로드 |
슬래시 커맨드
| 메서드 | 설명 |
|--------|------|
| listSlashCommands() | 슬래시 커맨드 목록 |
| executeSlashCommand(params) | 커맨드 실행 |
봇 전용
| 메서드 | 설명 |
|--------|------|
| listBotCommands(botId) | 봇 커맨드 목록 |
| createBotCommand(botId, params) | 봇 커맨드 등록 |
| deleteBotCommand(botId, commandName) | 봇 커맨드 삭제 |
| createSchedule(params) | 스케줄 생성 |
| listSchedules(botId, options?) | 스케줄 목록 |
| updateSchedule(id, params) | 스케줄 수정 |
| deleteSchedule(id) | 스케줄 삭제 |
인터랙티브 메시지
| 메서드 | 설명 |
|--------|------|
| sendInteractiveMessage(params) | 인터랙티브 메시지 발송 |
| recordAction(messageId, params) | 액션 기록 |
| getMessageActions(messageId) | 액션 응답 조회 |
예제
태스크 완료 처리 + 작업일지 기록
// 상태를 done으로 변경
await bot.updateTaskStatus(taskId, "done");
// 작업일지 작성
await bot.createWorkLog({
task_id: taskId,
work_date: "2026-04-18",
start_time: "09:00",
end_time: "18:00",
memo: "구현 완료",
});채널 생성 + 멤버 초대 + 환영 메시지
const ch = await bot.createChannel({
name: "프로젝트-A",
description: "A 프로젝트 전용",
channel_type: "general",
});
await bot.addChannelMember(ch.id as string, userId);
await bot.sendMessage({
channel_id: ch.id as string,
content: "환영합니다! 🎉",
});메시지 반응 + 고정
await bot.addReaction(messageId, "👍");
await bot.pinMessage(messageId);변경 이력
CHANGELOG.md 참고.
라이선스
MIT
