Skip to content

Instantly share code, notes, and snippets.

@Pome-ro
Created March 7, 2018 02:31
Show Gist options
  • Save Pome-ro/cc0141fa4367b0569d65a30d15009eff to your computer and use it in GitHub Desktop.
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.
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