gpressutto5 / laravel-slack

:hash: Slack notification for Laravel as it should be. Easy, fast, simple and highly testable.
MIT License
289 stars 41 forks source link

Sending to multiple channels from one webhook URL #7

Open tigran-cl opened 6 years ago

tigran-cl commented 6 years ago

Hi there, awesome job on the package, have a question for you.. In your examples you are able to send to different slack channels, for me, one webhook url, only allows me to send to a single channel. Specifying the channel in the to() function has no effect for me, it still sends it to the channel associated with the webhook url.

So I guess my question is, how did you generate your webhook url on slack so that you are able to send to multiple channels using a single webhook url? It doesn't seem possible from what I've found on google, it seems like you need a unique webhook url for each channel.

henriqueramos commented 5 years ago

Seems Slack removed this option.

https://api.slack.com/custom-integrations/incoming-webhooks#migrating_from_legacy_incoming_webhooks

gianemi2 commented 5 years ago

Is not possible to add multiple slack incoming webhooks?

tigran-cl commented 5 years ago

@gianemi2 it is possible, I ended up forking this package so that I can point a channel to a webhook url in the config file. My only use case was to send to different channels though, I haven't tested sending to users and other stuff so use at your own risk... https://github.com/tigran-cl/laravel-slack

tranghaviet commented 5 years ago

Nice work. @tigran-cl Can you make a pull request?

freynolds commented 5 years ago

Channel Override Incoming webhooks have a default channel, but it can be overridden in your JSON payload. A public channel can be specified with "channel": "#other-channel", and a Direct Message with "channel": "@username".

When creating a webhook

roerjo commented 5 years ago

@freynolds that is a legacy option and does not work with new integrations.

https://api.slack.com/custom-integrations/incoming-webhooks

connecteev commented 5 years ago

@gianemi2 it is possible, I ended up forking this package so that I can point a channel to a webhook url in the config file. My only use case was to send to different channels though, I haven't tested sending to users and other stuff so use at your own risk... https://github.com/tigran-cl/laravel-slack

@tigran-cl Given that Slack only allows you to send to one channel (or user) per webhook, this package needs the ability to configure multiple webhook URLs, so that I can send a slack message to #my-channel or @my-user using one package. Can you please create a pull request?