Send free custom telephone notifications to your Telegram from Voyager

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:

  1. 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!

  2. 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)

  3. 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)

  4. 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.

  5. 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.

  6. 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!

  7. 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)

  8. from all the gibberish, on each line of your messages there will something like (might be split in two lines): “chat”:{“id”:XXXXXX

  9. get that XXXXXX number (called Chat Id) and save it somewhere together with the Token we got at point 4

  10. 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)

  1. save it into a file called “telegram_me.vbs” (not .txt) in your Documents folder.

  2. 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!”

  1. 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 :slight_smile:

I hope this was not too long or technical and useful to get free text notifications!





6 Likes

Congratulations Giancarlo,

thanks you so much for your effort on this and thank you for this useful add on to Voyager.
Really happy about. Feel free to expand your post and add more thread with like this !

All the best
Leonardo

1 Like

Great work Giancarlo,
I’ve just completed my bot and customized script quickly thanks to your extremely helpful suggestions.

Cheers
Francesco

1 Like

Thanks for sharing. I don’t use Telegram, however, in this context is a good thing. If I use SMS or other channels that I already use I could miss the alert easily since I already receive tons of BS on the regular messaging channels.

I will give it a try.

Cheers,

José

1 Like

Hi guys, I can’t understand the step nr 5, I get an error opening the link. Can someone help me?

Yeah I also never used Telegram, enough messengers around (plus texts!). But Telegram is gaining lots of popularity specifically for the channels/groups/bots, as it’s easy to integrate like with the script I posted. Give it a go, for me Telegram is the place where if I see a notification I know for sure I want to check it and is not BS :smiley:

Hey Marco welcome!

I amended my post because I noticed at point 5 it was making some characters substitutions on the forum. So once you get your token, let’s say that it is ABCD1234, you have to visit the page

https://api.telegram.org/botABCD1234/getUpdates

Just exchange ABCD1234 with the token you get, and it should work.

Many thanks for this, it works very well!.
I was struggling with email notifications and the enhanced security increasingly required by providers making email difficult to implement through Voyager.

With Telegram there are no such issues and the notifications seem to be virtually instantaneous.
Cheers
Allan

1 Like

Cheers Allan, glad it worked! It seems complicated at first but is just a few minutes and then you just reuse it forever, it’s now all over my nightt’s master dragscript :slight_smile:

For me as well emails are tricky and my inbox is already too clogged, Telegram is indeed instant and made to work in very poor network conditions, so it’s very reliable.

Also if you have a tablet and/or computer, once you have Telegram on your phone you can install it also on all the other devices, verify it via phone and then they’re independent so if your phone dies or is not with you, you can still get Telegram messages on any other device.

This morning I got more than 20 mesages from my Dragscript informing me step by step of what was happening during the night, kind of reassuring!

Hi everyone …
… first of all thanks for the great idea.
I followed the instructions step by step but unfortunately I get an error “Download of the specified resource failed” line 12 character 3
You can help me ??
sAPI_ID = “MyToken”
sChat_ID = “MyChat”
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
image

Hi Carlo

I’ll reply here so might be useful for others as well with same problem. First of all I uploaded the .vbs script (it needs to fill in the MyToken and MyChat), just to be sure that there are no errors in there:

https://mega.nz/file/cMtl3awA#HN2CbQ6awTg9utW7Hn-l3XpcB6Z-Z1TqyPI9FGxXKw4

This one works for sure. So first thing to try if having problems, is downloading that and filling in the missing parts.

If it produces the same error with my script, looking at your error, line 12 is where the request (in reality the post) is sent. Looking online error 800C0008 is a generic Windows error related to network (as I expected). My n.1 suspect(s) is local computer protection, and I mean firewalls, antivirus etc. (either the Windows one or third parties). I think is not uncommon to have protection systems blocking vbs scripts accessing the internet, as it’s probably how many malicious things on Windows work.

I’m afraid I can’t help more than this, I can only guess, it would be about checking if you can tell your antivirus or firewall to let the .vbs pass and access the internet, but I can’t know how your specific system is configured so is difficult.

Oh! Yes! …
Now Perfectly Functions.
I’M Happy. :slight_smile:

1 Like

Perfect, thanks for letting us know. Anyone else having problems (script copy/paste might create problems), download the script from my link above and simply fill in the chatid and botid and you should be ready to go :slight_smile:

My actual dragscript has passed the test of many nights, and I always get very verbose and useful messages on Telegram about what’s happening.