Skip to content

feat(methods): add assistant.search.context method example - #141

Merged
zimeg merged 3 commits into
mainfrom
zimeg-feat-assistant-search-examples-context
Nov 20, 2026
Merged

zimeg merged 3 commits into
mainfrom
zimeg-feat-assistant-search-examples-context

Conversation

@zimeg

@zimeg zimeg commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

This pull request adds a method example for assistant.search.context in methods/src/main/java/assistant/search/AssistantSearchContext.java, and lists it in methods/README.md.

  • The arguments copy the Request payload on the reference page.
  • keywords_clauses from that payload is left out: it isn't in the page's Arguments list, and the API ignores it.
  • action_token is added with the page's example value, since every call with a bot token needs one.
  • Adds assistant/search/manifest.json with the bot scopes this folder's methods need.

This is part 1 of 2 in a stack that adds the assistant.search method examples one at a time. Each pull request builds on the one before it and merges on its own, bottom to top.

  1. feat(methods): add assistant.search.context method example #141 assistant.search.context 👈 this pull request
  2. feat(methods): add assistant.search.info method example #142 assistant.search.info

Dependency

This depends on slackapi/java-slack-sdk#1594, which adds assistantSearchContext to slack-api-client. It shipped in slack-api-client 1.56.0, which methods/pom.xml now pins.

Testing

With slackapi/java-slack-sdk#1594 installed locally (./scripts/install_local.sh) and the pin pointed at that snapshot:

  1. cd methods and export SLACK_TOKEN=... with the app's bot token.
  2. mvn compile exec:java -Dexec.mainClass=assistant.search.AssistantSearchContext and check the response. Replace the example action_token with one from a message event to see ok.

With the example value, the call returns invalid_action_token, so the rest of the payload is accepted.

🤖 Generated with Claude Code

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
zimeg and others added 2 commits November 20, 2026 01:49
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg marked this pull request as ready for review November 20, 2026 10:01
@zimeg
zimeg requested a review from a team as a code owner November 20, 2026 10:01

@cchensh cchensh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One nit: channel_types includes private_channel, mpim and im, but the manifest only grants bot scopes, and bot tokens can only hold search:read.public / .files / .users. So with the app's bot token plus an action_token this likely returns missing_scope. Either narrow channel_types to ["public_channel"] for the bot path, or add the user search scopes (search:read.public, .private, .im, .mpim, .files, .users) to the manifest. Also heads-up: the icon, managed-permissions and search PRs each add a section after ### agents in the README, so whichever merges second will need a rebase.

@zimeg

zimeg commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

🌟 Thanks for the kind review @cchensh! The search.context example is a fun one to finally see in java ☕

@zimeg
zimeg merged commit a1004b9 into main Nov 20, 2026
4 checks passed
@zimeg
zimeg deleted the zimeg-feat-assistant-search-examples-context branch November 20, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request java Pull requests that update java code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants