Now, what I like the most, what if Powershell can read what we’re writing into that conversation and based on that take actions? If the message equals to “Restart-Computer” then go and restart the computer.
This is a very basic example, but it contain the core of what this can be used for.
This should explain all steps for Automating Telegram Messages with Powershell!
Telegram is similar to Whatsapp: https://telegram.org/ but with full Cross platform support!
https://telegram.org/apps and the ability to control Domoticz via Telegram messages.
In June 2015 Telegram introduced a bot platform: https://telegram.org/blog/bot-revolution, using this approach there is no need to install any software on your Domoticz system in order to use Telegram purely for notification.
From your Telegram client - connect to Bot Father and follow the conversation below (your inputs are in italics and unindented): Store your bot name, username and token safely.
If this is not good enough and you only want a private communication, you can send the link to your Bot to your friend(s): https://telegram.me/userbot This will work either if it is a Group Chat or not.
It took me a little bit to work with this json but it wasn’t too difficult.
Bias)*60 #Finally, $Initial Message Date_No Daylight Savings will be in the same timezone as Telegram's updates $Initial Message Date_No Daylight Savings = $Initial Message Date - $Time Zone Bias In Seconds #Read the responses in a while cycle until the "Magic Word is matched" $Do Not Exit = 1 $Counter = 1 #This will count the amount of time the Bot is asking!
$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.