Hi all, in the process of learning DragScript I wanted first of all to find a way to send custom notifications from Voyager to my phone via Telegram, because is free, reliable, cross platform and I use it for all sort of important notifications.
One of the (many!) fantastic features of Voyager is to allow custom scripts to be executed at key points, for example in several moments during a sequence (start, end, errors etc.), a flats sequence, or within anything else via DragScript! And these scripts can be be any language not just DragScript.
SO…follow me in this little hack/script to send free custom notifications to your Telegram. It requires some patience and some minimal computer knowledge, but is simpler than what you might think:
-
have a Telegram account (simply download the app on your phone and launch it). After having it on your phone, you can then have it also on your tabled and computer!
-
open a conversation with user “botfather” (search for it and you’ll find it. If you have problems, on the same phone simply open the url https://t.me/botfather and you should be asked to open it in Telegram)
-
start a conversation with the BotFather by typing “/newbot” (we are creating our private bot that is what we’ll use to send ourselves messages)
-
you will be asked for a Friendly name (for example “VoyagerMessages”) and a username ending in _bot (for example “VoyagerMessages_bot”). Once done, you will be provided with a Token (a long weird string) that we’ll need later, so save it somewhere.
-
now open your browser, and go to https://api.telegram.org/botYOUR-TOKEN/getUpdates (change YOUR-TOKEN with the weird string we were talking before). The page will be almost almost empty, is ok.
-
go back in Telegram, in the last message from BotFather it said at start “Congratulations on your new bot. You will find it at…”, click on that link and a new message room will open in Telegram, you’re talking to your bot now!
-
type a few random messages in this new message window with your bot, and quickly go back to your browser where you opened that page at point 5, and refresh it: you should see some gibberish including the messages you just sent (if not re-try a few times)
-
from all the gibberish, on each line of your messages there will something like (might be split in two lines): “chat”:{“id”:XXXXXX
-
get that XXXXXX number (called Chat Id) and save it somewhere together with the Token we got at point 4
-
now (almost finished!), open your Notepad, and paste what is below (change YYY with your Token from point 4 and ZZZ with your Chat id from point 9):
sAPI_ID = “YYY”
sChat_ID = “ZZZ”
sMSG = Wscript.Arguments(0)
sUrl = “https://api.telegram.org/bot” & sAPI_ID & “/sendMessage”
sRequest = “text=” & sMSG & “&chat_id=” & sChat_ID
HTTPPost sUrl, sRequest
Function HTTPPost(sUrl, sRequest)
set oHTTP = CreateObject(“Microsoft.XMLHTTP”)
oHTTP.open “POST”, sUrl,false
oHTTP.setRequestHeader “Content-Type”, “application/x-www-form-urlencoded”
oHTTP.setRequestHeader “Content-Length”, Len(sRequest)
oHTTP.send sRequest
HTTPPost = oHTTP.responseText
End Function
(PLEASE CHECK THE ATTACHED IMAGE, THERE ARE TWO EMPTY SPACES AT START OF LINES 8 TO 13, AND ONE EMPTY SPACE AT LINE 14, THAT YOU DON’T SEE HERE AND YOU MIGHT NEED TO ADD MANUALLY AFTER COPY/PASTE)
-
save it into a file called “telegram_me.vbs” (not .txt) in your Documents folder.
-
DONE! Let’s test it. Open a Command Prompt in Windows (type Command Prompt in the search), and call the script followed by the message you want to send to yourself! To do so, for example my user in Windows is called “GEastrophotography”, so I’ll type:
“C:\Users\GEastrophotography\Documents\telegram_me.vbs” “my first message!”
- Like magic, you’re now sending messages to yourself from your computer
Now…that script telegram_me.vbs can be called from Voyager, every time with a different message you want in ANY section where it says “Run this program/script” (Sequence, Flats), for example in a Sequence you have it at time start, end, error etc. (every time before and/or after). Most of all, you can launch within a DragScript and so basically send yourself notifications from anywhere within Voyager!
Let’s say you want to send yourself a message in case of error…in the Sequence, go on “On Error” tab, check “Good Night”, and decide when you want to send yourself a message (before and/or after the error), click the three dots, search/select your script telegram_me.vbs in the first field, then in the second field called Arguments type your message including the opening and closing “” (see attached screenshots). I would uncheck the option to wait for your script, lower the wait to 5000 ms, and check On Timeout Kill option.
THAT’S IT! Now on error you’ll receive your custom message on your Telegram. Obviously you could use use the same script also at the end of Error, for examle just to tell yourself that all your error management options were done (for example Park),
Or you could send yourself a message at start or end of sequence…possibilities are limitless, beyond that with DragScript.
I’ll attach some screenshots first showing how it looks on Sequence On Error and then On Start.
I understand might seem daunting for someone as a task, but once you did it once then you can use that same script everywhere. So is just a once job and use it forever for free. Notice that Telegram is also encrypted and very reliable, more than emails and SMS (and contrary to those is free). It works very well also over unstable connections.
Having a specific messaging free app like Instagram sending you notifications is useful because in most phones you can specify priority of notifications by apps, so for example in my case I know Telegram is used for important notifications and nothing else, so if something appears on my Telegram I know is something important
I hope this was not too long or technical and useful to get free text notifications!