-
-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Develop v0.21.0 (additional notification channels) (#1647)
* 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
1 parent
811fbfc
commit 96f9dd3
Showing
44 changed files
with
1,652 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
37
app/Actions/Notifications/SendHealthCheckTestNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
41
app/Actions/Notifications/SendPushoverTestNotification.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
Oops, something went wrong.