laravel / slack-notification-channel

Slack Notification Channel for laravel.

Home Page:https://laravel.com/docs/notifications#slack-notifications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Function to() doesn't work

ok200paul opened this issue · comments

  • Slack Notification Channel Version: 2.4.0
  • Laravel Version: 8.81.0
  • PHP Version: 8.0.15
  • Database Driver & Version: n/a

Description:

Specifying an alternative channel to send a slack notification to, does not work. Probably linked to #34 from back in 2020.

Steps To Reproduce:

  • Set up Slack integration as per L8 doco
  • Create a notification to be sent to a different channel than specified in the app
  • Notification gets sent to first channel.
// The app is set to send to a channel named #test-channel, but I want to send to #general
return (new SlackMessage())
            ->from('Ghost', ':ghost:')
            ->to('#general')
            ->content('This will be sent to #general');

Demo

https://github.com/ok200paul/l8-slack-channel-bug-report

You mention creating an app but we don't support that atm. Only incoming webhooks.

Hmm, I'll try to have a look at this to see if we can support apps as well. For now I don't think this will work sorry.

Hi Dries - not looking to reopen this, however, the doco mentions that we need to create a slack app for the integration to work, so yeah, we create an app. Does the doco needs to be updated? I might have been following them a little too closely if creating an app is not required! Doco screengrab:

image

The slack documentation indicates that we're (nowadays) unable to send incoming webhooks without setting up a slack app

Hey @ok200paul, you're correct. It seems we updated those docs incorrectly. I've sent in a PR to revert this as this currently doesn't work: laravel/docs#7651.

Like I said, I'll be looking into modernising the package hopefully soon so Slack Apps are supported as well.

@ok200paul we've decided to leave the current docs in place and just note the methods that don't work with Slack apps. It looks that you can't use from and to with Slack Apps right now. Should you figure out a way on how to do that we'd welcome PR's for it.

Will do, thanks Dries!