Skip to content

Commit 4f37711

Browse files
zimegClaude
andauthored
feat(methods): add apps.managed.permissions.set method example (#135)
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 722ac8b commit 4f37711

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

‎methods/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ $ mvn compile exec:java -Dexec.mainClass=chat.ChatPostMessage # Make the reques
4343
### apps
4444

4545
- **[apps.icon.set](https://docs.slack.dev/reference/methods/apps.icon.set)**: Sets the app icon. [Implementation](./src/main/java/apps/icon/AppsIconSet.java).
46+
- **[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/main/java/apps/managed/permissions/AppsManagedPermissionsSet.java).
4647

4748
### assistant
4849

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package apps.managed.permissions;
2+
3+
import com.slack.api.Slack;
4+
import com.slack.api.methods.MethodsClient;
5+
import com.slack.api.methods.SlackApiException;
6+
import com.slack.api.methods.request.apps.managed.permissions.AppsManagedPermissionsSetRequest;
7+
import com.slack.api.methods.response.apps.managed.permissions.AppsManagedPermissionsSetResponse;
8+
import java.io.IOException;
9+
10+
public class AppsManagedPermissionsSet {
11+
12+
public static void main(String[] args) throws IOException, SlackApiException {
13+
// Read a token from an environment variable
14+
String token = System.getenv("SLACK_TOKEN");
15+
16+
// Initialize
17+
MethodsClient methods = Slack.getInstance().methods(token);
18+
19+
// Call the apps.managed.permissions.set method
20+
AppsManagedPermissionsSetRequest request = AppsManagedPermissionsSetRequest.builder()
21+
.appId("A0123456789")
22+
.permissions("everyone")
23+
.build();
24+
AppsManagedPermissionsSetResponse response = methods.appsManagedPermissionsSet(request);
25+
26+
// Inspect the response
27+
System.out.println(response);
28+
}
29+
}
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)