Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Write-Slack {
- [cmdletbinding()]
- Param(
- [string]
- $Username = "<Default Username>",
- [string]
- $Channel = "<Default Channel>",
- [parameter(Mandatory=$true)]
- [string]
- $Text
- )
- $Body = New-Object -TypeName PSObject -Property @{'username'=$Username;
- 'channel'=$Channel;
- 'text'=$Text}
- $uri = "<Webhook URL provided by Slack>"
- Invoke-RestMethod -Method Post -Uri $uri -Body (ConvertTo-Json $Body)
- }
Advertisement
Add Comment
Please, Sign In to add comment