Releases: herpaderpaldent/seat-notifications
Version 1.0.7 - RateLimit
This version attempts to better solve rate limiter issues.
Unique Modal Identifier
Merge pull request #14 from herpaderpaldent/dev use unique modal identifier
Version 1.0.5 - Jobs to dispatch + improvements
- avoid conflic with @warlof discord-connector
- add markdown link to discord notification
- use job to dispatch notification
- include version hint
Support Seat-Groups Notifications
With this version other packages as f.e. seat-groups may provide notifications.
Trying to only allow 1 worker per notification
Merge pull request #9 from herpaderpaldent/dev Dev
Redis for the victory?
Merge pull request #7 from herpaderpaldent/dev Version 1.0.2
Version 1.0.1 - Installation Bugs
Updated dependencies in composer.json and some installation bugs
Version 1.0.0
seat-notifications
Installation
- cd to
/var/www/seat
- enter
composer require herpaderpaldent/seat-notifications
- run migration
php artisan migrate
Enable Notification Channel
To enable seat-notifications
functionality of sending notifications. Create a bot for your notification channel. By default seat-notifications offers two notification channels which could be extended by other packages: slack
and discord
:
a more detailed guide on oAuth creation will follow for now the blow table must suffice:
Notification Channel | Redirect URLs | Comment |
---|---|---|
Discord | {seat_url}/seatnotifications/discord/configuration/callback/server | This callback url is needed for the configuration of your discord bot. |
Discord | {seat_url}/seatnotifications/discord/callback/user | This callback url is needed for the authentication of a discord user. |
Slack | {seat_url}/seatnotifications/slack/configuration/callback/server | This callback url is needed for the configuration of your slack bot. |
Slack | {seat_url}/seatnotifications/slack/callback/user | This callback url is needed for the authentication of a slack user. |
Note: you may only configure one notification channel at your will. However, for discord you must create a bot in your application. For Slack you need to add the bot permission to your oauth scope.
Setup Roles
To be able to subsripe to a notification the user needs the appropriate permission. Please setup a role that carries the needed permission and assign it to users that should be able to receive the notification.
Authenticate
Users need to authenticate for your setup notification channel prior to receiving notifications. they may do this in the registration box on the notification page.
What does the package do at the moment
- Send
RefreshTokenDeleted
Notification to Discord and/or Slack when arefresh_token
is deleted. - Using Model Observer to dispatch Notifications
- Notifications are queueable and send out via the queue.
- The RefreshTokenNotification is able to be delivered to Channels or via DM on the users preference.
Developing
Most importantly: take note of laravel's notification documentation. The provided example of RefreshTokenDeletedNotification is based upon it. Notifications are being send by using the Notification
facade:
Notification::send($receipients, (new RefreshTokenDeletedNotification($refresh_token)));
where $receipients
are a collection of modal that should receive the notification and $refresh_token
is the deleted refresh_token
that is passed to the constructor. In this example we use an Observer to send notifications: Observer.
Add new channels
If you have written a new notification channel that you would like to use for sending notifications to your users you might extend config/services.php
similar to the provided example:
'seat-notification-channel' => [
'discord' => Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\Discord\DiscordNotificationChannel::class,
],
Your channel should extend BaseNotificationChannel
namespace Herpaderpaldent\Seat\SeatNotifications\Http\Controllers;
use Seat\Web\Http\Controllers\Controller;
abstract class BaseNotificationChannel extends Controller
{
abstract protected function getSettingsView();
abstract protected function getRegistrationView();
}
Add new notifications
If you want to extend the available notifications you need to extend the seat-notification
array in config/services.php
:
'seat-notification' => [
'refresh_token' => Herpaderpaldent\Seat\SeatNotifications\Http\Controllers\Notifications\RefreshTokenController::class,
],
Your custom notification must contain the following public functions to add your notification to the users notification list:
public function getNotification()
{
return 'seatnotifications::refresh_token.notification';
}
public function getPrivateView()
{
return 'seatnotifications::refresh_token.private';
}
public function getChannelView()
{
return 'seatnotifications::refresh_token.channel';
}
the functions should return a string containing the name of your view that should be rendered per column.
Initial Release (the right one)
This is the initial release of seat-notifications.
there are still lots of things to iron out and documentation missing. But it sets base for any other package-developer to hook into the service to send notifications to the two most populate communnication tools: slack and discord.
More documentations and update of the readme will follow afoot. Most importantly for me is to make it public and collect feedback: UI, Workflow etc. please let me know any of your findings.