Now for Laravel, “Google Chat” notification channel package available for Laravel Notification Channels Projects. This package makes it simple to send notifications by using of a custom Google talk message channel.
Create a simple message
Code 1
// Create a simple messagepublic function toGoogleChat($notifiable){return GoogleChatMessage::create("Kitty's bill was paid!");}
Classes for formatting layouts
Using the package’s provided classes, You can do simple formatting & advanced card layouts.
Code 2
// Simple text formatting and routing to a specific chat roomGoogleChatMessage::create()->text('Kitty just paid an bill ')->bold('Success!')->line('Please check ')->link(route('bills'), 'bills!')->to('sales_team'); // ... and route it to specific rooms// Advanced card layoutGoogleChatMessage::create()->text('Bill Paid! Here's the details:')->card(Card::create(Section::create(KeyValue::create('Amount', '$20.99', '#23451234')->onClick(route('bills'))->button(TextButton::create(route('bills'), 'View')))));
Convinces with Laravel? We are here to help you build high-performance Laravel web App!
“Alternate” rooms concept
Also, the “alternate” rooms concept is available in this package, instead of the defaults, you can configure to explicitly send messages to a Google chat room.
Code 3
// config/google-chat.phpreturn ['spaces' => ['dev_team' => 'https://chat.googleapis.com/dev-team-room?key=xxxxx',// ...]];// UsageGoogleChatMessage::create()->to('dev_team')->...
Learn More:
About learning this package, visit GitHub for, full instruction for installation, and view the source code. For complete setup and usage details check out Laravel Notification channels documentation.