How To Send Blue Iris Images to Telegram

by Danny


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:

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

This image has an empty alt attribute; its file name is image-132.png

Once you’ve received the message, you can now add the URL to Blue Iris.

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.

Switch to 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:

  • Telegram_Alerts
  • Telegram_Upload

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 curl-7.78.0-win64-mingw.

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.

Don’t forget to include the – in the Chat ID!

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 -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 S:\BlueIris\Telegram_Upload folder.

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!

Optional Tweaks

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:

Wrapping Up

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.

The full list of server components I use can be found on my Equipment List page.


You may also like


Ian Butcher August 19, 2021 - 11:53 am

Hi Danny

Great write up thank you – this is exactly what I wanted to do, using inbuilt deepstack and push images to an app (other than the BlueIris app)

I wonder if you can help though – it’s not quite working. I’m getting the picture in the Telegram_Alerts directory, and the alert is triggering, but the response from the script is giving me the following error:
{“ok”:false,”error_code”:404,”description”:”Not Found”}
This means I am not getting the message with the picture attached.

Any ideas?

Danny September 1, 2021 - 4:12 am

Sorry for the late response! I just realized my replies were never sending out to commenters.

Hey Ian,

I received that error several times when writing the script, but it was usually due a bad path.

Just in case you hadn’t figured it out yet, I was missing the word “bot” in my command. Put bot before the TelegramAPIkey. I’ve also updated my guide with the correct syntax for you. Let me know if that works!

Ian September 1, 2021 - 7:21 am

Hi Danny

Yes, I managed to work it out, but thanks anyway!

Jeff August 21, 2021 - 3:51 pm

I just followed the steps and got it working, was wondering if it’s possible to get the Deepstack analyzed images? Would I have to copy it from the alerts folder?

Danny September 1, 2021 - 4:10 am

That’s exactly what it does already. If you look in your current Alerts folder, it contains all images – both images taken every few seconds and the Deepstack ones. I basically just configured Deepstack to copy the “alerted” files to separate folder for use with Telegram image messages.

Michael September 5, 2021 - 4:06 am

Thank you very much for this good description on how to get telegram working with BlueIris. It must have been a lot of work for you!

Danny September 5, 2021 - 10:00 am

You’re welcome Michael, I’m glad it helped you send images to Telegram!

Richie October 13, 2021 - 10:15 am

Very good article. The only issue I have is that the script is sometimes sending the same image twice, as BI hasn’t sent the new alert JPEG to the folder yet.

Richie October 13, 2021 - 12:01 pm

Thank you for this write up! Got it working as it should, although there’s a slight flaw with the script I wonder if you can assist with. I have an issue where an alert will take place, but the last image is sent again. So I end up with many copies of the same image alert. Is there a way to adjust the script so this doesn’t happen?

Thanks again!

Danny October 13, 2021 - 2:47 pm

Great! I’m glad you got it working following my guide.

I do occasionally get double images, but I haven’t looked into why yet. I think a few possible things you can look into are:

1. Reducing image size/quality so Deepstack can process them quicker.
2. In the Alerts tab of the camera, look at the Timer settings. I’m not sure if the Timer settings also affect the Action settings, but if it does – maybe set the “Wait until triggered at least” option to 2 or 3.
3. You could add a “SLEEP 5” or something like that to the top of the .CMD file, but then it’ll delay ALL alerts by a few seconds, so idk if that’s something you’d want to do. I actually think what you’d have to do is create a 2nd batch file (Telegram_Upload_Wait.cmd) that calls the Telegram_Upload.cmd using an if/then statement. If Telegram_Upload.cmd hasn’t ran in the last 5 seconds, then call it. If not, do nothing.

If you do figure out a good solution or script, let me know and I’ll test it out!


Leave a Comment