-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bolt Slack API is very unclear on multiple workspace install #1076
Comments
Hi, @richarddli! Thank you for submitting this issue 😄 Bolt Python has built-in OAuth capabilities, as mentioned in the doc that you linked. Essentially, to enable OAuth on the app side, you'll need to initialize your app similar to this, taken from here:
As you mentioned, for Bolt Python OAuth, you do need some sort of data store solution to store all the credentials for each download of the app to a new workspace. Then, you need to point your app config to use the data store so it knows where to put the credentials for each new download. In the above example, the code is using a local file as a store with one of our built-in The above is all you need to get started with OAuth - Bolt handles the rest. You can test installing to multiple workspaces once it's set up using the I hope this helps, let me know if you have additional questions! 🙌 |
Hi @hello-ashleyintech! Thanks for the prompt response. Yes, I figured all the above out. The other thing that isn't mentioned is how to write your Slack event handler to handle multiple workspaces. This functionality does not seem to be supported directly by Bolt. The Token Lookup page has some hints. Here's where I ended up:
Is this how it's done? Or is there a better way? Example code is fine. I just couldn't find how to do this in the docs. |
Hi, @richarddli! I believe you can just do the following:
Bolt should take a look at the incoming event, verify the installation instance passed into the request via the InstallationStore, and then if all looks good and it has access to the specified channel in the workspace, it'll post it in there. You can view an example of this here with Let me know if you have additional questions! |
Hi @hello-ashleyintech. Thanks for all your help. I've gotten most (?) of this working, but I have one more error I can't figure out.
I've verified that my client secret and client ID are correct, and read by the app itself. I also was able to get a successful access_token by taking the |
Hi, @richarddli! 👋 Sorry to hear you're still running into some issues. As a starting point for troubleshooting the |
I'm creating a multiple workspace Slack bot using Bolt Python.
The documentation is very clear about the OAuth flow: https://slack.dev/bolt-python/concepts#authenticating-oauth. everything points to this. However, the documentation says nothing about what happens after you get the bot access token.
With a great amount of research, I found that the BoltJS (not Python) has more context. https://slack.dev/bolt-js/concepts#authenticating-oauth. In particular, it references an
InstallationStore
. So, I Google some more and end up finding the Slack SDK page for Token Lookup: https://slack.dev/python-slack-sdk/oauth/index.html#token-lookup.Based on the design pattern on this page, it seems to suggest that I instantiate a new
WebClient
for each request with its own token. It's not clear to me if this is the appropriate design pattern for Bolt apps, either.The page URLs
I'd love to see some sort of example (can't find it) and a link to how you build a multiple workspace app somewhere here: https://slack.dev/bolt-python/concepts#authenticating-oauth. At a minimum, parity with the JS docs would be helpful. But honestly I'm still confused about the appropriate design pattern and if I'm supposed to create a new
AsyncApp
with every request with its own access token, or if there's a better way.The text was updated successfully, but these errors were encountered: