Overriding slack channel per trigger
Closed this issue · 6 comments
Hi, I'd like to use same Slack destination for all my triggers. The only thing that I want to change in the trigger is the destination slack channel.
Is it possible to accomplish or I need to create Slack destination per slack channel?
Btw, Slack Incoming Webhook API support this...
Hi @shamil currently it is not supported. From what I see in Slack's documentations it used to allow add runtime option of channel
but it is not valid anymore. Could you confirm if I am looking at incorrect reference ?
Snippet from the website. https://api.slack.com/custom-integrations/incoming-webhooks#migrating_from_legacy_incoming_webhooks
The majority of your legacy code for sending messages using incoming Webhooks should continue to work within a Slack app without much modification; the only thing you can no longer do is customize the destination channel and author identity at runtime.
@mihirsoni yes, this works only with legacy integrations, new integrations are just Slack Apps with Incoming Webhook enabled.
That's said, currently, legacy integrations still work, and we can use old incoming webhooks and still able to create a new ones. There is a possibility that Slack will eventually remove those, but I doubt this will happen anytime soon, the ecosystem of tools
that still use those legacy integrations is too huge....
@shamil Makes sense. I totally understand this, but it wouldn't makes sense for any new system to implement something legacy. I could still discuss this with team, but most likely we might not be able to support legacy integration.
I understand, the alternative to this could be to use bot user + token instead of incoming webhook.
With bots, it will be possible to post to any channel assuming permission granted to that bot user.
We are using sentinl
currently and want to migrate to opendistro-alerting
. Sentinl was using incoming webhooks as well in earlier versions and now migrated to use bot user to preserve same features of setting slack channel per watcher. The only configugartion we needed to set is bot's token, see their config example
More information about this can be found here
P.S.
feel free to close this issue...
Thanks @mihirsoni, for now I created a custom webhook handler that can both send emails and publish to slack.
I will also look at the CLI
tool you suggested, seems very good for gitops
use case...