Skip to content

Add support for assistant.search.context - #1667

Open
ArielTM wants to merge 1 commit into
slackapi:mainfrom
ArielTM:patch-1
Open

ArielTM wants to merge 1 commit into
slackapi:mainfrom
ArielTM:patch-1

Conversation

@ArielTM

@ArielTM ArielTM commented Mar 9, 2025

Copy link
Copy Markdown

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 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 182 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 ⚠️

❌ Your patch check has failed because the patch coverage (11.11%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

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 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

This branch has not been deployed

No deployments
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