Created
March 7, 2018 02:31
-
-
Save Pome-ro/cc0141fa4367b0569d65a30d15009eff to your computer and use it in GitHub Desktop.
Send-GHCWebhookMessage - Used for sending Text only messages to a Google Hangouts Chat Room Webhook.
This file contains 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
function Send-GHCWebhookMessage { | |
[CmdletBinding()] | |
param ( | |
# uri | |
[Parameter(Mandatory)] | |
[string] | |
$URI, | |
# Message | |
[Parameter(Mandatory)] | |
[string] | |
$Message | |
) | |
begin { | |
} | |
process { | |
$Message = ConvertTo-Json @{"text" = $Message} | |
Invoke-WebRequest -Uri $URI -Method POST -Headers @{"Content-Type" = 'Application/json; charset=UTF-8'} -Body $Message | |
} | |
end { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment