![]() ![]() Users can send messages of all types to bots, including text, files, locations, stickers, voice messages and even dice if they're feeling lucky. As a work around, should I need to send sensitive data I store the data securely and send a link via Telegram to that securely stored data instead.This page describes individual bot elements and features in detail. With this in mind, I personally wouldn’t send sensitive data via a Telegram. Whilst the connection via PowerShell Invoke-RestMethod is encrypted using TLS 1.2, it is not possible to know what is done by the Telegram API when receiving the message and sending it on. ![]() Running the function and sending some test messages: The request contains all of the elements gathered so far plus the message to be sent Line 6 : The command doing “the heavy lifting” - Invoke-RestMethod sends an HTTPS request to Telegram.Line 5 : This configures PowerShell to use the security protocol to TLS 1.2 when running the next command. ![]() Lines 3 + 4 : Your individual Telegram token and ID.Lines 1 + 2 : These identify the piece of code as a PowerShell function.See PowerShell Functions for further info if needed. The PowerShell script required to send a Telegram message is as follows: Filename: send-telegram.ps1 Function Send-Telegram Īfter adding your token and ID, the above PowerShell function can either cut an pasted into your individual PowerShell scripts or saved in your PowerShell path to be called using the command Send-Telegram. Take note of the Telegram Chat ID returned.Enter /start to get the bot to send you your Telegram Chat ID.From the Telegram home screen, search for chatid_echo_bot.Next you need to find your Telegram Chat ID. The full process can be seen in the screenshot below: Finally click the link to open a chat with the newly created bot.In the example below I setup a bot called PowerShell Alerts. When prompted, enter the friendly name of your bot.Open the Telegram app, click the search button and search for BotFather. Telegram bots are created via an automated account called BotFather. So that we can receive messages sent by PowerShell, we need to setup a bot first. In Telegram parlance, accounts operated by software are known as “bots”. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |