https://github.com/isaacdarcilla/laravel-teams-notification
A Laravel package that integrates Microsoft Teams webhook 🔔
https://github.com/isaacdarcilla/laravel-teams-notification
hooks laravel ms msteams notification php webhook
Last synced: 7 months ago
JSON representation
A Laravel package that integrates Microsoft Teams webhook 🔔
- Host: GitHub
- URL: https://github.com/isaacdarcilla/laravel-teams-notification
- Owner: isaacdarcilla
- License: mit
- Created: 2023-04-04T12:39:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-31T00:47:29.000Z (almost 2 years ago)
- Last Synced: 2025-01-24T18:25:50.811Z (9 months ago)
- Topics: hooks, laravel, ms, msteams, notification, php, webhook
- Language: PHP
- Homepage: https://packagist.org/packages/laravel-teams-notification/laravel-teams-notification
- Size: 53.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
## A simple Laravel package that integrates Microsoft Teams webhook.
[](https://packagist.org/packages/laravel-teams-notification/laravel-teams-notification)
[](https://github.com/isaacdarcilla/laravel-teams-notification/actions?query=workflow%3Arun-tests+branch%3Amain)
[](https://packagist.org/packages/laravel-teams-notification/laravel-teams-notification)#### Installation
You can install the package via composer:
```bash
composer require laravel-teams-notification/laravel-teams-notification
```You can publish the config file with:
```bash
php artisan vendor:publish --tag="laravel-teams-notification-config"
```This is the contents of the published config file:
```php
return [
/*
|--------------------------------------------------------------------------
| Webhook URL
|--------------------------------------------------------------------------
|
| The webhook URL where we post a request
| You can generate test webhook URL in https://typedwebhook.tools/
| or through MS Teams Incoming WebHook
|
*/
'webhook_url' => env('WEBHOOK_URL', 'your_webhook_url'),
];
```Then, you can add `WEBHOOK_URL` in your `.env` file. More information about how to setup webhook in MS teams in
this [link](https://learn.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/add-incoming-webhook?tabs=dotnet).#### Usage
```php
TeamsNotification::create()
->webHookUrl('your_webhook_url')
->payload([
'type' => 'MessageCard',
'context' => 'https://schema.org/extensions',
'themeColor' => '0076D7',
'summary' => 'Hello, World',
'sections' => [
[
'activityTitle' => 'Hello, World!',
]
]
])
->dispatch();
```#### Screenshot
More samples and screenshot of how the message should look can be found in `screenshots` folder.
#### Testing
```bash
composer test
```#### Credits
- [Isaac D. Arcilla](https://github.com/isaacdarcilla)
#### License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.