send Telegram notifications with pictures

blazin912

Getting the hang of it
Joined
Sep 15, 2019
Messages
168
Reaction score
41
Location
MA
I have this working well and it is quick, I setup a bot using botfather and curl directly from the alerts tab. I've used Telegram for a while just to view channels but new to all the groups and bot stuff. I'm definitely going to look at hosting my own bot soon as detailed. I have one thing I cant figure out though and that is when I add my wife's phone to the bot I created no messages are received on her telegram, have tried adding the bot to a group that she could then also join but non of the messages in the bot group appear in the group it is added to?

Is this even possible? I'm looking to move from pushover (via node red) as this is faster (although miss the custom sounds you can do per camera). I did look to make a bot for each camera so I can have a sound for each but then found botfather limits the bots you can create! basically looking for as similar functionality to pushover as possible but If my wife cant see the alerts then it is probably pointless to spend much more time on this. Any pointers appreciated
I've got a group setup with the bot I created. My wife and I are in the group and get the messages
 

mvernx

n3wb
Joined
Aug 1, 2018
Messages
4
Reaction score
0
Location
uk
Thanks blazin, I can normally work these things out but this has me bomboozled! I must be missing something simple as it cannot be that hard and I have been looking at it all evening!

So I have the bot receiving messages from blue Iris just fine, If I then create a telegram group and add the bot to it no messages generated by the bot show in that group just in the bot channel (so no point adding my wife to the group as no messages are displayed). On my wifes telegram I tried making a group and adding my bot - no messages show on her phone but do on mine.

What should I be doing? should I be creating a new group on my phone, adding the bot and adding my wife also to that group or just creating a new group on her phone and adding the bot to it? or something else as neither of these methods seem to work!
 

blazin912

Getting the hang of it
Joined
Sep 15, 2019
Messages
168
Reaction score
41
Location
MA
Thanks blazin, I can normally work these things out but this has me bomboozled! I must be missing something simple as it cannot be that hard and I have been looking at it all evening!

So I have the bot receiving messages from blue Iris just fine, If I then create a telegram group and add the bot to it no messages generated by the bot show in that group just in the bot channel (so no point adding my wife to the group as no messages are displayed). On my wifes telegram I tried making a group and adding my bot - no messages show on her phone but do on mine.

What should I be doing? should I be creating a new group on my phone, adding the bot and adding my wife also to that group or just creating a new group on her phone and adding the bot to it? or something else as neither of these methods seem to work!
I need to look back at the api but I think you need to have the bot send messages to a specific group Id. If you have the ID set as yourself or the bot that won't work.
 

mvernx

n3wb
Joined
Aug 1, 2018
Messages
4
Reaction score
0
Location
uk
No worries I have worked it all out and now works, I overlooked that obviously a group would have a different chat ID! So once I knew what that was and had blueIris send to that it appears in that group, cheers
 

blazin912

Getting the hang of it
Joined
Sep 15, 2019
Messages
168
Reaction score
41
Location
MA
No worries I have worked it all out and now works, I overlooked that obviously a group would have a different chat ID! So once I knew what that was and had blueIris send to that it appears in that group, cheers
Nice!! My wife loves our thumbnail/video clip over telegram.

Next step casting the live feed right before the clip gets sent to telegram
 

Monty

n3wb
Joined
Jan 14, 2018
Messages
6
Reaction score
0
You'll like it. I do something similar on my Android device where I use Tasker to intercept Blue Iris notifications. Note the "Hush" button.
View attachment 99829

You could prototype it pretty quickly by adding a 2nd caption to your Telegram alert that uses BI's HTTP interface command
&WAN/admin?camera=x&pause=n
I know this is old and you guys most probably moved on. I would like to know it possible for the bot to first ask you to confirm the image before sending it to the group. So the idea is that blue iris sends the alert to telegram as normal to a group. But before it goes onto the group can the bot ask me to confirm image?
 

txedgeman

n3wb
Joined
Dec 9, 2022
Messages
9
Reaction score
5
Location
Texas
I am wondering if anyone would have any ideas as to why the default Blue Iris macros would not work when running a program/script action. I am trying to set up telegram to send a picture using curl. If I remove the macros and hard code the picture location, the alert action will fire off to telegram and I receive the message. If I put the macros in (e.g., &ALERT_PATH, @Memo, etc.), the alert action fails. I have searched through the forum and search online, but I can't seem to find a reason why the macros would be failing to execute or be recognized.
I was having some inconsistency on getting telegram alerts using curl with the &ALERT_PATH and Trigger tab setting : When triggered add alerts to Database only. After adding additional logging to the curl command ( -o E:\BlueIrisData\AlertLog\CurlLog_&CAM_%Y%m%d-%H_%M_%S.log --stderr E:\BlueIrisData\AlertLog\CurlERRORLog_&CAM_%Y%m%d-%H_%M_%S.log ) I was able to see in the error log that curl was having problems reading the temporary camera jpg file. The problem did not occur when the trigger tab was set to use HiRes Images as the image file persist after the actions have completed.

