This PowerShell Module allows to send notifications to Microsoft Teams. It's pretty flexible and provides a bunch of options. While there are already 2 other modules related to sending notifications to Teams this one takes it a step further. Inspiration for this module came  from Matthew Houston and was my starting point. In it's newest form it's cross-platform so you're able to send notifications from your PowerShell Scripts/Modules on Windows / Linux or MacOs.

Note worthy features
Send feature rich notifications to Microsoft Teams
Fairly easy to use
No license needed. Free to use.
Open source
Cross-plaform (Win/Linux/Mac)
PowerShell 5.1 or Higher
Useful links
Code is published on GitHub
Issues should be reported on GitHub
Code is published as a module on PowerShellGallery
Related articles
New version (0.2.x), adds cross-platform. Now works on Windows / Linux and Mac
How can I use it?

Below is one of big example that covers lots of options showing current possibilities of this PSTeams module.

Clear-Host
Import-Module PSTeams 

$TeamsID = 'https://outlook.office.com/webhook/a5c7c95a....'

$Color = 'Chocolate'

$Button1 = New-TeamsButton -Name 'Visit English Evotec Website' -Link "https://evotec.xyz"
$Button2 = New-TeamsButton -Name 'Visit Polish Evotec Website' -Link "https://evotec.pl"

$Fact1 = New-TeamsFact -Name 'Bold' -Value '**Special Bold value**'
$Fact2 = New-TeamsFact -Name 'Italic and Bold' -Value '***Italic and Bold value***'
$Fact3 = New-TeamsFact -Name 'Italic' -Value 'Date with italic *2010-10-10*'
$Fact4 = New-TeamsFact -Name 'Link example' -Value "[Microsoft](https://www.microsoft.com)"
$Fact5 = New-TeamsFact -Name 'Other link example' -Value "[Evotec](https://evotec.xyz) and some **bold** text"
$Fact6 = New-TeamsFact -Name 'This is how list looks like' -Value "
* hello
    * 2010-10-10
* test
    * another
* test
* hello"
$Fact7 = New-TeamsFact -Name 'This is strike through example' -Value "<strike> This is strike-through </strike>"
$Fact8 = New-TeamsFact -Name 'List example with nested list' -Value "
- One value
- Another value
    - Third value
        - Fourth value
"
$Fact9 = New-TeamsFact -Name 'List example with a twist' -Value "
1. First ordered list item
2. Another item
* Unordered sub-list.
1. Actual numbers don't matter, just that it's a number
    1. Ordered sub-list
    2. Another entry
4. And another item.
"

$Fact10 = New-TeamsFact -Name 'Code highlight' -Value "This is ``showing code highlight`` "
$Fact11 = New-TeamsFact -Name '' -Value "

### As you see I've not added Name at all for this one and it merges a bit with Fact 10

This is going to add horizontal line below. While this line is highlighed.

---

And a block quote
> Block quote

# H1
## H2
### H3
#### H4
##### H5
###### H6

"


$Section1 = New-TeamsSection `
    -ActivityTitle "**Przemyslaw Klys**" `
    -ActivitySubtitle "@przemyslawklys - 9/12/2016 at 5:33pm" `
    -ActivityImageLink "https://pbs.twimg.com/profile_images/1017741651584970753/hGsbJo-o_400x400.jpg" `
    -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732" `
    -Buttons $Button1, $Button2 `
    -ActivityDetails $Fact1, $Fact2

$Section2 = New-TeamsSection `
    -ActivityTitle "**Przemyslaw Klys**" `
    -ActivitySubtitle "@przemyslawklys - 9/12/2016 at 5:33pm" `
    -ActivityImageLink "https://pbs.twimg.com/profile_images/1017741651584970753/hGsbJo-o_400x400.jpg" `
    -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732" `
    -Buttons $Button1 `
    -ActivityDetails $Fact3, $Fact4, $Fact5, $Fact6, $Fact7, $Fact8, $Fact9, $Fact10, $Fact11

$Section3 = New-TeamsSection `
    -ActivityTitle "**Przemyslaw Klys**" `
    -ActivitySubtitle "@przemyslawklys - 9/12/2016 at 5:33pm" `
    -ActivityImage Add `
    -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732" `
    -Buttons $Button1 `
    -ActivityDetails $Fact3, $Fact4, $Fact5, $Fact6, $Fact7, $Fact8, $Fact9, $Fact10, $Fact11

Send-TeamsMessage `
    -URI $TeamsID `
    -MessageTitle 'Message Title' `
    -MessageText 'This is text' `
    -Color Chocolate `
    -Sections $Section2, $Section1 

Send-TeamsMessage `
    -URI $TeamsID `
    -MessageTitle 'Message Title' `
    -MessageText 'This is text' `
    -Color Chocolate `
    -Sections $Section3

PSTeams

While it may seem intimidating at first you just need to understand the concept. A message to Microsoft Teams consist of:

  • MessageTitle
  • MessageText
  • Color
  • Sections

You can only have 1 MessageTitle, 1 MessageText, 1 Color. You can however have multiple sections. Each section can consist of multiple fields:

  • ActivityTitle – 1x
  • ActivitySubtitle – 1x
  • ActivityImageLink – 1x – can use png / jpg from internet – disabled when ActivityImage is used
  • ActivityImage (uses .jpg files that are available with module) – not really recommended to use
  • ActivityText – 1x
  • Buttons – Multiple buttons
  • ActivityDetails – Multiple facts
$Section3 = New-TeamsSection `
    -ActivityTitle "**Przemyslaw Klys**" `
    -ActivitySubtitle "@przemyslawklys - 9/12/2016 at 5:33pm" `
    -ActivityImage Add `
    -ActivityText "Climate change explained in comic book form by xkcd xkcd.com/1732" `
    -Buttons $Button1 `
    -ActivityDetails $Fact3, $Fact4, $Fact5, $Fact6, $Fact7, $Fact8, $Fact9, $Fact10, $Fact11

As seen above you can create multiple buttons

$Button1 = New-TeamsButton -Name 'Visit English Evotec Website' -Link "https://evotec.xyz"
$Button2 = New-TeamsButton -Name 'Visit Polish Evotec Website' -Link "https://evotec.pl"

And multiple facts (to use with ActivityDetails).

$Fact1 = New-TeamsFact -Name 'Bold' -Value '**Special GPO**'
$Fact2 = New-TeamsFact -Name 'Italic and Bold' -Value '***Other values***'
$Fact3 = New-TeamsFact -Name 'Italic' -Value '*2010-10-10*'
$Fact4 = New-TeamsFact -Name 'Link example' -Value "[Microsoft](https://www.microsoft.com)"
$Fact5 = New-TeamsFact -Name 'Other link example' -Value "[Evotec](https://evotec.xyz) and some **bold** text"

As you can see above you can use simple markdown to format your Teams Cards.

How to set it up?

Create channel or use the own you want to use

Press 3 dots and open up Connectors.

From the list of connectors choose Incoming Webhook

Name your Incoming Webhook, upload an image you want webhook to use.

Finally when you create connector all you have to do now is copy the URI from connector to use in scripts.

In my example this is called TeamsID. Enjoy!

This is a unique website which will require a more modern browser to work! Please upgrade today!