PS-Commands/Scripts/Send-ToTelegram.psm1

14 lines
311 B
PowerShell
Raw Normal View History

2023-11-03 16:25:24 +03:00
function Send-ToTelegram {
param (
[Parameter(Mandatory = $True)]$Text,
$token = "687...:AAF...",
$chat = "125468108"
)
$endpoint = "sendMessage"
$url = "https://api.telegram.org/bot$token/$endpoint"
$Body = @{
chat_id = $Chat
text = $Text
}
Invoke-RestMethod -Uri $url -Body $Body
}