diff --git a/methods/README.md b/methods/README.md index d5ac1d0..ef06634 100644 --- a/methods/README.md +++ b/methods/README.md @@ -44,6 +44,7 @@ $ slack run chat_post_message.py # Make the request ### apps - **[apps.icon.set](https://docs.slack.dev/reference/methods/apps.icon.set)**: Sets the app icon. [Implementation](./src/apps/icon/apps_icon_set.py). +- **[apps.managed.permissions.set](https://docs.slack.dev/reference/methods/apps.managed.permissions.set)**: Set who can interact with a managed app. Lets the builder who created a managed app on a partner platform configure the app's permissions, using a user token or bot token from the manager app. Permissions can only be set before the app is installed: if the app is already installed, this method makes no change and returns the app's current permissions. [Implementation](./src/apps/managed/permissions/apps_managed_permissions_set.py). ### blocks diff --git a/methods/src/apps/managed/__init__.py b/methods/src/apps/managed/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/methods/src/apps/managed/permissions/.slack/.gitignore b/methods/src/apps/managed/permissions/.slack/.gitignore new file mode 100644 index 0000000..973ba60 --- /dev/null +++ b/methods/src/apps/managed/permissions/.slack/.gitignore @@ -0,0 +1,2 @@ +apps.dev.json +cache/ diff --git a/methods/src/apps/managed/permissions/.slack/config.json b/methods/src/apps/managed/permissions/.slack/config.json new file mode 100644 index 0000000..909afbe --- /dev/null +++ b/methods/src/apps/managed/permissions/.slack/config.json @@ -0,0 +1,6 @@ +{ + "manifest": { + "source": "local" + }, + "project_id": "00000000-0000-0000-0000-000000000000" +} diff --git a/methods/src/apps/managed/permissions/.slack/hooks.json b/methods/src/apps/managed/permissions/.slack/hooks.json new file mode 100644 index 0000000..ce474c9 --- /dev/null +++ b/methods/src/apps/managed/permissions/.slack/hooks.json @@ -0,0 +1,5 @@ +{ + "hooks": { + "get-hooks": "python3 -m slack_cli_hooks.hooks.get_hooks" + } +} diff --git a/methods/src/apps/managed/permissions/__init__.py b/methods/src/apps/managed/permissions/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/methods/src/apps/managed/permissions/apps_managed_permissions_set.py b/methods/src/apps/managed/permissions/apps_managed_permissions_set.py new file mode 100644 index 0000000..5ca0f69 --- /dev/null +++ b/methods/src/apps/managed/permissions/apps_managed_permissions_set.py @@ -0,0 +1,18 @@ +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 apps.managed.permissions.set method +response = client.apps_managed_permissions_set( + app_id="A0123456789", + permissions="everyone", +) + +# Inspect the response +print(response) diff --git a/methods/src/apps/managed/permissions/manifest.json b/methods/src/apps/managed/permissions/manifest.json new file mode 100644 index 0000000..26e3991 --- /dev/null +++ b/methods/src/apps/managed/permissions/manifest.json @@ -0,0 +1,16 @@ +{ + "display_information": { + "name": "Slack API Methods", + "description": "Example implementations to call \"apps.managed.permissions\" methods" + }, + "oauth_config": { + "scopes": { + "bot": [] + } + }, + "settings": { + "org_deploy_enabled": true, + "socket_mode_enabled": false, + "token_rotation_enabled": false + } +}