Today at work we switched away from Telegram to using MS Teams for our company messenger.

Since we we’re already paying for it it made sense to plus it offers a lot more than just a messenger such as custom wiki functionality.

One of the things we were making use of was telegram bots for our applications to sent us updates on key events of interest.

I’ve only recently started to make use of Laravels notifications in the projects I’ve been working on and to send messages via telegram I’d been using this package.

However whilst I’d found documentation that said that sending messages to MS Teams was possible there didn’t seem to be a notification channel for laravel.

So I went about building a basic one today:

Laravel Notifications for Microsoft Teams

There were other packages for MS Teams that already existed like:

but I really wanted to leverage Laravel’s notification mechanism so that i could switch out the Telegram driver with this new one and be up and running.

The github page has a lot more detail but after installing the package with composer and doing some minimal configuration I was able to switch all of our notifications away from telegram in a matter of minutes.

return MsTeamsMessage::create()
->title('Here is a test notification sent from the '.ucfirst(app()->environment()).' environment')
->content("Here is some content for the notification.
> That also supports markdown formatting in the body too!
Below are optional buttons and images.
->button('And some clickable buttons', '')

The code above produced the following notification in one of our team rooms.

MS Teams Notification Sent By Laravel

I know we’ll be making use of this in a lot of our projects at work, hopefully this will help someone else out too!