[tool] Receive Blue Iris Alert Images/Videos on Telegram

GentlePumpkin

IPCT Contributor
Sep 4, 2017
194
325
This little tool sends your Blue Iris Alert images and mp4 videos to your Telegram chat.

Backstory: Since I developed AI Tools a few years ago, Blue Iris nicely integrated AI analysis. The only (big) thing missing for me was the possibility to send Alert images to my Telegram account. So I made "Telegram Upload Tool" (TUT):

a.png
1.png


How it works
1. TUT scans a specified input folder for new alert images and videos that Blue Iris put there (.jpg and .mp4 files)
2. TUT connects to a Telegram Bot you created and with whom you have a private chat
3. TUT sends the images and videos to your Telegram chat with the Bot

Setup
1. Unzip TelegramUploadTool.zip wherever you like
(2. Add TelegramUploadTool.exe to your Autostart or schedule a Task to automatically start TUT)
3. In Blue Iris, choose a folder and configure BI to save alert snapshots and/or videos there. For example like that:
Videos: Blue Iris -> Camera Settings -> Trigger -> Add to alerts list: Export to MP4 files
Images: Blue Iris -> Camera Settings -> Record -> JPEGs: When alerted & Folder: your Input path from above

4. In Telegram, create a bot and get the Bot Token:
4.1 Contact BotFather on Telegram.
4.2 Use the /newbot command to create a new bot. The BotFather will ask you for a name and username to generate the Bot Token along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw for your bot. Copy the Bot Token.
4.3 Contact the bot you created with the telegram account you want to receive the notifications on and send the bot a message.

5. Open TelegramUploadTool.exe, go to Settings
- Input Path: select the folder from step 3
- Telegram Bot Token: from step 4.2
- after inserting the Bot token: Click on "Get ChatID", your browser will open and will show you some values, among them is the "chat" and "id" value (something like 35057230). Copy it and insert it in the Telegram Chat ID field.
telegram chatid.png

- Hit Save.

Multiple recipients:
If you want to send alert images to multiple Telegram accounts (yours, your wifes, etc), you need to repeat step 4.3 for every account, copy the chat-ids of all chats and enter the chat ids interposed by a comma ("12345678, 87654321"). Or alternatively, you can simply add the bot to a group (p.e. your familys Telegram group) which should receive the alert images.

Tips
- the maximum upload size for Telegram Bots is 50MB, so make sure your videos are smaller, otherwise the upload will fail

Changelog
1.1 Several Bug fixes




Setup alternative within Blue Iris using curl (thanks to @hopalong)
directly send images to Telegram from Blue Iris without the need for Telegram Upload Tool.

1717875701980.png




https://api.telegram.org/botXXXXXXXX:YYYYYYYYYYY/sendphoto -F chat_id=ZZZZZZZZZZZZZ -F photo=@C:\BlueIris\Alerts\&ALERT_PATH -F caption="[URL='http://10.10.30.10:81/ui3.htm?t=live&cam=&CAM'][I]&NAME[/I][/URL] \- &MEMO" -F parse_mode=MarkdownV2

Replace the XXXXXX:YYYYYYYY and ZZZZZZZ with the appropriate info.

PS: Have fun, enjoy some fresh air after installing this :) and best wishes to you all from GentlePumpkin!
 

Attachments

Last edited:
Hey thank you for this. I was an early user of AiTools, and the telegram upload became part of my normal notifcation workflow. After they integrated deepstack, and now CP, I have been trying to find good solutions to regain Telegram notifications back. I'll give this a try! Thanks
 
hello.thank you for this great tool but i can't get it work.i got bot in my group. he sending messages from my other services. token and group id is correct. but when i'm trying to make an upload from folder with pictures, he won't upload enything.
 

Attachments

  • 123.png
    123.png
    26.2 KB · Views: 217
Thank you for the tool. Is there a way for TUT to only upload the confirmed AI marked-up alert images? When I use the: "Images: Blue Iris -> Camera Settings -> Record -> JPEGs: When alerted & Folder: your Input path from above" the image does not contain the item I am looking for versus what is shown in the Alerts

1691711356753.png


When Alerted Image as above
lpr.20230810_164233029.jpg


Alerts Image with marked-up info
1691711123490.jpeg
 
Last edited:
1 month usage feedback. Everything works great. 100% reliable with no crashes. One item of suggestion is that on EXIT there could be a "never ask again" check box, as my box running Windows Server 21 will always hang when doing maintenance reboots waiting for the dialog box confirmation. Otherwise everything is great
 
  • Like
Reactions: TonyR
Trying to set this up today. I get all the way through the instructions, but when i click on "get chat id" all I get is this:

oktrue
result[]

It doesnt show any id or user.
Can someone point to where my error is?
 
hello.thank you for this great tool but i can't get it work.i got bot in my group. he sending messages from my other services. token and group id is correct. but when i'm trying to make an upload from folder with pictures, he won't upload enything.
Did you do step 4.3? Did you take the chat id from the page that opens when you click on "Get ChatID"?



Thank you for the tool. Is there a way for TUT to only upload the confirmed AI marked-up alert images? When I use the: "Images: Blue Iris -> Camera Settings -> Record -> JPEGs: When alerted & Folder: your Input path from above" the image does not contain the item I am looking for versus what is shown in the Alerts

View attachment 169796

When Alerted Image as above
View attachment 169795

Alerts Image with marked-up info
View attachment 169794
I don't know. IF you can get BI to save the image with markups (.jpg), then it can be uploaded to Telegram.
I understand the problem also is to prevent getting alert images that are a little too late and thus don't contain the object of interest anymore. Everyone is invited to share his BI configuration regarding this issue. I will try to enhance the BI setup myself when I've got some spare time.


