You can easily sort that as the date provided ($Result.message.date) is Unix based (Epoch), so basically the seconds passed since 1/1/1970.
$Sleep Start Time = [Int] (get-date -UFormat %s) #This will be used to check if the $Sleep Time has passed yet before sending a new notification out While ($Do Not Exit) I suggest you to go through Telegram’s documentation at https://core.telegram.org/bots/api#sendmessage to see other possible options.
Let’s think bigger, you’re deploying a new Virtual Machine with an automated script and, besides sending you a report via email, you want to know when it’s done so that you perhaps can go and work on the VM you just deployed, without continuously checking the status of the deployment.
Or imagine adding a simple Message after an SCCM Task Sequence has been completed or even just use it to alert in case of a low disk space etc. The PS script could have a part of the code that checks every X amount of time if somebody wrote something and if they did, it checks the message.
So because I’m such a noob here, I will actually go through the steps I’ve followed to get a Bot configured to work.
Note that a Bot is an easier way to handle this sort automation, but if you’re an advanced user, you could look directly into Telegram’s API which will be way more flexible.