diff --git a/methods/README.md b/methods/README.md index b96e6890..20aef6b6 100644 --- a/methods/README.md +++ b/methods/README.md @@ -72,6 +72,7 @@ $ slack run chat_post_message.py # Make the request - **[slackbot.skillSets.create](https://docs.slack.dev/reference/methods/slackbot.skillSets.create)**: Creates an empty, private Slackbot skill set and attempts to add it to the caller's library. [Implementation](./src/slackbot/skillSets/slackbot_skill_sets_create.py). - **[slackbot.skillSets.delete](https://docs.slack.dev/reference/methods/slackbot.skillSets.delete)**: Deletes a Slackbot skill set. The skills in it, and their library entries, are kept. [Implementation](./src/slackbot/skillSets/slackbot_skill_sets_delete.py). - **[slackbot.skillSets.info](https://docs.slack.dev/reference/methods/slackbot.skillSets.info)**: Returns one Slackbot skill set and the skills in it, in display order. [Implementation](./src/slackbot/skillSets/slackbot_skill_sets_info.py). +- **[slackbot.skillSets.items.add](https://docs.slack.dev/reference/methods/slackbot.skillSets.items.add)**: Adds skills to a Slackbot skill set. [Implementation](./src/slackbot/skillSets/items/slackbot_skill_sets_items_add.py). - **[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). - **[slackbot.skills.delete](https://docs.slack.dev/reference/methods/slackbot.skills.delete)**: Deletes a Slackbot skill and its canvas, and removes it from every library, skill set, and the org catalog. [Implementation](./src/slackbot/skills/slackbot_skills_delete.py). - **[slackbot.skills.info](https://docs.slack.dev/reference/methods/slackbot.skills.info)**: Returns one Slackbot skill, including its instructions. [Implementation](./src/slackbot/skills/slackbot_skills_info.py). diff --git a/methods/src/slackbot/skillSets/items/.slack/.gitignore b/methods/src/slackbot/skillSets/items/.slack/.gitignore new file mode 100644 index 00000000..973ba605 --- /dev/null +++ b/methods/src/slackbot/skillSets/items/.slack/.gitignore @@ -0,0 +1,2 @@ +apps.dev.json +cache/ diff --git a/methods/src/slackbot/skillSets/items/.slack/config.json b/methods/src/slackbot/skillSets/items/.slack/config.json new file mode 100644 index 00000000..909afbe1 --- /dev/null +++ b/methods/src/slackbot/skillSets/items/.slack/config.json @@ -0,0 +1,6 @@ +{ + "manifest": { + "source": "local" + }, + "project_id": "00000000-0000-0000-0000-000000000000" +} diff --git a/methods/src/slackbot/skillSets/items/.slack/hooks.json b/methods/src/slackbot/skillSets/items/.slack/hooks.json new file mode 100644 index 00000000..ce474c9a --- /dev/null +++ b/methods/src/slackbot/skillSets/items/.slack/hooks.json @@ -0,0 +1,5 @@ +{ + "hooks": { + "get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks" + } +} diff --git a/methods/src/slackbot/skillSets/items/__init__.py b/methods/src/slackbot/skillSets/items/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/methods/src/slackbot/skillSets/items/assets/icon.png b/methods/src/slackbot/skillSets/items/assets/icon.png new file mode 100644 index 00000000..7f4b786d Binary files /dev/null and b/methods/src/slackbot/skillSets/items/assets/icon.png differ diff --git a/methods/src/slackbot/skillSets/items/manifest.json b/methods/src/slackbot/skillSets/items/manifest.json new file mode 100644 index 00000000..d094d4cd --- /dev/null +++ b/methods/src/slackbot/skillSets/items/manifest.json @@ -0,0 +1,22 @@ +{ + "display_information": { + "name": "Slack API Methods", + "description": "Example implementations to call \"slackbot.skillSets.items\" methods" + }, + "features": { + "bot_user": { + "display_name": "Slack API Methods", + "always_online": true + } + }, + "oauth_config": { + "scopes": { + "bot": ["skills:write"] + } + }, + "settings": { + "org_deploy_enabled": true, + "socket_mode_enabled": false, + "token_rotation_enabled": false + } +} diff --git a/methods/src/slackbot/skillSets/items/slackbot_skill_sets_items_add.py b/methods/src/slackbot/skillSets/items/slackbot_skill_sets_items_add.py new file mode 100644 index 00000000..bd99f087 --- /dev/null +++ b/methods/src/slackbot/skillSets/items/slackbot_skill_sets_items_add.py @@ -0,0 +1,21 @@ +import os + +from slack_sdk import WebClient + +# Read a token from an environment variable +token = os.environ.get("SLACK_TOKEN") + +# Initialize +client = WebClient(token=token) + +# Call the slackbot.skillSets.items.add method +response = client.slackbot_skillSets_items_add( + skill_set_id="F0789IJKL", + skill_ids=[ + "F0123ABCD", + "F0456EFGH", + ], +) + +# Inspect the response +print(response)