The Teams Notification package for Laravel lets you send notifications to Microsoft Teams. You can send normal messages, messages with additional details, and even use this package's custom logging channel:
use Osama\LaravelTeamsNotification\TeamsNotification; // Normal messagenew TeamsNotification()->sendMessage("System Notification"); // Message with additional detailsnew TeamsNotification()->sendMessage("System Notification", [ 'Server' => 'Production', 'Status' => 'Running', 'Uptime' => '24 days']); // Send a tracetry { // ...} catch (\Exception $exception) { new TeamsNotification() ->bindTrace() ->error() ->sendException($exception);}
The logging functionality will send messages to a Teams channel using a configured logging channel:
Log::channel('teams')->info('This is an info message');
Features
- Send Normal Messages: Send simple text notifications to Teams.
- Send Messages with Additional Details: Include extra details in the notification.
- Send Success Messages: Highlight successful operations with a green color.
- Send Warning Messages: Indicate warnings with an orange color.
- Send Error Messages: Report errors with a red color and optional stack trace.
- Send Messages with JSON Blocks: Include formatted JSON data in the message.
- Custom Logging: Log messages directly to Microsoft Teams using Laravel’s logging system.
- Configurable Message Colors: Set custom colors for messages with predefined options.
You can learn more about this package, get full installation instructions, and view the source code on GitHub.