Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions methods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ $ mvn compile exec:java -Dexec.mainClass=chat.ChatPostMessage # Make the reques

- **[chat.postMessage](https://docs.slack.dev/reference/methods/chat.postmessage)**: Sends a message to a channel. [Implementation](./src/main/java/chat/ChatPostMessage.java).

### oauth

- **[oauth.v2.beginShortTokenRotation](https://docs.slack.dev/reference/methods/oauth.v2.beginShortTokenRotation)**: Begins rotating the secret on an API token with a short secret. [Implementation](./src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java).

### slackbot

- **[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/main/java/slackbot/skills/SlackbotSkillsCreate.java).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package oauth.v2;

import com.slack.api.Slack;
import com.slack.api.methods.MethodsClient;
import com.slack.api.methods.SlackApiException;
import com.slack.api.methods.request.oauth.OAuthV2BeginShortTokenRotationRequest;

Check failure on line 6 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol

Check failure on line 6 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol
import com.slack.api.methods.response.oauth.OAuthV2BeginShortTokenRotationResponse;

Check failure on line 7 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol

Check failure on line 7 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol
import java.io.IOException;

public class OAuthV2BeginShortTokenRotation {

public static void main(String[] args) throws IOException, SlackApiException {
// Initialize
MethodsClient methods = Slack.getInstance().methods();

// Call the oauth.v2.beginShortTokenRotation method
OAuthV2BeginShortTokenRotationRequest request = OAuthV2BeginShortTokenRotationRequest.builder()

Check failure on line 17 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol

Check failure on line 17 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol

Check failure on line 17 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol

Check failure on line 17 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol
.clientId("4123121235.9872358710")
.clientSecret("e1b9e11dfcd19c1982d5de12921e17e8c")
.token("xoxp-12345-67890-1928471-abcdefg")
.build();
OAuthV2BeginShortTokenRotationResponse response = methods.oauthV2BeginShortTokenRotation(request);

Check failure on line 22 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol

Check failure on line 22 in methods/src/main/java/oauth/v2/OAuthV2BeginShortTokenRotation.java

View workflow job for this annotation

GitHub Actions / maven@java17 (methods)

cannot find symbol

// Inspect the response
System.out.println(response);
}
}
16 changes: 16 additions & 0 deletions methods/src/main/java/oauth/v2/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"display_information": {
"name": "Slack API Methods",
"description": "Example implementations to call \"oauth.v2\" methods"
},
"oauth_config": {
"scopes": {
"user": []
}
},
"settings": {
"org_deploy_enabled": true,
"socket_mode_enabled": false,
"token_rotation_enabled": false
}
}
Loading