Skip to content

feat: add assistant.search.context method - #1667

Merged
zimeg merged 3 commits into
slackapi:mainfrom
ArielTM:patch-1
Nov 19, 2026
Merged

zimeg merged 3 commits into
slackapi:mainfrom
ArielTM:patch-1

Conversation

@ArielTM

@ArielTM ArielTM commented Mar 9, 2025 •

Copy link
Copy Markdown
Contributor

Summary

Add support for assistant.search.context . Although listed in docs, it is yet to be supported.

There's a discrepancy between https://api.slack.com/methods/assistant.search.context and https://api.slack.com/docs/apps/data-access-api#use-action-token on whether action_token is required. From my testing it is so I set it as such. Lmk if that's not the case.

Testing

Ran it using my app and workspace

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

@salesforce-cla

salesforce-cla Bot commented Mar 9, 2025

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @ArielTM to sign the Salesforce Inc. Contributor License Agreement.

@codecov

codecov Bot commented Mar 14, 2025 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.63%. Comparing base (cf80853) to head (440c81b).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
slack_sdk/web/async_client.py 72.72% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1667      +/-   ##
==========================================
- Coverage   84.65%   84.63%   -0.02%     
==========================================
  Files         118      118              
  Lines       14080    14113      +33     
==========================================
+ Hits        11919    11945      +26     
- Misses       2161     2168       +7     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@WilliamBergamin

Copy link
Copy Markdown
Contributor

Hi @ArielTM thanks for you contribution 🚀 they are alway welcome

Unfortunately we need to hold off on introducing these changes due to these APIs being in a limited access stage

This API is currently in a limited access stage. You may be able to obtain a token and call the API, but to get a valid response, you must be enrolled in the program. Contact Customer Experience at feedback@slack.com to request to be added.

We would also need unit tests for these changes 🙏

@WilliamBergamin WilliamBergamin added enhancement M-T: A feature request for new functionality discussion M-T: An issue where more input is needed to reach a decision semver:minor web-client area:async labels Mar 14, 2025
@Pythonista7

Copy link
Copy Markdown

@WilliamBergamin Until this is in "limited access" , would you say the best way to use this api would be to do something like this instead ?

app.client.api_call(
                api_method="assistant.search.context",
                http_verb="POST",
                headers={"Authorization": f"Bearer {os.environ.get('SLACK_BOT_TOKEN')}",},
                json={
                    "action_token": action_token,
                    "query": text,
                    "limit": 5,
                },
            )

@WilliamBergamin

WilliamBergamin commented Apr 24, 2025 •

Copy link
Copy Markdown
Contributor

@Pythonista7 Yess this is the recommended approach 💯
But you may not need to specify the headers or http_verb if the client is configured correctly

@zimeg zimeg changed the title Add support for assistant.search.context feat: add assistant.search.context method Nov 12, 2026
@zimeg zimeg added this to the 3.47.1 milestone Nov 18, 2026
@zimeg
zimeg requested a review from a team as a code owner November 19, 2026 04:42

@zimeg zimeg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey @ArielTM! 👋 Thanks so much for sharing this with us, and for your patience while this method was in limited access. That's lifted now, so we'd love to bring this in! 📚 I pushed a change that matches the current reference: action_token is optional, the newer arguments are added in the order of the reference, and the docstring links to docs.slack.dev. 🧪 main is merged in too, and the coverage test now calls this method instead of skipping it. ✅ LGTM!

@zimeg
zimeg merged commit b935494 into slackapi:main Nov 19, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:async cla:signed discussion M-T: An issue where more input is needed to reach a decision enhancement M-T: A feature request for new functionality semver:minor web-client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants