slack-go / slack

Slack API in Go, originally by @nlopes; Maintainers needed, contact @parsley42
https://pkg.go.dev/github.com/slack-go/slack
BSD 2-Clause "Simplified" License
4.66k stars 1.13k forks source link

Add support for manifests and config tokens #1220

Closed stijndcl closed 1 year ago

stijndcl commented 1 year ago

Considering that Slack allows uploading manifests as both JSON and YAML, but the API docs specify that the manifest submitted to this endpoint should be JSON, I added yaml: tags to the Manifest struct to allow users to marshal their existing YAML manifests.

parsley42 commented 1 year ago

Hi @stijndcl , this looks interesting, can you tell me more about how this will be used, and possibly add a subdirectory with a short README to examples/?

stijndcl commented 1 year ago

Hi @stijndcl , this looks interesting, can you tell me more about how this will be used, and possibly add a subdirectory with a short README to examples/?

@parsley42 I can add examples, yes. Will look into it asap. The main goal of this is to integrate the new endpoints from Slack, because I feel an SDK should cover all available endpoints.

In terms of use cases, you can use these to dynamically configure your Slack app. The current way is manually creating a manifest file and uploading it on the dashboard. These endpoints let you do that programmatically.

If you want more information about how these work or what they are for, the official Slack documentation is at your service: https://api.slack.com/reference/manifests#manifest_apis

parsley42 commented 1 year ago

@stijndcl Ah, yes, that would be great! I'm the author of gopherbot, and setting up a robot means editing and uploading a manifest - so it might be a nice feature for new users if this could be automated. However, I do this via the web ui - so, there must be another step for creating credentials that can use this endpoint, which would be helpful to have a README and example for. Thanks!

stijndcl commented 1 year ago

@parsley42 there are now two examples. The manifest endpoints are really trivial so it didn't make sense to me to include an example for every single method. One should suffice.

I added necessary information about how to handle configuration tokens as well.