1 month usage feedback. Everything works great. 100% reliable with no crashes. One item of suggestion is that on EXIT there could be a "never ask again" check box, as my box running Windows Server 21 will always hang when doing maintenance reboots waiting for the dialog box confirmation. Otherwise everything is great

First time closing the application, there is a dialog asking that. In your case: 1.Close TUT. 2. go to %localappdata%/TelegramUpload/TelegramUploadTool.exe_blahblahblah/1.0.0.0/user.config and change the value of "close_instantly" from 0 to 1.
1692905426382.png
 
I don't know. IF you can get BI to save the image with markups (.jpg), then it can be uploaded to Telegram.
I understand the problem also is to prevent getting alert images that are a little too late and thus don't contain the object of interest anymore. Everyone is invited to share his BI configuration regarding this issue. I will try to enhance the BI setup myself when I've got some spare time.

Yup I've tried a few things like running a script upon trigger in BI Alerts that waits to copy images over to the TUT folder its monitoring, but eventually went back to your AI Tool program. That still works great and gives more tweaking options per camera.

Do you have a buy me a coffee link or similar?
 
  • Like
Reactions: JNDATHP
Telegram, I do not have.
I do have Microsoft Teams! What of Microsoft Teams for alert images/videos?
 
just followed your steps, but im getting "Could not upload file to Telegram" error in the logs. any idea?
Could it be something to with the forward slash:


[15.09.2023, 22.23.17]: WARNING: Could not upload file C:\BlueIris\New/driveway.20230915_222316459.jpg to Telegram. Upload retry 9
[15.09.2023, 22.23.17]: ERROR: Could not upload file C:\BlueIris\New/driveway.20230915_222316459.jpg to Telegram.
 
Last edited:
regarding step 3 for mp4, based on the blue iris documentation by default mp4 videos are saved to the "Alert" folder and this folder is not selectable from:
Camera settings -> Record -> JPEG -> Folder..

how did you guy set it up?
 
@GentlePumpkin, one wish for the applications, and we get it as a services so that it runs in the background and auto starts in case of a powercycle. i tried to mark it as a service but when i close the "main" applicaiton the service also stops, even tried starting the application from service and process but after few sec i stops again..
 
What other alternatives to receiving mobile notifications is there? I'm just starting to build/install my security system so I'm still learning.
 
What other alternatives to receiving mobile notifications is there? I'm just starting to build/install my security system so I'm still learning.
it think it all depends on what you have, if you have any automation at home (MQTT + Node-red), i personally was using mail and basic a Telegram script (which did not work properly) and now trying to set this telegram "agent" up, as i wanna go away from mail
But read that others are using Blue iris own app for mobile devices..
 
just followed your steps, but im getting "Could not upload file to Telegram" error in the logs. any idea?
Could it be something to with the forward slash:


[15.09.2023, 22.23.17]: WARNING: Could not upload file C:\BlueIris\New/driveway.20230915_222316459.jpg to Telegram. Upload retry 9
[15.09.2023, 22.23.17]: ERROR: Could not upload file C:\BlueIris\New/driveway.20230915_222316459.jpg to Telegram.

The backslash shouldn't be the problem. Maybe it's easiest to repeat the setup steps. Maybe you have a strict Firewall?


@GentlePumpkin do i need to have the Telegram installed and running on the same pc as your program for it to work.?

No, because TUT itself is the telegram client (a tiny one)
 
The backslash shouldn't be the problem. Maybe it's easiest to repeat the setup steps. Maybe you have a strict Firewall?




No, because TUT itself is the telegram client (a tiny one)
Blue iris is running on a windows 11 desktop where the firewall is disabled.
as for the physical firewall, im using a pfsense where "allow any" is enabled for testing purpose. side note im able to send telegram alerts using batch file which is triggered directly from Blue iris. so its not the firewall or any antivirus that "blocking". tried to enable the "log everything" but this doesnt give any more information..
is there a way that we perhaps can enable some sort of a debug on yourapp., ?or any other files/logs that i can review?
 
Thanks for this!

I'm having a little trouble though.

Code:
[25.09.2023, 11:48:58]: Upload to <chatid deleted> on Telegram started.
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  1
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  2
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  3
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  4
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  5
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  6
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  7
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  8
[25.09.2023, 11:48:58]:      1.
[25.09.2023, 11:48:58]:      2.
[25.09.2023, 11:48:58]: WARNING: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram. Upload retry  9
[25.09.2023, 11:48:58]: ERROR: Could not upload file F:\BlueIris\export/FrontDrive.20230925_113000_1.mp4 to Telegram.

Edit:
I am able to post manually through a browser to the api and get a notification on my phone.
I checked windows firewall and do not see any blocks. I tried a manual allow rule with - no improvement.
I also tried dropping a jpg in there (the mp4 were all under 50mb, but thought it might be a size issue) - no improvement.
Nothing in the event viewer except TUT did crash the first time it tried to do something
The program TelegramUploadTool.exe version 1.0.0.0 stopped interacting with Windows and was closed. To see if more information about the problem is available, check the problem history in the Security and Maintenance control panel.​
Process ID: 2894​
Start Time: 01d9efcebf3f6c80​
Termination Time: 8​
Application Path: C:\Util\TelegramUploadTool\TelegramUploadTool.exe​
Report Id: 52e8aa36-2693-4262-b09e-87352e11abba​
Faulting package full name:​
Faulting package-relative application ID:​
Hang type: Cross-thread​

Should I be running the .exe or is there an installer?
 
Last edited: