Skip to content
Draft
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
1 change: 1 addition & 0 deletions methods/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ $ slack run chat_post_message.py # Make the request

### 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/assistant/search/assistant_search_context.py).
- **[assistant.search.info](https://docs.slack.dev/reference/methods/assistant.search.info)**: Returns search capabilities on a given team. [Implementation](./src/assistant/search/assistant_search_info.py).

### blocks
Expand Down
27 changes: 27 additions & 0 deletions methods/src/assistant/search/assistant_search_context.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import os

from slack_sdk import WebClient

# Read a token from an environment variable
token = os.environ.get("SLACK_TOKEN")

# Initialize
client = WebClient(token=token)

# Call the assistant.search.context method
response = client.assistant_search_context(
query="What is the latest on project Gizmo?",
action_token="12345.98765.abcd2358fdea",
channel_types=["public_channel", "private_channel", "mpim", "im"],
content_types=["messages", "files", "channels"],
include_context_messages=True,
include_bots=False,
sort="timestamp",
sort_dir="asc",
before=1755191113,
after=1752512713,
include_message_blocks=True,
)

# Inspect the response
print(response)
2 changes: 1 addition & 1 deletion methods/src/assistant/search/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"oauth_config": {
"scopes": {
"bot": ["search:read.public"]
"bot": ["search:read.files", "search:read.public", "search:read.users"]
}
},
"settings": {
Expand Down
Loading