Skip to content

Commit

Permalink
Develop v0.21.0 (additional notification channels) (#1647)
Browse files Browse the repository at this point in the history
* Add Placeholder text for notifications (#1570)

first_commit

* Add Gotify Notifications via Webhook (#1561)

* first_commit

* Ready!

* Add_placeholder

* change url

---------

Co-authored-by: Alex Justesen <[email protected]>

* Add Support for Slack Notifications via Webhook (#1522)

* First Commit

* Fix lint

* add_url_placeholder

* Fix the liniting

* Add HealthCheck.io Notifications via Webhooks (#1567)

* first_commit

* linting

* add_descrip_for_threshold

* Change name

* add_url_placeholder

* fix_linting

* Add Pushover Notifications via Webhooks (#1574)

* add_pushover

* add_placeholder

* Linting

---------

Co-authored-by: Alex Justesen <[email protected]>

* Add ntfy Notifications via Webhooks (#1579)

* first_push

* Fix_json_payload

* Add_auth_option

* fix lint

* fix packet_loss_%

* added eof line

---------

Co-authored-by: Alex Justesen <[email protected]>

* Add Ookla URL to the notification (#1615)

* first commit

* added eof line

---------

Co-authored-by: Alex Justesen <[email protected]>

* Fix notifications layouts (#1639)

first commit

---------

Co-authored-by: Sven van Ginkel <[email protected]>
  • Loading branch information
alexjustesen and svenvg93 authored Aug 8, 2024
1 parent 811fbfc commit 96f9dd3
Show file tree
Hide file tree
Showing 44 changed files with 1,652 additions and 1 deletion.
37 changes: 37 additions & 0 deletions app/Actions/Notifications/SendGotifyTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendGotifyTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Gotify urls!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
WebhookCall::create()
->url($webhook['url'])
->payload(['message' => '👋 Testing the Gotify notification channel.'])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test Gotify notification sent.')
->success()
->send();
}
}
37 changes: 37 additions & 0 deletions app/Actions/Notifications/SendHealthCheckTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendHealthCheckTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add HealthCheck.io urls!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
WebhookCall::create()
->url($webhook['url'])
->payload(['message' => '👋 Testing the HealthCheck.io notification channel.'])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test HealthCheck.io notification sent.')
->success()
->send();
}
}
49 changes: 49 additions & 0 deletions app/Actions/Notifications/SendNtfyTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendNtfyTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add ntfy urls!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
$webhookCall = WebhookCall::create()
->url($webhook['url'])
->payload([
'topic' => $webhook['topic'],
'message' => '👋 Testing the ntfy notification channel.',
])
->doNotSign();

// Only add authentication if username and password are provided
if (! empty($webhook['username']) && ! empty($webhook['password'])) {
$authHeader = 'Basic '.base64_encode($webhook['username'].':'.$webhook['password']);
$webhookCall->withHeaders([
'Authorization' => $authHeader,
]);
}

$webhookCall->dispatch();
}

Notification::make()
->title('Test ntfy notification sent.')
->success()
->send();
}
}
41 changes: 41 additions & 0 deletions app/Actions/Notifications/SendPushoverTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendPushoverTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Pushover URLs!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
WebhookCall::create()
->url($webhook['url'])
->payload([
'token' => $webhook['api_token'],
'user' => $webhook['user_key'],
'message' => '👋 Testing the Pushover notification channel.',
])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test Pushover notification sent.')
->success()
->send();
}
}
37 changes: 37 additions & 0 deletions app/Actions/Notifications/SendSlackTestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Actions\Notifications;

use Filament\Notifications\Notification;
use Lorisleiva\Actions\Concerns\AsAction;
use Spatie\WebhookServer\WebhookCall;

class SendSlackTestNotification
{
use AsAction;

public function handle(array $webhooks)
{
if (! count($webhooks)) {
Notification::make()
->title('You need to add Slack URLs!')
->warning()
->send();

return;
}

foreach ($webhooks as $webhook) {
WebhookCall::create()
->url($webhook['url'])
->payload(['text' => '👋 Testing the Slack notification channel.'])
->doNotSign()
->dispatch();
}

Notification::make()
->title('Test Slack notification sent.')
->success()
->send();
}
}
Loading

0 comments on commit 96f9dd3

Please sign in to comment.