workhub-bot-sdk 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- workhub_bot_sdk-0.1.0/.gitignore +5 -0
- workhub_bot_sdk-0.1.0/PKG-INFO +88 -0
- workhub_bot_sdk-0.1.0/README.md +66 -0
- workhub_bot_sdk-0.1.0/examples/echo_bot.py +37 -0
- workhub_bot_sdk-0.1.0/examples/task_bot.py +45 -0
- workhub_bot_sdk-0.1.0/pyproject.toml +32 -0
- workhub_bot_sdk-0.1.0/workhub_bot_sdk/__init__.py +64 -0
- workhub_bot_sdk-0.1.0/workhub_bot_sdk/client.py +760 -0
- workhub_bot_sdk-0.1.0/workhub_bot_sdk/types.py +343 -0
- workhub_bot_sdk-0.1.0/workhub_bot_sdk/webhook.py +133 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: workhub-bot-sdk
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Workhub Bot SDK — Build bots for the Workhub collaboration platform
|
|
5
|
+
Author: Workhub Team
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: bot,collaboration,mcp,sdk,workhub
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
20
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# workhub-bot-sdk
|
|
24
|
+
|
|
25
|
+
Workhub 협업 플랫폼용 Python Bot SDK
|
|
26
|
+
|
|
27
|
+
## 설치
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install workhub-bot-sdk
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## 빠른 시작
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
from workhub_bot_sdk import WorkhubBot
|
|
37
|
+
|
|
38
|
+
bot = WorkhubBot(
|
|
39
|
+
base_url="https://your-workhub.com",
|
|
40
|
+
api_key="whb_xxxxxxxx_live_xxxxxxxxxxxxxxxx",
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
# 메시지 보내기
|
|
44
|
+
bot.send_message(channel_id="...", content="안녕하세요!")
|
|
45
|
+
|
|
46
|
+
# 태스크 생성
|
|
47
|
+
bot.create_task(topic_id="...", title="새 태스크", priority="high")
|
|
48
|
+
|
|
49
|
+
# 검색
|
|
50
|
+
result = bot.search("배포", type="tasks")
|
|
51
|
+
print(f"{result.total}건 검색됨")
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## 웹훅 이벤트 수신
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from workhub_bot_sdk import WorkhubBot, WebhookServer
|
|
58
|
+
|
|
59
|
+
bot = WorkhubBot(base_url="http://localhost:8080", api_key="whb_xxx")
|
|
60
|
+
webhook = WebhookServer(port=9000, secret="your-secret")
|
|
61
|
+
|
|
62
|
+
@webhook.on("message.created")
|
|
63
|
+
def on_message(event):
|
|
64
|
+
bot.send_message(channel_id=event.data["channel_id"], content="수신 확인!")
|
|
65
|
+
|
|
66
|
+
webhook.start()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## API
|
|
70
|
+
|
|
71
|
+
| 메서드 | 설명 |
|
|
72
|
+
|--------|------|
|
|
73
|
+
| `send_message()` | 메시지 발송 |
|
|
74
|
+
| `read_messages()` | 메시지 읽기 |
|
|
75
|
+
| `list_channels()` | 채널/프로젝트/토픽 목록 |
|
|
76
|
+
| `create_task()` | 태스크 생성 |
|
|
77
|
+
| `update_task()` | 태스크 수정 |
|
|
78
|
+
| `list_tasks()` | 태스크 목록 |
|
|
79
|
+
| `search()` | 통합 검색 |
|
|
80
|
+
| `get_user()` | 사용자 정보 |
|
|
81
|
+
| `list_users()` | 사용자 목록 |
|
|
82
|
+
| `upload_file()` | 파일 업로드 |
|
|
83
|
+
| `download_file()` | 파일 다운로드 |
|
|
84
|
+
| `authenticate()` | API key 인증 확인 |
|
|
85
|
+
|
|
86
|
+
## 라이선스
|
|
87
|
+
|
|
88
|
+
MIT
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# workhub-bot-sdk
|
|
2
|
+
|
|
3
|
+
Workhub 협업 플랫폼용 Python Bot SDK
|
|
4
|
+
|
|
5
|
+
## 설치
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install workhub-bot-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 빠른 시작
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from workhub_bot_sdk import WorkhubBot
|
|
15
|
+
|
|
16
|
+
bot = WorkhubBot(
|
|
17
|
+
base_url="https://your-workhub.com",
|
|
18
|
+
api_key="whb_xxxxxxxx_live_xxxxxxxxxxxxxxxx",
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
# 메시지 보내기
|
|
22
|
+
bot.send_message(channel_id="...", content="안녕하세요!")
|
|
23
|
+
|
|
24
|
+
# 태스크 생성
|
|
25
|
+
bot.create_task(topic_id="...", title="새 태스크", priority="high")
|
|
26
|
+
|
|
27
|
+
# 검색
|
|
28
|
+
result = bot.search("배포", type="tasks")
|
|
29
|
+
print(f"{result.total}건 검색됨")
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## 웹훅 이벤트 수신
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from workhub_bot_sdk import WorkhubBot, WebhookServer
|
|
36
|
+
|
|
37
|
+
bot = WorkhubBot(base_url="http://localhost:8080", api_key="whb_xxx")
|
|
38
|
+
webhook = WebhookServer(port=9000, secret="your-secret")
|
|
39
|
+
|
|
40
|
+
@webhook.on("message.created")
|
|
41
|
+
def on_message(event):
|
|
42
|
+
bot.send_message(channel_id=event.data["channel_id"], content="수신 확인!")
|
|
43
|
+
|
|
44
|
+
webhook.start()
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## API
|
|
48
|
+
|
|
49
|
+
| 메서드 | 설명 |
|
|
50
|
+
|--------|------|
|
|
51
|
+
| `send_message()` | 메시지 발송 |
|
|
52
|
+
| `read_messages()` | 메시지 읽기 |
|
|
53
|
+
| `list_channels()` | 채널/프로젝트/토픽 목록 |
|
|
54
|
+
| `create_task()` | 태스크 생성 |
|
|
55
|
+
| `update_task()` | 태스크 수정 |
|
|
56
|
+
| `list_tasks()` | 태스크 목록 |
|
|
57
|
+
| `search()` | 통합 검색 |
|
|
58
|
+
| `get_user()` | 사용자 정보 |
|
|
59
|
+
| `list_users()` | 사용자 목록 |
|
|
60
|
+
| `upload_file()` | 파일 업로드 |
|
|
61
|
+
| `download_file()` | 파일 다운로드 |
|
|
62
|
+
| `authenticate()` | API key 인증 확인 |
|
|
63
|
+
|
|
64
|
+
## 라이선스
|
|
65
|
+
|
|
66
|
+
MIT
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Echo bot example — replies to every message with the same content."""
|
|
2
|
+
|
|
3
|
+
from workhub_bot_sdk import WorkhubBot, WebhookServer, WebhookEvent
|
|
4
|
+
|
|
5
|
+
# 1. Initialize the bot client
|
|
6
|
+
bot = WorkhubBot(
|
|
7
|
+
base_url="http://localhost:8080",
|
|
8
|
+
api_key="whb_xxxxxxxx_live_xxxxxxxxxxxxxxxx", # Replace with your API key
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
# 2. Set up webhook listener for incoming events
|
|
12
|
+
webhook = WebhookServer(port=9000, secret="your-webhook-secret")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@webhook.on("message.created")
|
|
16
|
+
def on_message(event: WebhookEvent):
|
|
17
|
+
"""Echo back the received message."""
|
|
18
|
+
data = event.data
|
|
19
|
+
content = data.get("content", "")
|
|
20
|
+
channel_id = data.get("channel_id")
|
|
21
|
+
|
|
22
|
+
# Don't echo bot's own messages
|
|
23
|
+
sender_type = data.get("sender_type", "")
|
|
24
|
+
if sender_type == "bot":
|
|
25
|
+
return
|
|
26
|
+
|
|
27
|
+
if channel_id and content:
|
|
28
|
+
bot.send_message(
|
|
29
|
+
channel_id=channel_id,
|
|
30
|
+
content=f"🤖 Echo: {content}",
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
if __name__ == "__main__":
|
|
35
|
+
print("Echo bot starting...")
|
|
36
|
+
print("Listening for webhook events on :9000/webhook")
|
|
37
|
+
webhook.start()
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"""Task management bot example — creates tasks from chat messages."""
|
|
2
|
+
|
|
3
|
+
from workhub_bot_sdk import WorkhubBot
|
|
4
|
+
|
|
5
|
+
bot = WorkhubBot(
|
|
6
|
+
base_url="http://localhost:8080",
|
|
7
|
+
api_key="whb_xxxxxxxx_live_xxxxxxxxxxxxxxxx",
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def main():
|
|
12
|
+
# Verify connection
|
|
13
|
+
info = bot.authenticate()
|
|
14
|
+
print(f"Connected as bot: {info.bot_id} (org: {info.org_id})")
|
|
15
|
+
print(f"Scopes: {info.scopes}")
|
|
16
|
+
|
|
17
|
+
# List available tools
|
|
18
|
+
tools = bot.list_tools()
|
|
19
|
+
print(f"\nAvailable MCP tools ({len(tools)}):")
|
|
20
|
+
for tool in tools:
|
|
21
|
+
print(f" - {tool['name']}: {tool.get('description', '')}")
|
|
22
|
+
|
|
23
|
+
# List channels to find a topic
|
|
24
|
+
print("\n--- Channels ---")
|
|
25
|
+
channels = bot.list_channels(type="topics")
|
|
26
|
+
print(channels)
|
|
27
|
+
|
|
28
|
+
# Search for existing tasks
|
|
29
|
+
print("\n--- Search ---")
|
|
30
|
+
result = bot.search("배포", type="tasks")
|
|
31
|
+
print(f"Found {result.total} results")
|
|
32
|
+
print(result.raw_text)
|
|
33
|
+
|
|
34
|
+
# Create a task (uncomment and set topic_id)
|
|
35
|
+
# task_result = bot.create_task(
|
|
36
|
+
# topic_id="your-topic-uuid",
|
|
37
|
+
# title="SDK에서 생성한 태스크",
|
|
38
|
+
# priority="high",
|
|
39
|
+
# description="Python SDK 테스트 태스크입니다.",
|
|
40
|
+
# )
|
|
41
|
+
# print(f"\nCreated task: {task_result}")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
if __name__ == "__main__":
|
|
45
|
+
main()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "workhub-bot-sdk"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Workhub Bot SDK — Build bots for the Workhub collaboration platform"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Workhub Team" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["workhub", "bot", "sdk", "mcp", "collaboration"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = ["pytest", "pytest-cov", "ruff"]
|
|
29
|
+
|
|
30
|
+
[tool.ruff]
|
|
31
|
+
target-version = "py310"
|
|
32
|
+
line-length = 100
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Workhub Bot SDK for Python."""
|
|
2
|
+
|
|
3
|
+
from .client import WorkhubBot
|
|
4
|
+
from .types import (
|
|
5
|
+
Bookmark,
|
|
6
|
+
BookmarkMessage,
|
|
7
|
+
BotCommand,
|
|
8
|
+
BotInfo,
|
|
9
|
+
BotSchedule,
|
|
10
|
+
Channel,
|
|
11
|
+
ChannelFile,
|
|
12
|
+
ChannelFileListResponse,
|
|
13
|
+
ChannelMemberInfo,
|
|
14
|
+
CommandDef,
|
|
15
|
+
DMRoom,
|
|
16
|
+
DMRoomMember,
|
|
17
|
+
ExecuteCommandResult,
|
|
18
|
+
HashtagPreview,
|
|
19
|
+
HashtagTarget,
|
|
20
|
+
InteractiveAction,
|
|
21
|
+
InteractiveMessageResult,
|
|
22
|
+
MentionTarget,
|
|
23
|
+
Message,
|
|
24
|
+
MessageActionResponse,
|
|
25
|
+
Project,
|
|
26
|
+
SearchResult,
|
|
27
|
+
Task,
|
|
28
|
+
Topic,
|
|
29
|
+
User,
|
|
30
|
+
WebhookEvent,
|
|
31
|
+
)
|
|
32
|
+
from .webhook import WebhookServer
|
|
33
|
+
|
|
34
|
+
__version__ = "0.1.0"
|
|
35
|
+
__all__ = [
|
|
36
|
+
"WorkhubBot",
|
|
37
|
+
"WebhookServer",
|
|
38
|
+
"Bookmark",
|
|
39
|
+
"BookmarkMessage",
|
|
40
|
+
"BotCommand",
|
|
41
|
+
"BotInfo",
|
|
42
|
+
"BotSchedule",
|
|
43
|
+
"Channel",
|
|
44
|
+
"ChannelFile",
|
|
45
|
+
"ChannelFileListResponse",
|
|
46
|
+
"ChannelMemberInfo",
|
|
47
|
+
"CommandDef",
|
|
48
|
+
"DMRoom",
|
|
49
|
+
"DMRoomMember",
|
|
50
|
+
"ExecuteCommandResult",
|
|
51
|
+
"HashtagPreview",
|
|
52
|
+
"HashtagTarget",
|
|
53
|
+
"InteractiveAction",
|
|
54
|
+
"InteractiveMessageResult",
|
|
55
|
+
"MentionTarget",
|
|
56
|
+
"Message",
|
|
57
|
+
"MessageActionResponse",
|
|
58
|
+
"Project",
|
|
59
|
+
"SearchResult",
|
|
60
|
+
"Task",
|
|
61
|
+
"Topic",
|
|
62
|
+
"User",
|
|
63
|
+
"WebhookEvent",
|
|
64
|
+
]
|