Created
April 1, 2016 12:42
-
-
Save sjkp/c40995b2e395b02056fde82c97786856 to your computer and use it in GitHub Desktop.
Posts an action card to Office Group using the WebHook Connector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Posts an action card to Office Group using the WebHook Connector | |
.DESCRIPTION | |
. | |
.PARAMETER url | |
The url to the web hook connector as registered in the Office 365 Group. | |
.PARAMETER title | |
The title to show on the action card. | |
.PARAMETER message | |
The message to show on the action card. | |
.PARAMETER actionLink | |
The url of the action link button on the card. | |
.PARAMETER actionLinkText | |
The button text on the action link button. | |
.NOTES | |
Author: Simon J.K. Pedersen | |
Date: April 1, 2016 | |
#> | |
param( | |
[string][Parameter(Mandatory=$true)]$url, | |
[string][Parameter(Mandatory=$true)]$title, | |
[string][Parameter(Mandatory=$true)]$message, | |
[string][Parameter(Mandatory=$true)]$actionLink, | |
[string][Parameter(Mandatory=$true)]$actionLinkText="View in VSO" | |
) | |
$request= @{text=$message;title=$title;potentialAction=@(@{ | |
'@context'="http://schema.org"; | |
name=$actionLinkText; #Title of the action button | |
'@type'="ViewAction"; | |
target=@($actionLink) #Link that the action button takes you to | |
})} | |
$json = ConvertTo-Json $request -Depth 3 | |
Write-Host $json | |
Invoke-RestMethod -Uri $url -Method Post -Body $json -ContentType "application/json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment