chub-dev 0.1.0 → 0.1.2-beta.0
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.
- package/README.md +55 -0
- package/bin/chub-mcp +2 -0
- package/dist/airtable/docs/database/javascript/DOC.md +1437 -0
- package/dist/airtable/docs/database/python/DOC.md +1735 -0
- package/dist/amplitude/docs/analytics/javascript/DOC.md +1282 -0
- package/dist/amplitude/docs/analytics/python/DOC.md +1199 -0
- package/dist/anthropic/docs/claude-api/javascript/DOC.md +503 -0
- package/dist/anthropic/docs/claude-api/python/DOC.md +389 -0
- package/dist/asana/docs/tasks/DOC.md +1396 -0
- package/dist/assemblyai/docs/transcription/DOC.md +1043 -0
- package/dist/atlassian/docs/confluence/javascript/DOC.md +1347 -0
- package/dist/atlassian/docs/confluence/python/DOC.md +1604 -0
- package/dist/auth0/docs/identity/javascript/DOC.md +968 -0
- package/dist/auth0/docs/identity/python/DOC.md +1199 -0
- package/dist/aws/docs/s3/javascript/DOC.md +1773 -0
- package/dist/aws/docs/s3/python/DOC.md +1807 -0
- package/dist/binance/docs/trading/javascript/DOC.md +1315 -0
- package/dist/binance/docs/trading/python/DOC.md +1454 -0
- package/dist/braintree/docs/gateway/javascript/DOC.md +1278 -0
- package/dist/braintree/docs/gateway/python/DOC.md +1179 -0
- package/dist/chromadb/docs/embeddings-db/javascript/DOC.md +1263 -0
- package/dist/chromadb/docs/embeddings-db/python/DOC.md +1707 -0
- package/dist/clerk/docs/auth/javascript/DOC.md +1220 -0
- package/dist/clerk/docs/auth/python/DOC.md +274 -0
- package/dist/cloudflare/docs/workers/javascript/DOC.md +918 -0
- package/dist/cloudflare/docs/workers/python/DOC.md +994 -0
- package/dist/cockroachdb/docs/distributed-db/DOC.md +1500 -0
- package/dist/cohere/docs/llm/DOC.md +1335 -0
- package/dist/datadog/docs/monitoring/javascript/DOC.md +1740 -0
- package/dist/datadog/docs/monitoring/python/DOC.md +1815 -0
- package/dist/deepgram/docs/speech/javascript/DOC.md +885 -0
- package/dist/deepgram/docs/speech/python/DOC.md +685 -0
- package/dist/deepl/docs/translation/javascript/DOC.md +887 -0
- package/dist/deepl/docs/translation/python/DOC.md +944 -0
- package/dist/deepseek/docs/llm/DOC.md +1220 -0
- package/dist/directus/docs/headless-cms/javascript/DOC.md +1128 -0
- package/dist/directus/docs/headless-cms/python/DOC.md +1276 -0
- package/dist/discord/docs/bot/javascript/DOC.md +1090 -0
- package/dist/discord/docs/bot/python/DOC.md +1130 -0
- package/dist/elasticsearch/docs/search/DOC.md +1634 -0
- package/dist/elevenlabs/docs/text-to-speech/javascript/DOC.md +336 -0
- package/dist/elevenlabs/docs/text-to-speech/python/DOC.md +552 -0
- package/dist/firebase/docs/auth/DOC.md +1015 -0
- package/dist/gemini/docs/genai/javascript/DOC.md +691 -0
- package/dist/gemini/docs/genai/python/DOC.md +555 -0
- package/dist/github/docs/octokit/DOC.md +1560 -0
- package/dist/google/docs/bigquery/javascript/DOC.md +1688 -0
- package/dist/google/docs/bigquery/python/DOC.md +1503 -0
- package/dist/hubspot/docs/crm/javascript/DOC.md +1805 -0
- package/dist/hubspot/docs/crm/python/DOC.md +2033 -0
- package/dist/huggingface/docs/transformers/DOC.md +948 -0
- package/dist/intercom/docs/messaging/javascript/DOC.md +1844 -0
- package/dist/intercom/docs/messaging/python/DOC.md +1797 -0
- package/dist/jira/docs/issues/javascript/DOC.md +1420 -0
- package/dist/jira/docs/issues/python/DOC.md +1492 -0
- package/dist/kafka/docs/streaming/javascript/DOC.md +1671 -0
- package/dist/kafka/docs/streaming/python/DOC.md +1464 -0
- package/dist/landingai-ade/docs/api/DOC.md +620 -0
- package/dist/landingai-ade/docs/sdk/python/DOC.md +489 -0
- package/dist/landingai-ade/docs/sdk/typescript/DOC.md +542 -0
- package/dist/landingai-ade/skills/SKILL.md +489 -0
- package/dist/launchdarkly/docs/feature-flags/javascript/DOC.md +1191 -0
- package/dist/launchdarkly/docs/feature-flags/python/DOC.md +1671 -0
- package/dist/linear/docs/tracker/DOC.md +1554 -0
- package/dist/livekit/docs/realtime/javascript/DOC.md +303 -0
- package/dist/livekit/docs/realtime/python/DOC.md +163 -0
- package/dist/mailchimp/docs/marketing/DOC.md +1420 -0
- package/dist/meilisearch/docs/search/DOC.md +1241 -0
- package/dist/microsoft/docs/onedrive/javascript/DOC.md +1421 -0
- package/dist/microsoft/docs/onedrive/python/DOC.md +1549 -0
- package/dist/mongodb/docs/atlas/DOC.md +2041 -0
- package/dist/notion/docs/workspace-api/javascript/DOC.md +1435 -0
- package/dist/notion/docs/workspace-api/python/DOC.md +1400 -0
- package/dist/okta/docs/identity/javascript/DOC.md +1171 -0
- package/dist/okta/docs/identity/python/DOC.md +1401 -0
- package/dist/openai/docs/chat/javascript/DOC.md +407 -0
- package/dist/openai/docs/chat/python/DOC.md +568 -0
- package/dist/paypal/docs/checkout/DOC.md +278 -0
- package/dist/pinecone/docs/sdk/javascript/DOC.md +984 -0
- package/dist/pinecone/docs/sdk/python/DOC.md +1395 -0
- package/dist/plaid/docs/banking/javascript/DOC.md +1163 -0
- package/dist/plaid/docs/banking/python/DOC.md +1203 -0
- package/dist/playwright-community/skills/login-flows/SKILL.md +108 -0
- package/dist/postmark/docs/transactional-email/DOC.md +1168 -0
- package/dist/prisma/docs/orm/javascript/DOC.md +1419 -0
- package/dist/prisma/docs/orm/python/DOC.md +1317 -0
- package/dist/qdrant/docs/vector-search/javascript/DOC.md +1221 -0
- package/dist/qdrant/docs/vector-search/python/DOC.md +1653 -0
- package/dist/rabbitmq/docs/message-queue/javascript/DOC.md +1193 -0
- package/dist/rabbitmq/docs/message-queue/python/DOC.md +1243 -0
- package/dist/razorpay/docs/payments/javascript/DOC.md +1219 -0
- package/dist/razorpay/docs/payments/python/DOC.md +1330 -0
- package/dist/redis/docs/key-value/javascript/DOC.md +1851 -0
- package/dist/redis/docs/key-value/python/DOC.md +2054 -0
- package/dist/registry.json +2817 -0
- package/dist/replicate/docs/model-hosting/DOC.md +1318 -0
- package/dist/resend/docs/email/DOC.md +1271 -0
- package/dist/salesforce/docs/crm/javascript/DOC.md +1241 -0
- package/dist/salesforce/docs/crm/python/DOC.md +1183 -0
- package/dist/search-index.json +1 -0
- package/dist/sendgrid/docs/email-api/javascript/DOC.md +371 -0
- package/dist/sendgrid/docs/email-api/python/DOC.md +656 -0
- package/dist/sentry/docs/error-tracking/javascript/DOC.md +1073 -0
- package/dist/sentry/docs/error-tracking/python/DOC.md +1309 -0
- package/dist/shopify/docs/storefront/DOC.md +457 -0
- package/dist/slack/docs/workspace/javascript/DOC.md +933 -0
- package/dist/slack/docs/workspace/python/DOC.md +271 -0
- package/dist/square/docs/payments/javascript/DOC.md +1855 -0
- package/dist/square/docs/payments/python/DOC.md +1728 -0
- package/dist/stripe/docs/api/DOC.md +1727 -0
- package/dist/stripe/docs/payments/DOC.md +1726 -0
- package/dist/stytch/docs/auth/javascript/DOC.md +1813 -0
- package/dist/stytch/docs/auth/python/DOC.md +1962 -0
- package/dist/supabase/docs/client/DOC.md +1606 -0
- package/dist/twilio/docs/messaging/python/DOC.md +469 -0
- package/dist/twilio/docs/messaging/typescript/DOC.md +946 -0
- package/dist/vercel/docs/platform/DOC.md +1940 -0
- package/dist/weaviate/docs/vector-db/javascript/DOC.md +1268 -0
- package/dist/weaviate/docs/vector-db/python/DOC.md +1388 -0
- package/dist/zendesk/docs/support/javascript/DOC.md +2150 -0
- package/dist/zendesk/docs/support/python/DOC.md +2297 -0
- package/package.json +22 -6
- package/skills/get-api-docs/SKILL.md +84 -0
- package/src/commands/annotate.js +83 -0
- package/src/commands/build.js +12 -1
- package/src/commands/feedback.js +150 -0
- package/src/commands/get.js +83 -42
- package/src/commands/search.js +7 -0
- package/src/index.js +43 -17
- package/src/lib/analytics.js +90 -0
- package/src/lib/annotations.js +57 -0
- package/src/lib/bm25.js +170 -0
- package/src/lib/cache.js +69 -6
- package/src/lib/config.js +8 -3
- package/src/lib/identity.js +99 -0
- package/src/lib/registry.js +103 -20
- package/src/lib/telemetry.js +86 -0
- package/src/mcp/server.js +177 -0
- package/src/mcp/tools.js +251 -0
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: workspace
|
|
3
|
+
description: "Slack Python SDK for building Slack apps, bots, and workspace integrations"
|
|
4
|
+
metadata:
|
|
5
|
+
languages: "python"
|
|
6
|
+
versions: "3.37.0"
|
|
7
|
+
updated-on: "2026-03-01"
|
|
8
|
+
source: maintainer
|
|
9
|
+
tags: "slack,bot,workspace,messaging,events-api"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Slack Python SDK Coding Guidelines
|
|
13
|
+
|
|
14
|
+
You are a Slack SDK coding expert. Help me with writing code using the Slack
|
|
15
|
+
Python SDK for building Slack apps and integrations.
|
|
16
|
+
|
|
17
|
+
Please follow the following guidelines when generating code.
|
|
18
|
+
|
|
19
|
+
You can find the official SDK documentation and code samples here:
|
|
20
|
+
https://docs.slack.dev/tools/python-slack-sdk/
|
|
21
|
+
|
|
22
|
+
## Golden Rule: Use the Correct and Current SDK
|
|
23
|
+
|
|
24
|
+
Always use the official Slack Python SDK (`slack_sdk`) for all Slack integrations. Do not use the legacy `slackclient` library which is in maintenance mode.
|
|
25
|
+
|
|
26
|
+
- **Library Name:** Slack Python SDK
|
|
27
|
+
- **Python Package:** `slack_sdk`
|
|
28
|
+
- **Legacy Library:** `slackclient` is deprecated and in maintenance mode
|
|
29
|
+
|
|
30
|
+
**Installation:**
|
|
31
|
+
|
|
32
|
+
- **Incorrect:** `pip install slackclient`
|
|
33
|
+
- **Correct:** `pip install slack_sdk`
|
|
34
|
+
|
|
35
|
+
**APIs and Usage:**
|
|
36
|
+
|
|
37
|
+
- **Incorrect:** `from slackclient import SlackClient` -> **Correct:** `from slack_sdk import WebClient`
|
|
38
|
+
- **Incorrect:** `import slackclient` -> **Correct:** `import slack_sdk`
|
|
39
|
+
- **Incorrect:** `from slack_sdk.web_client import WebClient` -> **Correct:** `from slack_sdk import WebClient`
|
|
40
|
+
- **Incorrect:** `from slack_sdk.errors import SlackApiError` -> **Correct:** `from slack_sdk.errors import SlackApiError`
|
|
41
|
+
|
|
42
|
+
## Initialization and Authentication
|
|
43
|
+
|
|
44
|
+
The `slack_sdk` library supports multiple authentication methods. For Web API calls, always use the `WebClient` class.
|
|
45
|
+
|
|
46
|
+
- Always use `client = WebClient(token='your-token')` to create a client object
|
|
47
|
+
- Set `SLACK_BOT_TOKEN` or `SLACK_API_TOKEN` environment variable for security
|
|
48
|
+
- Use Bot User OAuth tokens (`xoxb-*`) for most integrations
|
|
49
|
+
- Use User tokens (`xoxp-*`) only when user-specific actions are required
|
|
50
|
+
|
|
51
|
+
## Basic Web API Usage
|
|
52
|
+
|
|
53
|
+
Here's how to send a message to Slack using the Web API:
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import os
|
|
57
|
+
from slack_sdk import WebClient
|
|
58
|
+
from slack_sdk.errors import SlackApiError
|
|
59
|
+
|
|
60
|
+
client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
response = client.chat_postMessage(channel='#general', text="Hello world!")
|
|
64
|
+
assert response["ok"]
|
|
65
|
+
except SlackApiError as e:
|
|
66
|
+
print(f"Error posting message: {e.response['error']}")
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## File Uploads
|
|
70
|
+
|
|
71
|
+
For uploading files to Slack, use the `files_upload_v2` method:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
import os
|
|
75
|
+
from slack_sdk import WebClient
|
|
76
|
+
from slack_sdk.errors import SlackApiError
|
|
77
|
+
|
|
78
|
+
client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])
|
|
79
|
+
|
|
80
|
+
try:
|
|
81
|
+
response = client.files_upload_v2(
|
|
82
|
+
channel='C0123456789',
|
|
83
|
+
file='./document.pdf',
|
|
84
|
+
title='Document Upload'
|
|
85
|
+
)
|
|
86
|
+
assert response["file"]
|
|
87
|
+
except SlackApiError as e:
|
|
88
|
+
print(f"Error uploading file: {e.response['error']}")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Async Usage
|
|
92
|
+
|
|
93
|
+
For asynchronous operations, use `AsyncWebClient`:
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
import asyncio
|
|
97
|
+
import os
|
|
98
|
+
from slack_sdk.web.async_client import AsyncWebClient
|
|
99
|
+
from slack_sdk.errors import SlackApiError
|
|
100
|
+
|
|
101
|
+
client = AsyncWebClient(token=os.environ['SLACK_BOT_TOKEN'])
|
|
102
|
+
|
|
103
|
+
async def post_message():
|
|
104
|
+
try:
|
|
105
|
+
response = await client.chat_postMessage(
|
|
106
|
+
channel='#general',
|
|
107
|
+
text="Hello from async!"
|
|
108
|
+
)
|
|
109
|
+
assert response["ok"]
|
|
110
|
+
except SlackApiError as e:
|
|
111
|
+
print(f"Error: {e.response['error']}")
|
|
112
|
+
|
|
113
|
+
asyncio.run(post_message())
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Block Kit and Rich Messages
|
|
117
|
+
|
|
118
|
+
Use Block Kit to create rich, interactive messages:
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
from slack_sdk import WebClient
|
|
122
|
+
from slack_sdk.models.blocks import SectionBlock, DividerBlock, ActionsBlock
|
|
123
|
+
from slack_sdk.models.block_elements import ButtonElement
|
|
124
|
+
|
|
125
|
+
client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])
|
|
126
|
+
|
|
127
|
+
blocks = [
|
|
128
|
+
SectionBlock(text="Hello from Block Kit!"),
|
|
129
|
+
DividerBlock(),
|
|
130
|
+
ActionsBlock(elements=[
|
|
131
|
+
ButtonElement(text="Click me", action_id="button_click")
|
|
132
|
+
])
|
|
133
|
+
]
|
|
134
|
+
|
|
135
|
+
response = client.chat_postMessage(
|
|
136
|
+
channel='#general',
|
|
137
|
+
text="Fallback text",
|
|
138
|
+
blocks=blocks
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Error Handling
|
|
143
|
+
|
|
144
|
+
Always handle `SlackApiError` exceptions for robust error handling:
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
from slack_sdk import WebClient
|
|
148
|
+
from slack_sdk.errors import SlackApiError
|
|
149
|
+
|
|
150
|
+
client = WebClient(token=os.environ['SLACK_BOT_TOKEN'])
|
|
151
|
+
|
|
152
|
+
try:
|
|
153
|
+
response = client.chat_postMessage(channel='#general', text="Hello!")
|
|
154
|
+
except SlackApiError as e:
|
|
155
|
+
if e.response["error"] == "channel_not_found":
|
|
156
|
+
print("Channel does not exist")
|
|
157
|
+
elif e.response["error"] == "invalid_auth":
|
|
158
|
+
print("Invalid token")
|
|
159
|
+
else:
|
|
160
|
+
print(f"Slack API Error: {e.response['error']}")
|
|
161
|
+
print(f"Status code: {e.response.status_code}")
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Webhooks
|
|
165
|
+
|
|
166
|
+
For simple webhook-based integrations:
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from slack_sdk.webhook import WebhookClient
|
|
170
|
+
|
|
171
|
+
webhook = WebhookClient("https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX")
|
|
172
|
+
|
|
173
|
+
response = webhook.send(
|
|
174
|
+
text="Hello from webhook!",
|
|
175
|
+
blocks=[
|
|
176
|
+
{
|
|
177
|
+
"type": "section",
|
|
178
|
+
"text": {"type": "mrkdwn", "text": "Hello from webhook!"}
|
|
179
|
+
}
|
|
180
|
+
]
|
|
181
|
+
)
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Socket Mode (Real-time Events)
|
|
185
|
+
|
|
186
|
+
For real-time event handling using Socket Mode:
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
import os
|
|
190
|
+
from slack_sdk.socket_mode import SocketModeClient
|
|
191
|
+
from slack_sdk import WebClient
|
|
192
|
+
|
|
193
|
+
def process_event(client: SocketModeClient, req):
|
|
194
|
+
if req.type == "events_api":
|
|
195
|
+
# Handle events here
|
|
196
|
+
client.send_socket_mode_response(req.envelope_id)
|
|
197
|
+
|
|
198
|
+
socket_client = SocketModeClient(
|
|
199
|
+
app_token=os.environ["SLACK_APP_TOKEN"],
|
|
200
|
+
web_client=WebClient(token=os.environ["SLACK_BOT_TOKEN"])
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
socket_client.socket_mode_request_listeners.append(process_event)
|
|
204
|
+
socket_client.connect()
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Available SDK Modules
|
|
208
|
+
|
|
209
|
+
The Python Slack SDK provides several specialized modules:
|
|
210
|
+
|
|
211
|
+
- `slack_sdk.web`: Web API client for most Slack API interactions
|
|
212
|
+
- `slack_sdk.webhook`: Webhook client for incoming webhooks
|
|
213
|
+
- `slack_sdk.socket_mode`: Socket Mode client for real-time events
|
|
214
|
+
- `slack_sdk.oauth`: OAuth flow implementation
|
|
215
|
+
- `slack_sdk.audit_logs`: Audit Logs API client
|
|
216
|
+
- `slack_sdk.scim`: SCIM API client for user management
|
|
217
|
+
- `slack_sdk.models`: Block Kit and message models
|
|
218
|
+
- `slack_sdk.signature`: Request signature verification
|
|
219
|
+
|
|
220
|
+
## Advanced Configuration
|
|
221
|
+
|
|
222
|
+
Configure SSL, proxies, and other advanced options:
|
|
223
|
+
|
|
224
|
+
```python
|
|
225
|
+
import ssl
|
|
226
|
+
from slack_sdk import WebClient
|
|
227
|
+
|
|
228
|
+
ssl_context = ssl.create_default_context()
|
|
229
|
+
proxy = "http://proxy.company.com:8080"
|
|
230
|
+
|
|
231
|
+
client = WebClient(
|
|
232
|
+
token=os.environ['SLACK_BOT_TOKEN'],
|
|
233
|
+
ssl=ssl_context,
|
|
234
|
+
proxy=proxy,
|
|
235
|
+
timeout=60
|
|
236
|
+
)
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Migration from Legacy Libraries
|
|
240
|
+
|
|
241
|
+
If migrating from `slackclient` v1 or v2:
|
|
242
|
+
- Replace `slackclient` imports with `slack_sdk`
|
|
243
|
+
- Update authentication patterns to use `WebClient(token=...)`
|
|
244
|
+
- Review method signatures as some parameters may have changed
|
|
245
|
+
- Update error handling to use `SlackApiError`
|
|
246
|
+
|
|
247
|
+
## Best Practices
|
|
248
|
+
|
|
249
|
+
1. **Always handle errors**: Use try/except blocks with `SlackApiError`
|
|
250
|
+
2. **Use environment variables**: Store tokens securely in environment variables
|
|
251
|
+
3. **Validate responses**: Check `response["ok"]` before processing results
|
|
252
|
+
4. **Use appropriate token types**: Bot tokens for bot actions, user tokens only when necessary
|
|
253
|
+
5. **Implement rate limiting**: Be aware of Slack's rate limits and implement backoff strategies
|
|
254
|
+
6. **Use Block Kit**: Prefer Block Kit over legacy attachments for rich messages
|
|
255
|
+
|
|
256
|
+
## Requirements
|
|
257
|
+
|
|
258
|
+
- Python 3.9 or higher
|
|
259
|
+
- For async usage: Install with `pip install slack_sdk[optional]` for performance improvements
|
|
260
|
+
|
|
261
|
+
## Useful Links
|
|
262
|
+
|
|
263
|
+
- Documentation: https://docs.slack.dev/tools/python-slack-sdk/
|
|
264
|
+
- API Methods: https://api.slack.com/methods
|
|
265
|
+
- Block Kit Builder: https://app.slack.com/block-kit-builder/
|
|
266
|
+
- GitHub Issues: https://github.com/slackapi/python-slack-sdk/issues
|
|
267
|
+
- Slack Community: https://slackcommunity.com/
|
|
268
|
+
|
|
269
|
+
## Notes
|
|
270
|
+
|
|
271
|
+
This SDK is the official and recommended way to interact with Slack APIs from Python. Always use the latest version and refer to the official documentation for the most up-to-date examples and best practices. For building full Slack apps with event handling, consider using the Bolt for Python framework which builds on top of this SDK.
|