Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Releases: herpaderpaldent/seat-notifications

Version 1.0.7 - RateLimit

12 Jan 14:35
f64fbbd
Compare
Choose a tag to compare

This version attempts to better solve rate limiter issues.

Unique Modal Identifier

09 Jan 21:28
effa5c7
Compare
Choose a tag to compare
Merge pull request #14 from herpaderpaldent/dev

use unique modal identifier

Version 1.0.5 - Jobs to dispatch + improvements

05 Jan 22:49
fce6fbb
Compare
Choose a tag to compare
  • avoid conflic with @warlof discord-connector
  • add markdown link to discord notification
  • use job to dispatch notification
  • include version hint

Support Seat-Groups Notifications

02 Jan 17:56
8421f0f
Compare
Choose a tag to compare

With this version other packages as f.e. seat-groups may provide notifications.

Trying to only allow 1 worker per notification

01 Jan 21:07
c84e915
Compare
Choose a tag to compare
Merge pull request #9 from herpaderpaldent/dev

Dev

Redis for the victory?

01 Jan 19:50
2ad7039
Compare
Choose a tag to compare
Merge pull request #7 from herpaderpaldent/dev

Version 1.0.2

Version 1.0.1 - Installation Bugs

31 Dec 11:24
6eec8f5
Compare
Choose a tag to compare

Updated dependencies in composer.json and some installation bugs

Version 1.0.0

30 Dec 14:43
8a242b1
Compare
Choose a tag to compare

seat-notifications

Installation

  1. cd to /var/www/seat
  2. enter composer require herpaderpaldent/seat-notifications
  3. 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:
configuration

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 a refresh_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.

Example:
image
picture

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)

29 Dec 18:39
25d92f8
Compare
Choose a tag to compare

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.

image

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.