airwallex / k8s-pod-restart-info-collector

Automated troubleshooting of Kubernetes Pods issues. Collect K8s pod restart reasons, logs, and events automatically.
325 stars 47 forks source link

send alert to multiple slack channels with 'modern' (not legacy) webhooks #20

Open hagaram opened 1 year ago

hagaram commented 1 year ago

Hi, at the moment, there is a possibility to override slack channel via label/annotation in your application.

Only legacy slack webhooks are capable of posting to multiple channels with one webhook URL via channel parameter.

Slack apps and "modern" incoming webhooks have specific URL mapped to specific channel, so there is no way to override them.

Would it be difficult to add some kind of option or better word would be mapping, where it would be possible to map annotation (or slack channel) alert-slack-channel: "your-slack-channel-name" to specific webhook URL in the config?

something like:

WebhookURLMapping:
  default: https://hooks.foo.bar/xxxxxxx
  my_second_channel: https://hooks.foo.bar/yyyyyyyy

I understand, that at the moment I can use legacy webhooks, but they will stop working eventually.

bygui86 commented 1 year ago

@hagaram meanwhile I suggest you to have a look at Botkube. It offers maybe too much features for your use case, but you can fine tune a lot and offers a good level of flexibility. If I'm not wrong, we are using it with "modern" slack webhooks with a single URL but sending messages to multiple channels. Hope that was helpful.