READING TIME: 8 MINUTES
In this guide, I’m going to show you how to send motion alerts (analyzed by Deepstack) from your Blue Iris NVR to Telegram (Option 1). I will also show you how to attach a Deepstack-analyzed photo of your tracked object and send it to Telegram (Option 2).
One of the biggest advantages of using a Telegram bot for Blue Iris alerts is that it will show you a history of every alert that has ever been triggered with the included image.
You will need the following items setup:
- Blue Iris installed
- Telegram app installed on your phone
- A Telegram account
- Telegram group and bot created
Once you have those items ready to go, you can continue following this guide.
Set Up Telegram Bot
Before you can get Telegram alerts from Blue Iris, you first need to create a Telegram bot to get your API key and Chat ID.
Option 1: Send Generic Text Message to Telegram
Create & Test Telegram Message
Before we start messing around in Blue Iris to receive motion alerts, we should first check to make sure you can receive ANY alerts at all in Telegram from a web request.
To test, create a Telegram HTTP Web Request URL.
https://api.telegram.org/botTelegramAPIKey/sendMessage?chat_id=ChatID&text=Motion detected in Driveway!
Once you replace the API key and Chat ID with your own, paste the URL into a browser. You should receive a Telegram text notification with a generic “Motion detected in Driveway!” message.
Once you’ve received the message, you can now add the URL to Blue Iris.
If your ChatID came with a hyphen – use it. If it doesn’t have a hyphen, don’t add it at the front like I did.
Edit Blue Iris Camera Alert
Next, log into your Blue Iris server.
Right-click a camera > Camera Settings.
Click the Alerts tab > On Alert.
Click the + button > Web request or MQTT.
https:// and then paste the URL from the previous step. Leave out the https:// as it’s already in the dropdown.
Test Sending Motion Alerts to Telegram
Now, you can simply walk in front of your camera. Within a second or two, you should receive a text alert in Telegram!
Once you verify that this works for one camera, you can set the alerts for each camera. The only thing you’ll need to change is the message (For example, change Motion detected in Driveway to Patio).
Option 2: Send Deepstack-analyzed images from Blue Iris to Telegram
Step 1: Download CURL
Download CURL for Windows on your Blue Iris server.
Choose 64 bit.
Right click the zip > Extract to your Downloads folder.
Step 2: Create 2 new Windows Folders
Next, create two new folders in your parent “BlueIris” folder (This is the Windows folder where you already have New, Alerts, Stored, and db folders). Name them:
Your parent BlueIris folder should now look like this:
Step 3: Copy BIN folder to Telegram_Upload folder
Click into your extracted CURL folder. The folder should be named something like
Copy the entire BIN directory to the S:\BlueIris\Telegram_Upload folder.
Step 4: Add Telegram_Alerts folder to Blue Iris
For this step, we are adding a new folder to Blue Iris. We are doing this so Blue Iris will copy JPEG images (that Deepstack has already analyzed and detected as a “person” object) into the Telegram_Alerts folder.
Within Blue Iris Admin, click the gear at the very top to edit the global settings.
Click the Clips and archiving tab.
Under Folders, choose one your spare Aux folders (Aux 1). Then, add the path to your Telegram_Alerts folder. (
S:\BlueIris\Telegram_Alerts). Then click OK.
Step 5: Edit camera settings (to save JPEG files to new folder)
Log into your Blue Iris server. Right-click a camera > camera settings.
Switch to the Record tab.
Check the box for JPEGs, set it to When Alerted, change the folder to Aux 1, and set the quality to 100%. If you have 4k cameras, you might want to adjust the quality and/or resize it so it uploads quicker.
Now, whenever Blue Iris/Deepstack detects motion, it will place the image in your Telegram_Alerts folder, which is exactly what we need for the next step. The next step will have you create a command to copy the latest image in that folder & send it to Telegram.
Step 6: Create Telegram_upload.cmd file
Open Notepad on your Blue Iris server. Paste in the command below. Edit the paths in green, the Telegram API key in red, and the Chat ID in orange.
Reminder: If your ChatID came with a hyphen – use it. If it doesn’t have a hyphen, don’t add it at the front like I did.
SET PICFolder=S:\BlueIris\Telegram_Alerts ::Get Latest File for /f %%i in ('dir "%PICFolder%" /b/a-d/od/t:c') do set LAST=%%i rem for /f %i in ('dir "%PICFolder%" /b/a-d/od/t:c') do set LAST=%i CURL https://api.telegram.org/botTelegramAPIkey/sendphoto -F chat_id=-ChatID -F photo=@S:\BlueIris\Telegram_Alerts\%LAST%
Then go to File > Save As. Name the file
Telegram_Upload.cmd and save it to your
Final Step: Create Blue Iris Camera Alert to run command
Edit your camera again. Switch to the Alerts tab.
Under the Actions section, click On alert.
Click the + button to create a new alert. For the action, select Run program/script and point it to the path of your Telegram_upload.cmd file.
Then click OK on all the camera settings screens to save everything.
Testing it Out
Now, simply walk in front of your camera. If all goes well, the command should run and you should receive the latest image from the S:\BlueIris\Telegram_Alerts folder directly in Telegram!
Hint: As long as there is at least 1 image in the Telegram_Alerts folder, you can also simply run the Telegram_Upload.cmd file by clicking it. That way you don’t have to run in front of your camera a bunch of times. If you receive the image, then you know it worked!
If you notice it’s taking a while to get the image in Telegram, you might want to change the quality/resolution from 100% to 50% so the filesize is smaller. 4k cameras obviously have a much larger file size and will take the longest to upload to Telegram. For reference, my images are 1080p. I receive text messages almost immediately, and pictures within 5-10 seconds.
If you are receiving too many alerts, you can edit that as well. Camera > Camera Settings > Alerts tab. Check the box for “minimum wait time between alerts” and set a threshold.
If you would like to include a message with your picture, then create both Option 1 and Option 2. You will have 2 alerts configured for each camera. You will first receive the text message letting you know which camera was triggered, and then a few seconds later you’ll get the corresponding picture.
If you would like to only receive alerts during a specified time frame (such as overnight), you can create a 2nd script with a set time frame that calls the Telegram_Upload.cmd file. If between the hours you specify, the script runs. If it doesn’t meet your criteria, it doesn’t. Here’s how to set that up: https://smarthomepursuits.com/run-batch-file-during-certain-time-window/
This guide took me way too long to figure out and script together, so if it worked for you – please let me know in the comments below and share it in any forums/threads where you see others requesting how to do this.
Good luck, and hopefully this helps you send pictures to your Telegram bot when Blue Iris and Deepstack detects motion!
My Homelab Equipment
Here is some of the gear I use in my Homelab. I highly recommend each of them.
- Server 2019 w/ Hyper-V
- Case: Fractal Design Node 804
- Graphics Card: NVIDEA Quadro K600
- CPU: AMD Ryzen 7 2700
The full list of server components I use can be found on my Equipment List page.