Laravel Google Chat Alerts is a package by Guy Warner to send a message to Google chat quickly. Inspired by Spatie's Laravel Slack Alerts Package, this package does the same for Google Chat:
1use GuyWarner\GoogleChatAlerts\Facades\GoogleChatAlert;2 3GoogleChatAlert::message(4 "You have a new subscriber to the {$newsletter->name} newsletter!"5);
With the above code, you can send a message quickly without the overhead of the (excellent) Laravel notifications system. This package sends alerts as a job to prevent your app from failing in case Google chat is down.
Like the Spatie package for Slack, this package supports multiple channels and the ability to select which channel to which to send an alert:
1// in config/google-chat-alerts.php2 3'webhook_urls' => [4 'default' => 'https://chat.googleapis.com/v1/spaces/XXXX',5 'sales' => 'https://chat.googleapis.com/v1/spaces/YYYYYY',6],7 8GoogleChatAlert::to('sales')9 ->message("You have a new subscriber to the {$newsletter->name} newsletter!");
Additional features include using markdown and the ability to mention all users in a channel:
1GoogleChatAlert::message("New support ticket. <users/all>");
Check out this fantastic package on GitHub at guywarner/laravel-google-chat-alerts, which includes documentation, installation, and usage instructions.
0 comments:
Post a Comment
Thanks