Param (
[String]$AlertName,
[String]$AlertDescription,
[String]$AlertSource,
[String]$AlertTime
)
#Токен бота
$token = "750210674:AAEDtPopr-frY0gZAFMK3pn6ZZ2kKTeL58Q"
#ID чата, группы или лички
$сhatid = "-181086151"
#Замена кавычек
$AlertName = $AlertName.Replace("'",'"')
#Нормальный перенос строк
$AlertDescription = $AlertDescription.Replace("\n","`n")
#Удаление двойных процентов
#$AlertDescription = $AlertDescription.Replace("%%","")
#Удаление знака &
#$AlertDescription = $AlertDescription.Replace("&","")
#Собираем переменные в одну и переносим строки
$Message = $AlertName + "`n" + "`n" + "Status: " + $AlertResolutionState + "`n" + "Alert Time: " + $AlertTime + "`n" + "`n" + $AlertDescription + "`n" + "`n" + $AlertSource
#Тип данных Markdown
$payload = @{ "parse_mode" = "Markdown"; "disable_web_page_preview" = "True" }
#
$URL = "
https://api.telegram.org/bot$token/sendMessage?chat_id=$сhatid&text=$Message"
#
$request = Invoke-WebRequest -Uri $URL -Proxy 'http://srvproxy:8080' -Method Post `
-ContentType "application/json; charset=utf-8" `
-Body (ConvertTo-Json -Compress -InputObject $payload)