PHPackages                             laravel-notification-channels/microsoft-teams - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. laravel-notification-channels/microsoft-teams

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

laravel-notification-channels/microsoft-teams
=============================================

A Laravel Notification Channel for Microsoft Teams

2.2.1(1mo ago)1603.0M↓12.9%306MITPHPPHP ^8.3CI passing

Since Apr 28Pushed 1mo ago10 watchersCompare

[ Source](https://github.com/laravel-notification-channels/microsoft-teams)[ Packagist](https://packagist.org/packages/laravel-notification-channels/microsoft-teams)[ Docs](https://github.com/laravel-notification-channels/microsoft-teams)[ Fund](https://paypal.me/TMadner)[ GitHub Sponsors](https://github.com/Tob0t)[ RSS](/packages/laravel-notification-channels-microsoft-teams/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (22)Used By (6)

Microsoft Teams Notifications Channel for Laravel
=================================================

[](#microsoft-teams-notifications-channel-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2981a559032fddb8bb92a93dadb01443f5e68efc39638815985b220474684c7b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f6d6963726f736f66742d7465616d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/microsoft-teams)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Total Downloads](https://camo.githubusercontent.com/bc181e74dfde3bf58f8145535ee36328be7ed99e10be28e918f03efbaf22e085/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c61726176656c2d6e6f74696669636174696f6e2d6368616e6e656c732f6d6963726f736f66742d7465616d732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/laravel-notification-channels/microsoft-teams)

This package makes it easy to send notifications using [Microsoft Teams](https://products.office.com/en-US/microsoft-teams/group-chat-software) with 11.x and 12.x.

*This package also supports lower versions of Laravel, however they are not maintained anymore. If you are running Laravel version &lt;12 please use v2.1.x or lower.*

**Since v2 we transitioned from traditional message cards to [MS Adaptive Cards](https://adaptivecards.io). In case you need to upgrade please check out our [Migration Guide](/UPGRADE.md).**

```
return MicrosoftTeamsAdaptiveCard::create()
    ->to(config('services.microsoft_teams.webhook_url'))
    ->title('Subscription Created')
    ->content([
        TextBlock::create()
            ->setText('Yey, you got a **new subscription**.')
            ->setFontType('Monospace')
            ->setWeight('Bolder')
            ->setSize('ExtraLarge')
            ->setSpacing('ExtraLarge')
            ->setStyle('Heading')
            ->setHorizontalAlignment('Center')
            ->setSeparator(true),
        FactSet::create()
            ->setSpacing('ExtraLarge')
            ->setSeparator(true)
            ->setFacts([
                Fact::create()->setTitle('Subscription Created')->setValue('Today'),
            ])
    ])
    ->actions([
        ActionOpenUrl::create()
            ->setMode('Primary')
            ->setStyle('Positive')
            ->setTitle('Contact Customer')
            ->setUrl("https://www.tournamize.com"),
    ]);
```

Contents
--------

[](#contents)

- [Microsoft Teams Notifications Channel for Laravel](#microsoft-teams-notifications-channel-for-laravel)
    - [Contents](#contents)
    - [Installation](#installation)
        - [Setting up the Connector](#setting-up-the-connector)
        - [Setting up the MicrosoftTeams service](#setting-up-the-microsoftteams-service)
    - [Usage](#usage)
        - [On-Demand Notification Usage](#on-demand-notification-usage)
        - [Available Adaptive Card methods](#available-adaptive-cards-methods)
        - [Content Block Types](#content-block-types)
        - [Action Types](#action-types)
    - [Changelog](#changelog)
    - [Testing](#testing)
    - [Security](#security)
    - [Contributing](#contributing)
    - [Credits](#credits)
    - [License](#license)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require laravel-notification-channels/microsoft-teams
```

Next, if you're using Laravel *without* auto-discovery, add the service provider to `config/app.php`:

```
'providers' => [
    // ...
    NotificationChannels\MicrosoftTeams\MicrosoftTeamsServiceProvider::class,
],
```

### Setting up the Connector

[](#setting-up-the-connector)

Please check out [this](https://support.microsoft.com/en-us/office/create-incoming-webhooks-with-workflows-for-microsoft-teams-8ae491c7-0394-4861-ba59-055e33f75498) for setting up and adding a webhook connector to your Team's channel. Please also check out the [adaptive card reference](https://learn.microsoft.com/en-us/adaptive-cards/) which goes in more detail about adaptive cards.

### Setting up the MicrosoftTeams service

[](#setting-up-the-microsoftteams-service)

Then, configure your webhook url:

Add the following code to your `config/services.php`:

```
// config/services.php
...
'microsoft_teams' => [
    'webhook_url' => env('TEAMS_WEBHOOK_URL'),
],
...
```

You can also add multiple webhooks if you have multiple teams or channels, it's up to you.

```
// config/services.php
...
'microsoft_teams' => [
    'sales_url' => env('TEAMS_SALES_WEBHOOK_URL'),
    'dev_url' => env('TEAMS_DEV_WEBHOOK_URL'),
],
...
```

Usage
-----

[](#usage)

Now you can use the channel in your `via()` method inside the notification:

```
use Illuminate\Notifications\Notification;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsChannel;
use NotificationChannels\MicrosoftTeams\MicrosoftTeamsMessage;

class SubscriptionCreated extends Notification
{
    public function via($notifiable)
    {
        return [MicrosoftTeamsChannel::class];
    }

    public function toMicrosoftTeams($notifiable)
    {
        return MicrosoftTeamsAdaptiveCard::create()
            ->to(config('services.microsoft_teams.webhook_url'))
            ->title('Subscription Created')
            ->content([
                TextBlock::create()
                    ->setText('Yey, you got a **new subscription**.')
                    ->setFontType('Monospace')
                    ->setWeight('Bolder')
                    ->setSize('ExtraLarge')
                    ->setSpacing('ExtraLarge')
                    ->setStyle('Heading')
                    ->setHorizontalAlignment('Center')
                    ->setSeparator(true),
                FactSet::create()
                    ->setSpacing('ExtraLarge')
                    ->setSeparator(true)
                    ->setFacts([
                        Fact::create()->setTitle('Subscription Created')->setValue('Today'),
                    ])
            ])
            ->actions([
                ActionOpenUrl::create()
                    ->setMode('Primary')
                    ->setStyle('Positive')
                    ->setTitle('Contact Customer')
                    ->setUrl("https://www.tournamize.com"),
            ]);
    }
}
```

Instead of adding the `to($url)` method for the recipient you can also add the `routeNotificationForMicrosoftTeams` method inside your Notifiable model. This method needs to return the webhook url.

```
public function routeNotificationForMicrosoftTeams(Notification $notification)
{
    return config('services.microsoft_teams.sales_url');
}
```

### On-Demand Notification Usage

[](#on-demand-notification-usage)

To use on demand notifications you can use the `route` method on the Notification facade.

```
Notification::route(MicrosoftTeamsChannel::class,null)
    ->notify(new SubscriptionCreated());
```

### Available Adaptive Card methods

[](#available-adaptive-card-methods)

- `create()`: Static factory method to create a new instance of the MicrosoftTeamsAdaptiveCard.
- `to(string $webhookUrl)`: Sets the recipient's webhook URL. Required for sending notifications.
- `title(string $title)`: Sets the title of the adaptive card with appropriate text styling (heading style, bold weight, and large size).
- `fullWidth()`: Sets the adaptive card to take up the full width of the Teams channel or chat instead of the default width.
- `content(array $contentBlocks)`: Adds content blocks to the adaptive card body. Accepts an array of content block objects like TextBlock, FactSet, Icon, etc.
- `actions(array $actions)`: Adds action buttons to the adaptive card. Accepts an array of action objects like ActionOpenUrl.
- `getWebhookUrl()`: Returns the currently set webhook URL.
- `toNotGiven()`: Checks if the webhook URL has been provided. Returns true if no webhook URL is set.
- `toArray()`: Returns the complete payload as an associative array.

### Content Block Types

[](#content-block-types)

You can use various content block types in the content() method:

#### `TextBlock::create()`: Creates a text block with options for:

[](#textblockcreate-creates-a-text-block-with-options-for)

- `setText(string $text)`: Sets the text content (supports markdown formatting)
- `setFontType(string $fontType)`: Sets the font type (e.g., 'Default', 'Monospace')
- `setWeight(string $weight)`: Sets text weight (e.g., 'Lighter', 'Default', 'Bolder')
- `setSize(string $size)`: Sets text size (e.g., 'Small', 'Default', 'Medium', 'Large', 'ExtraLarge')
- `setSpacing(string $spacing)`: Sets spacing around the element (e.g., 'None', 'Small', 'Default', 'Medium', 'Large', 'ExtraLarge', 'Padding')
- `setStyle(string $style)`: Sets text style (e.g., 'Default', 'ColumnHeader', 'Heading')
- `setHorizontalAlignment(string $alignment)`: Sets text alignment (e.g., 'Left', 'Center', 'Right')
- `setSeparator(bool $separator)`: Adds a separator line above the element when true
- `setWrap(bool $wrap)`: Sets whether text should wrap or not
- `setColor(string $color)`: Sets text color (e.g., 'Default', 'Dark', 'Light', 'Accent', 'Good', 'Warning', 'Attention')
- `setIsSubtle(bool $isSubtle)`: Sets whether text should be subtle or not
- `setMaximumLines(int $maxLines)`: Sets the maximum number of lines for the text block
- `toArray()`: Returns the TextBlock properties as an array

#### `Icon::create()`: Creates an icon with options for:

[](#iconcreate-creates-an-icon-with-options-for)

- `setName(string $name)`: Sets the name of the icon
- `setColor(string $color)`: Sets icon color (e.g., 'Default', 'Dark', 'Light', 'Accent', 'Good', 'Warning', 'Attention')
- `setSpacing(string $spacing)`: Sets spacing around the icon (e.g., 'None', 'Small', 'Default', 'Medium', 'Large', 'ExtraLarge', 'Padding')
- `setSeparator(bool $separator)`: Adds a separator line above the element when true
- `setSize(string $size)`: Sets icon size (e.g., 'xxSmall', 'xSmall', 'Small', 'Standard', 'Medium', 'Large', 'xLarge', 'xxLarge')
- `setStyle(string $style)`: Sets icon style (e.g., 'Regular', 'Filled')
- `setHorizontalAlignment(string $alignment)`: Sets icon alignment (e.g., 'Left', 'Center', 'Right')
- `toArray()`: Returns the Icon properties as an array

#### `FactSet::create()`: Creates a set of facts with options for:

[](#factsetcreate-creates-a-set-of-facts-with-options-for)

- `setFacts(array $facts)`: Sets an array of Fact objects
- `setSpacing(string $spacing)`: Sets spacing around the element (e.g., 'None', 'Small', 'Default', 'Medium', 'Large', 'ExtraLarge', 'Padding')
- `setSeparator(bool $separator)`: Adds a separator line above the element when true
- `toArray()`: Returns the FactSet properties as an array

#### `Fact::create()`: Creates a single fact (key-value pair) with methods:

[](#factcreate-creates-a-single-fact-key-value-pair-with-methods)

- `setTitle(string $title)`: Sets the fact's title/key
- `setValue(string $value)`: Sets the fact's value
- `toArray()`: Returns the Fact properties as an array

### Action Types

[](#action-types)

You can use various action types in the actions() method:

#### `ActionOpenUrl::create()`: Creates a button that opens a URL with options for:

[](#actionopenurlcreate-creates-a-button-that-opens-a-url-with-options-for)

- `setTitle(string $title)`: Sets the button text
- `setUrl(string $url)`: Sets the URL to open when clicked
- `setStyle(string $style)`: Sets button style (e.g., 'Default', 'Positive', 'Destructive')
- `setMode(string $mode)`: Sets the interaction mode (e.g., 'Primary', 'Secondary')
- `toArray()`: Returns the ActionOpenUrl properties as an array

Support This Project
--------------------

[](#support-this-project)

This library was built in my free time out of passion for the community. If you find it useful, please consider [sponsoring me](https://github.com/sponsors/Tob0t) to help maintain and improve the project. Your support is greatly appreciated! Thank you! ❤️

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Credits
-------

[](#credits)

- [Tobias Madner](https://github.com/Tob0t)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

69

—

FairBetter than 100% of packages

Maintenance90

Actively maintained with recent releases

Popularity60

Solid adoption and visibility

Community31

Small or concentrated contributor base

Maturity80

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~113 days

Recently: every ~56 days

Total

20

Last Release

53d ago

Major Versions

1.3.0 → v2.0.02025-04-26

PHP version history (3 changes)v1.0.0PHP &gt;=7.2

v2.0.0-alpha.2PHP &gt;=8.1

2.2.0PHP ^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/20937037?v=4)[Laravel Notification Channels](/maintainers/laravel-notification-channels)[@laravel-notification-channels](https://github.com/laravel-notification-channels)

---

Top Contributors

[![Tob0t](https://avatars.githubusercontent.com/u/18067389?v=4)](https://github.com/Tob0t "Tob0t (33 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (16 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (6 commits)")[![jmurphy45](https://avatars.githubusercontent.com/u/1787262?v=4)](https://github.com/jmurphy45 "jmurphy45 (3 commits)")[![atymic](https://avatars.githubusercontent.com/u/50683531?v=4)](https://github.com/atymic "atymic (3 commits)")[![JoshuaLicense](https://avatars.githubusercontent.com/u/638172?v=4)](https://github.com/JoshuaLicense "JoshuaLicense (2 commits)")[![Seb33300](https://avatars.githubusercontent.com/u/915273?v=4)](https://github.com/Seb33300 "Seb33300 (2 commits)")[![Cannonb4ll](https://avatars.githubusercontent.com/u/3110750?v=4)](https://github.com/Cannonb4ll "Cannonb4ll (1 commits)")[![johnatricorocks](https://avatars.githubusercontent.com/u/156816377?v=4)](https://github.com/johnatricorocks "johnatricorocks (1 commits)")[![Douglasdc3](https://avatars.githubusercontent.com/u/5066883?v=4)](https://github.com/Douglasdc3 "Douglasdc3 (1 commits)")[![edikurniawan-dev](https://avatars.githubusercontent.com/u/50087198?v=4)](https://github.com/edikurniawan-dev "edikurniawan-dev (1 commits)")

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/laravel-notification-channels-microsoft-teams/health.svg)

```
[![Health](https://phpackages.com/badges/laravel-notification-channels-microsoft-teams/health.svg)](https://phpackages.com/packages/laravel-notification-channels-microsoft-teams)
```

###  Alternatives

[laravel-notification-channels/telegram

Telegram Notifications Channel for Laravel

1.1k3.4M35](/packages/laravel-notification-channels-telegram)[laravel-notification-channels/fcm

FCM (Firebase Cloud Messaging) Notifications Driver for Laravel

5917.0M16](/packages/laravel-notification-channels-fcm)[s-ichikawa/laravel-sendgrid-driver

This library adds a 'sendgrid' mail driver to Laravel.

4139.3M1](/packages/s-ichikawa-laravel-sendgrid-driver)[laravel-notification-channels/discord

Laravel notification driver for Discord.

2371.3M11](/packages/laravel-notification-channels-discord)[laravel-notification-channels/aws-sns

Amazon Simple Notification Service (AWS SNS) notification channel for Laravel.

541.1M2](/packages/laravel-notification-channels-aws-sns)[laravel-notification-channels/expo

Expo Notifications Channel for Laravel

64426.3k1](/packages/laravel-notification-channels-expo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
