Custom notifications in Microsoft Teams

I started googling around to see if Teams had any PowerShell commandlets. Does not look like it, but its a work in progress. There is still a way to interact with Teams trough PowerShell.

There is a connector in Teams called Incoming Webhook. This connector can post notifications from any scripting language trough JSON formatted web service call.
This can be used to post for example a notification if there is a ping higher than 200ms on a group of servers. But, since it is Friday, I found a more suitable use of this function. Lets create a script that takes care of the weekly wine lottery draw.

First go to the desired channel in Teams and select Connectors from options.
options

Search for webhook and press Configure
wbhook
Set a name for the Incoming Webhook and press Create further down.
create.PNG

 

Copy the url and press Done.
url.PNG

teams msg.PNG

Write the script like this.
script

Set up the script as a weekly scheduled task and you are good to go.

winner.PNG

 

To read more on this topic read this article here:
https://blogs.technet.microsoft.com/privatecloud/2016/11/02/post-notifications-to-microsoft-teams-using-powershell/

 

Leave a reply to Custom notifications in Microsoft Teams | 365ForAll Cancel reply