Powershell snippet to send messages to telegram
* Powershell snippet to send messages to telegram: [source,powershell] ------------------------------------------------------------------------------------ # send am message to telegram chat via powershell script # ====================================================== $api = '20****xw4' # botToken got with bot creation $chatId = '8***8' # got with query on bot chat $msg = 'Hello from powershell (server)' $restResponse = Invoke-RestMethod -Uri ('https://api.telegram.org/bot{0}/sendMessage?chat_id={1}&text={2}' -f $api, $chatId, $msg) -Proxy http://193.**.***.207:8080 $restResponse.ok # True ------------------------------------------------------------------------------------ * create telegram chat to send messages to: ** Create the Bot and get the token - open a chat with BotFather Bot. - write /newbot to BotFather, - fill all the needed information, write down the botToken (for $api) *
Kommentare