Skip to content
Merged
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 @@ -43,3 +43,7 @@ $ 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).

### 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).

2 changes: 1 addition & 1 deletion methods/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
<dependency>
<groupId>com.slack.api</groupId>
<artifactId>slack-api-client</artifactId>
<version>1.54.0</version>
<version>1.55.0</version>
</dependency>
</dependencies>
</project>
38 changes: 38 additions & 0 deletions methods/src/main/java/slackbot/skills/SlackbotSkillsCreate.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package slackbot.skills;

import com.slack.api.Slack;
import com.slack.api.methods.MethodsClient;
import com.slack.api.methods.SlackApiException;
import com.slack.api.methods.request.slackbot.skills.SlackbotSkillsCreateRequest;
import com.slack.api.methods.response.slackbot.skills.SlackbotSkillsCreateResponse;
import java.io.IOException;
import java.util.Arrays;

public class SlackbotSkillsCreate {

public static void main(String[] args) throws IOException, SlackApiException {
// Read a token from an environment variable
String token = System.getenv("SLACK_TOKEN");

// Initialize
MethodsClient methods = Slack.getInstance().methods(token);

// Call the slackbot.skills.create method
SlackbotSkillsCreateRequest request = SlackbotSkillsCreateRequest.builder()
.displayName("Daily priorities")
.instructions("# Purpose\nSuggest the three most important things to work on today.")
.description("Reviews information from Slack and your calendar to suggest priorities for the day.")
.category("productivity")
.examplePrompt("Run {skill} for today")
.mcpServers(Arrays.asList(SlackbotSkillsCreateRequest.McpServer.builder()
.serviceType("app")
.appId("A0123ABCD")
.serverId("Amcp0456EFGH")
.build()))
.build();
SlackbotSkillsCreateResponse response = methods.slackbotSkillsCreate(request);

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