Kathryn
Kathryn12mo ago

Is there any documentation on interacting with the Slack resource with python?

I'm a (potential) user migrating from Airplane
11 Replies
rubenf
rubenf12mo ago
HI @Kathryn , there is nothing speciific to windimill about it. You can simply use: https://pypi.org/project/slack-sdk/ like you would outside of windmill and pass the token that you take as argument from your slack resource
PyPI
slack-sdk
The Slack API Platform SDK for Python
Kathryn
KathrynOP12mo ago
@rubenf ok, thanks
rubenf
rubenf12mo ago
and as a reminder, to take slack as an arg:
slack = dict

def main(slack: slack): ....
slack = dict

def main(slack: slack): ....
Kathryn
KathrynOP12mo ago
ok, also when adding the Slack resource with expanded scopes (like chat:write) I see errors "Invalid permissions requested. invalid_scope". Does Windmill intentionally limit scope? I would prefer to post slack messages as a Windmill Bot rather than through my user
rubenf
rubenf12mo ago
Windmill doesn't modify the scopes. And you can post as a bot by using a bot token when you connect to slack in your workspace settings, it will create a bot resource as well
Kathryn
KathrynOP12mo ago
Got it, thanks for your help!
sonryhater
sonryhater9mo ago
Why can't the slack_bot resource just be available? Why are you forced to connect your workspace to slack just to create a resource for a bot token.
rubenf
rubenf9mo ago
We didn't add that ux path. Would you like to contribute it as a pull request ?
sonryhater
sonryhater9mo ago
I appreciate the "Complaints? Submit a PR." take, but no, It's just a default resource called slack_bot with a single variable: token. I don't have the internal knowledge about windmill to unwind whatever is hiding that until the slack connection is made, nor do I understand the UX decisions behind hiding a resource until a non-related oauth connection to slack is made. I'll try to submit a request to our account manager and see how that goes. For now, I've created my own c_slack_bot resource.
rubenf
rubenf9mo ago
What I meant by that is that the question was unnecessarily confrontational. We're nice people and we prefer when things are asked nicely. And we're more than happy to prioritize ee customer requests. Would you happen to work for an org that is one? We happen to be stretched thin by the number of requests from our customers at the moment so we can only prioritize accordingly. Either way, the best would be to submit a feature request on GitHub and we should be able to implement it at some point in the future since it's definitely an area of improvement.
sonryhater
sonryhater9mo ago
You are correct. I was being unnecessarily confrontational. I'm sorry for that. My frustration about how windmill works with slack was getting to me. I also do understand that it's a small team, and honestly, I was only annoyed that the resource was unnecessarily hidden, not that it wasn't going to be fixed asap. There's a simple workaround. Windmill is a good tool and it's solving problems for us.