Skip to content

Commit 5a6348c

Browse files
zimegClaude
andauthored
feat(methods): add apps.managed.permissions.set method example (#398)
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 5b970ea commit 5a6348c

8 files changed

Lines changed: 48 additions & 0 deletions

File tree

‎methods/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ $ slack run chat_post_message.py # Make the request
4444
### apps
4545

4646
- **[apps.icon.set](https://docs.slack.dev/reference/methods/apps.icon.set)**: Sets the app icon. [Implementation](./src/apps/icon/apps_icon_set.py).
47+
- **[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).
4748

4849
### blocks
4950

‎methods/src/apps/managed/__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/apps/managed/permissions/__init__.py‎

Whitespace-only changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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 apps.managed.permissions.set method
12+
response = client.apps_managed_permissions_set(
13+
app_id="A0123456789",
14+
permissions="everyone",
15+
)
16+
17+
# Inspect the response
18+
print(response)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"display_information": {
3+
"name": "Slack API Methods",
4+
"description": "Example implementations to call \"apps.managed.permissions\" methods"
5+
},
6+
"oauth_config": {
7+
"scopes": {
8+
"bot": []
9+
}
10+
},
11+
"settings": {
12+
"org_deploy_enabled": true,
13+
"socket_mode_enabled": false,
14+
"token_rotation_enabled": false
15+
}
16+
}

0 commit comments

Comments
 (0)