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 @@ -40,6 +40,10 @@ $ mvn compile exec:java -Dexec.mainClass=chat.ChatPostMessage # Make the reques
- **[agents.sessions.rename](https://docs.slack.dev/reference/methods/agents.sessions.rename)**: Rename an agent session. [Implementation](./src/main/java/agents/sessions/AgentsSessionsRename.java).
- **[agents.sessions.setStatus](https://docs.slack.dev/reference/methods/agents.sessions.setStatus)**: Set an agent session's lifecycle status, creating the session if needed. [Implementation](./src/main/java/agents/sessions/AgentsSessionsSetStatus.java).

### assistant

- **[assistant.search.context](https://docs.slack.dev/reference/methods/assistant.search.context)**: Searches messages, files, channels and users across your Slack organization. [Implementation](./src/main/java/assistant/search/AssistantSearchContext.java).

### blocks

- **[blocks.validate](https://docs.slack.dev/reference/methods/blocks.validate)**: Validates blocks, messages, and views Block Kit JSON payloads. [Implementation](./src/main/java/blocks/BlocksValidate.java).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package assistant.search;

import com.slack.api.Slack;
import com.slack.api.methods.MethodsClient;
import com.slack.api.methods.SlackApiException;
import com.slack.api.methods.request.assistant.search.AssistantSearchContextRequest;
import com.slack.api.methods.response.asssistant.search.AssistantSearchContextResponse;
import java.io.IOException;
import java.util.Arrays;

public class AssistantSearchContext {

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 assistant.search.context method
AssistantSearchContextRequest request = AssistantSearchContextRequest.builder()
.query("What is the latest on project Gizmo?")
.termClauses(Arrays.asList("project gizmo"))
.actionToken("12345.98765.abcd2358fdea")
.channelTypes(Arrays.asList("public_channel", "private_channel", "mpim", "im"))
.contentTypes(Arrays.asList("messages", "files", "channels"))
.includeContextMessages(true)
.includeBots(false)
.sort("timestamp")
.sortDir("asc")
.before(1755191113)
.after(1752512713)
.includeMessageBlocks(true)
.build();
AssistantSearchContextResponse response = methods.assistantSearchContext(request);

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