nwilging / laravel-slack-bot

A Slack bot integration for Laravel projects
MIT License
17 stars 2 forks source link

Does this conflict with the default laravel/slack-notification-channel package? #18

Closed JackWH closed 2 years ago

JackWH commented 2 years ago

I see this package binds to slack as the notification channel name — but so does Laravel's default Slack notification channel: https://github.com/laravel/slack-notification-channel/blob/2.0/src/SlackChannelServiceProvider.php

My app uses Laravel's basic Slack notifications to send internal messages to our team, but I'd also like to use this API-based package for more advanced notifications elsewhere in the app.

Can these two be run alongside each other without conflicting? If not, would it be worth renaming this package's channel to something like slackBot or similar?

Thanks!

nwilging commented 2 years ago

Hey Jack, yes it does conflict/replace the first-party package. I appreciate the feedback because I was going back and forth on this design initially, and figured that people would likely want to use only one slack notifications package.

However given your use case, it would make sense to allow both packages to run side by side.

The via extension is an easy change. The first party Laravel package also uses the toSlack method to generate a notification array, so this package will need to use a different method.

Overall I think this is a valid suggestion. I'll make updates today and get v0.3.0 out.

nwilging commented 2 years ago

This will be resolved in #19


You will need to add the following to your .env:

SLACK_API_DRIVER_NAME=slackBot

Your notification class should also implement Nwilging\LaravelSlackBot\Contracts\Notifications\SlackApiNotificationContract and use the toSlackArray method to return the message array needed for this package, to avoid conflicts with laravel/slack-notification-channel's toSlack() method.

JackWH commented 2 years ago

@nwilging That's brilliant, thank you! 👍