Ken with BI support said the (curl) command in the Alert Action list is run as a separate process and that the temporary camera jpeg file is removed upon completion of the action set. This means there is a possible race condition where curl is still reading the temp image file, the action set completes and deletes the temporary file curl is actively using. This could explain why you are having similar problems.

To address this he implemented a new option in the a Run a program/Write to file Alert action: 'Wait for process to complete (up to 30 seconds)'. This prevents the actionset from completing while the curl command is still transmitting the temporary image to telegram.
 

Attachments

concord

Getting comfortable
Joined
Oct 24, 2017
Messages
665
Reaction score
741
Thanks for asking for the option. I'm using a command script that someone else came up with. I only have two cams that use it, but if I had more cams using it, most likely it would have a race condition (like in electronics) and send the wrong image if more than one cam triggered at same time...

 

George M

n3wb
Joined
Feb 6, 2017
Messages
26
Reaction score
10
Just set this (images sent to telegram) up today and it is working well with thumbnail. Has anyone gotten it to work with sending a short (30 sec) video like I am doing with email?
 

fenderman

Staff member
Joined
Mar 9, 2014
Messages
36,902
Reaction score
21,274
Just set this (images sent to telegram) up today and it is working well with thumbnail. Has anyone gotten it to work with sending a short (30 sec) video like I am doing with email?
There is a tool by @GentlePumpkin to do this.
 

George M

n3wb
Joined
Feb 6, 2017
Messages
26
Reaction score
10
There is a tool by @GentlePumpkin to do this.
Yes I have that set up. However I do not see where it creates an mp4 file.
In the alerts page and when setting up for email alert, it lets you specify to attach a mp4 file along with the alert.
With the run program/ script alert that option is not there.
Since I record in bvr format, how do I tell it to send a 30sec mp4 along?
 

txedgeman

n3wb
Joined
Dec 9, 2022
Messages
9
Reaction score
5
Location
Texas
I'm sure there are several different ways of generating video. I had tried building a video from 5-6 jpeg files via ffmpeg and sending that through Telegram but found the processing time to build the video, send it to telegram, etc took too long and was chewing up lots of bandwidth on cellular data plan. Especially if you have multiple cameras firing at the same time.

Currently, I send the camera specific temp jpeg and add a couple of custom URLs in the notification:
In addtion to the chat info... -F photo=@"E:\BlueIrisData\Video\Alerts\&ALERT_PATH" -F caption="[WatchVid](&WAN/ui3.htm?rec=&ALERT_DB&maximize=1) [Pause1hr](&WAN/admin?profile=6&lock=1) [UNpause](&WAN/admin?profile=1&lock=0) \- &MEMO" -F parse_mode=MarkdownV2

WatchVid will provide a link where I can watch the video if on premise and on wifi; Pause1hr sets the current profile to 6 with a temp time of 60 minutes. Telegram alert notifications are not allowed in profile 6. Unpause if I want to go back to main profile with alerts.

This way the alerts are fast and I have some context from the single jpg, video can be viewed quickly locally. I can manually launch VPN and click the URL for video of the event.

Apple user here -- the part I'd love to get working next is setting up iPhone profile that invokes VPN on demand (for openVPN profile) based on domain name used in my blue iris &WAN. In theory I would have quick access to the video on premise or remote.
 

hopalong

Getting the hang of it
Joined
Apr 19, 2021
Messages
69
Reaction score
34
Location
California
Is &ALERT_PATH still working for anyone? I get the messages but no images.
I just set this up. So far been working great. Here is my parameter string:

Code:
https://api.telegram.org/botxxxxxxx:xxxxx-xxxxxxxxxxxxxxx/sendphoto -F chat_id=xxxxxxxxx -F photo=@C:\BlueIris\Alerts\&ALERT_PATH -F caption="[*&NAME*](http://10.10.30.10:81/ui3.htm?t=live&cam=&CAM) \- &MEMO" -F parse_mode=MarkdownV2
 
Top