33 lines
777 B
PowerShell
33 lines
777 B
PowerShell
[string] $appriseWebhookURL = $ENV:APPRISEWEBHOOKURL
|
|
[string] $appriseWebhookTag = $ENV:APPRISEWEBHOOKTAG
|
|
|
|
function Send-AppriseNotification
|
|
{
|
|
param(
|
|
# Title of the notification
|
|
[Parameter(Mandatory=$true)]
|
|
[string]
|
|
$title,
|
|
|
|
# Content of the notification
|
|
[Parameter(Mandatory=$true)]
|
|
[string]
|
|
$content
|
|
)
|
|
|
|
$headers = @{
|
|
"Content-Type"="application/json"
|
|
}
|
|
$body = @{
|
|
title=$title
|
|
body=$content
|
|
tags="$appriseWebhookTag"
|
|
}
|
|
$json = $body | ConvertTo-Json
|
|
try {
|
|
Invoke-WebRequest -URI $appriseWebhookURL -Method post -Body $json -Headers $headers
|
|
}
|
|
catch {
|
|
Write-Host "Notification Error Encountered: $($global:Error[0])"
|
|
}
|
|
} |