Skip to content

Conversation

ArielTM
Copy link

@ArielTM ArielTM commented Mar 9, 2025

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.

Copy link

salesforce-cla bot commented Mar 9, 2025

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

Copy link

codecov bot commented Mar 14, 2025

Codecov Report

Attention: Patch coverage is 11.11111% with 24 lines in your changes missing coverage. Please review.

Project coverage is 85.20%. Comparing base (1303413) to head (dd5f4e6).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
slack_sdk/web/async_client.py 11.11% 8 Missing ⚠️
slack_sdk/web/client.py 11.11% 8 Missing ⚠️
slack_sdk/web/legacy_client.py 11.11% 8 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1667      +/-   ##
==========================================
- Coverage   85.36%   85.20%   -0.16%     
==========================================
  Files         113      113              
  Lines       12802    12829      +27     
==========================================
+ Hits        10928    10931       +3     
- Misses       1874     1898      +24     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@WilliamBergamin
Copy link
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 [email protected] 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

@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
Copy link
Contributor

WilliamBergamin commented Apr 24, 2025

@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

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.

3 participants