Telegram Plug-in to send text, images and video notifications
-
As another one asked for it on the other forum, I finally created a new plug-in for Telegram notifications: https://github.com/dbochicchio/vera-Telegram/
You can:
- send text messages
- send (still) images
- send videos (gif or mp4)
- send silent notifications
I remember @CatmanV2 was searching for something similar (maybe?).
I'm using it to send push notifications to me and my wife, using a group. I have my own code streaming my cameras and sending a video as gif based on certain events (ie motion sensors or door/entryways left open). While this part is not included into the plug-in, if you're able to get a video yourself (by pointing to a URL), you'd good to go. Still images from cams (or, let's say, your favorite weather map, or any video/gif/image on the Interner ot local) are supported as well.
100% compatible with bot Vera and openLuup (where it was developed, anyway).
Feel free to ask questions or suggest new features.
-
I gave you a 'like' there, but you can have one here as well
-
Installed and tested, can't get it to work.
I just dropped the files into cmh-ludl and created the device.
No error messages, but i noticed that the BotID turned into a date value when I pasted it in at the variables tab? its only the number before ":" that goes in there?
is the user ID including the "@"?Tried to send a message using both Reactor, and the "Actions" tab in the device. bots returns "OK" from the telegramservice.
Is the "DisableNotification" a boolean value? -
Yes, once again an issue of Vera variables not having a reliable data type. AltUI (and openLuup) display large numbers as dates. For openLuup the threshold is 1234567890, for AltUI, a little lower, IIRC.
-
Ok, so the value seems to be correct even if the gui thinks its a date.
2020-11-15 12:13:45.817 luup.call_action:: 755.urn:bochicchio-com:serviceId:VeraTelegram1.Send 2020-11-15 12:13:45.817 luup_log:755: VeraTelegram(send@201): send({ action="Send", serviceId="urn:bochicchio-com:serviceId:VeraTelegram1", Text="reqrqe", DeviceNum="755" }) 2020-11-15 12:13:45.948 luup_log:755: VeraTelegram(nil@194): executeCommand("curl --data chat_id=perhusaas --data-urlencode \"text=reqrqe\" --data disable_notification=false \"https://api.telegram.org/bot1460220026:AAHOtQStG8xnTxnV1oAmPfy8MhwQam3Yb-w/sendMessage\""): "{\"ok\":false,\"error_code\":400,\"description\":\"Bad Request: chat not found\"}" 2020-11-15 12:13:45.948 openLuup.server:: request completed (30 bytes, 1 chunks, 132 ms) tcp{client}: 0x5624bd630508
(token above is now revoked and renewed)
So, does this mean that it can't find the bot, or my username?
Also tried to create a channel and added the bot to it, no difference. -
@PerH said in Telegram Plug-in to send text, images and video notifications:
Ok, so the value seems to be correct even if the gui thinks its a date.
Yes, that's the case.
-
-
To send a message to Telegram, you'll need a ChatID. From the error message, it's clearly missing.
It's different if you want to send it to a user (UserID is enough or a group).
Here you can find one of the many articles giving instructions: https://medium.com/@sean_bradley/get-telegram-chat-id-80b575520659
-
But - i did try to send it to my user ID. Does it have to be to a group?
This is what i get when i use the generated chatID:
2020-11-15 17:01:19.487 luup_log:755: VeraTelegram(send@201): send({ action="Send", serviceId="urn:bochicchio-com:serviceId:VeraTelegram1", Text="Test!", DeviceNum="755" }) 2020-11-15 17:01:22.147 luup_log:755: VeraTelegram(nil@194): executeCommand("curl --data chat_id=-362200779 --data-urlencode \"text=Test!\" --data disable_notification=false \"https://api.telegram.org/bot1460212826:AAGUroMlLkhnneQkmX9rf0H5SggkGMK1QuA/sendMessage\""): "{\"ok\":false,\"error_code\":401,\"description\":\"Unauthorized\"}"
-
I'll let the token stay up a while if you want to try sending to it..
-
Will do, thanks! Any plans on getting this one into AltAppstore?
-
Uh oh, I was sure it already was. I’ll add lately.
-
FYI, Reactor's direct support for your plugin (in the Notify action) is now available in 3.9-20321, the stable branch release (so in AltUI, go to Plugins, and on the Reactor row enter "stable" as the version and click the update button).
-
Contact!
Had to make a new token to make it work, theres no expiry of them, i hope?
Now i have to learn how to send "special" characters, it didnt even like "!".. But i don't intend to yell in my notifications anyway.
Sent one from reactor too Patrick.
To all you developer guys; Awesome job! thankyou for making this great HA system! Hope to join in on making some contributions myself.
-
didn't find the Message function in this forum, and couldn't send pictures in "chat":
@toggledbits , there's a small UI bug in the stable release:
Other than that, its f**in awesome.
-
I can't reproduce it. What version of AltUI are you on? (see More > Plugins)
-
@perh said in Telegram Plug-in to send text, images and video notifications:
Now i have to learn how to send "special" characters, it didnt even like "!"
It should work out of the box. I have emojis in my notifications and they are correctly encoded.