Skip to content

Commit 71b1098

Browse files
zimegClaude
andcommitted
feat: add slackbot.skills.create method example
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 21f0535 commit 71b1098

8 files changed

Lines changed: 67 additions & 0 deletions

File tree

‎methods/README.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ $ slack run chat_post_message.py # Make the request
4242
### chat
4343

4444
- **[chat.postMessage](https://docs.slack.dev/reference/methods/chat.postmessage)**: Sends a message to a channel. [Implementation](./src/chat/chat_post_message.py).
45+
46+
### slackbot
47+
48+
- **[slackbot.skills.create](https://docs.slack.dev/reference/methods/slackbot.skills.create)**: Creates a skill from markdown instructions, or turns an existing canvas the caller owns into a skill. [Implementation](./src/slackbot/skills/slackbot_skills_create.py).

‎methods/src/slackbot/__init__.py‎

Whitespace-only changes.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
apps.dev.json
2+
cache/
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"manifest": {
3+
"source": "local"
4+
},
5+
"project_id": "00000000-0000-0000-0000-000000000000"
6+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"hooks": {
3+
"get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks"
4+
}
5+
}

‎methods/src/slackbot/skills/__init__.py‎

Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"display_information": {
3+
"name": "Slack API Methods",
4+
"description": "Example implementations to call \"slackbot.skills\" methods"
5+
},
6+
"features": {
7+
"bot_user": {
8+
"display_name": "Slack API Methods",
9+
"always_online": true
10+
}
11+
},
12+
"oauth_config": {
13+
"scopes": {
14+
"bot": ["skills:write"]
15+
}
16+
},
17+
"settings": {
18+
"org_deploy_enabled": true,
19+
"socket_mode_enabled": true,
20+
"token_rotation_enabled": false
21+
}
22+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import os
2+
3+
from slack_sdk import WebClient
4+
5+
# Read a token from an environment variable
6+
token = os.environ.get("SLACK_TOKEN")
7+
8+
# Initialize
9+
client = WebClient(token=token)
10+
11+
# Call the slackbot.skills.create method
12+
response = client.slackbot_skills_create(
13+
display_name="Daily priorities",
14+
category="productivity",
15+
description="Reviews information from Slack and your calendar to suggest priorities for the day.",
16+
example_prompt="Run {skill} for today",
17+
instructions="# Purpose\nSuggest the three most important things to work on today.",
18+
mcp_servers=[
19+
{
20+
"app_id": "A0123ABCD",
21+
"server_id": "Amcp0456EFGH",
22+
"service_type": "app",
23+
},
24+
],
25+
)
26+
27+
# Inspect the response
28+
print(response)

0 commit comments

Comments
 (0)