Send Pushover notifications with pictures and hyperlinks

I'm not sure that I asked the question clearly: is it a must to disable the secure webserver option when enabling the BI Pushover logging function (in all cases)?
No.

If you want to use the credentials in 'pushover_resize_user_settings.ps1'', then both of following are required:
  1. Script user setting $post_w_creds_flg must be = $true
  2. The 'Use secure session keys and login page' control must be unchecked on the Blue Iris Settings > Web server > Advanced page
 
Last edited:
I'm not sure that I asked the question clearly: is it a must to disable the secure webserver option when enabling the BI Pushover logging function (in all cases)?

IIRC, with the secure option on you cannot pass login credentials via the address bar/http get. I had to turn that off a long time ago for my home automation stuff to be able to control BI. I think it's also the difference between the browser login popup to login vs a "splash screen" type login prompt.
 
IIRC, with the secure option on you cannot pass login credentials via the address bar/http get. I had to turn that off a long time ago for my home automation stuff to be able to control BI. I think it's also the difference between the browser login popup to login vs a "splash screen" type login prompt.
From the help PDF, in the 'Other Advanced Web Server Topics' section...

1685635363202.png
 
  • Like
Reactions: scoob8000
No.

If you want to use the credentials in 'pushover_resize_user_settings.ps1'', then both of following are required:
  1. Script user setting $post_w_creds_flg must be = $true
  2. The 'Use secure session keys and login page' control must be unchecked on the Blue Iris Settings > Web server > Advanced page
I guess I'm relegated to always being the problem child here, as I can't for the life of me get version 1.7 to work correctly. I get no Pushover events now, as well as no logging injected into the BI logfile, but I do see the temporary popup toast notifications.

I have followed the suggested two steps (quoted above) and edited pushover_resize_user_settings.ps1 to contain all the same user credentials as I was using under script version 1.5 (Pushover User Key and API keys), it follows the same path to the Alert folder as before, I have gone ahead and changed over to "unchecking" the "Use secure session keys and login page". Yet...nothing coming through. Should I send more details in a PM to you?

Could there be a problem with modifying the actual "main" script name? I have always renamed it, up to and including with this version...ie: it is no longer named "pushover_resize.ps1" on my machine, but the user credential file remains named "pushover_resize_user_settings.ps1". It seems like the main script is expecting the user settings to always be named "pushover_resize_user_settings.ps1", so I don't modify that, and it remains in the same folder and PATH (the Desktop folder in my BI machine).
 
Thanks for works on the PowerShell script version. I just tried to run this for a test and I'm seeing the error below. This is on Windows 11 desktop. Have you been this error below? Ultimately, I did receive the notification in Pushover with this test, but I'm curious why it's throwing error message below.

Code:
PS C:\Users\Admin\Desktop\pushover_resize> .\pushover_resize.ps1 -Msg "Testing" -Title "Testing PS Script" -AttachFile .\GarageCam2.20230602_100000.1018686.17-0.jpg

===========================================================================
Pushover Notification with Resized Image Attachment
Usage: pushover_resize.ps1 Msg [Priority AttachFile Quality Width TargetKB]
---------------------------------------------------------------------------
SourceImagePath = '.\GarageCam2.20230602_100000.1018686.17-0.jpg'
orig height/width/size(KB) = 1520/2688/593.6
Exception calling "Save" with "3" argument(s): "A generic error occurred in GDI+."
At C:\Users\Admin\Desktop\pushover_resize\pushover_resize.ps1:451 char:48
+ ...          $bmpResized.Save($OutputLocation, $Codec, $($encoderParams))
+                                                          ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ExternalException

NewImagePath = 'C:\Users\Admin\Desktop\pushover_resize\GarageCam2.20230602_100000.1018686.17-0.jpg'
new height/width/size(KB) = 1120/1980/593.6

Pushover notification sent

current resized files count = 607890
purge list cnt (files older than 12 hrs) = 0

script execution time = 3404.7 msec

status request
------ -------
     1 4e69b7e1-8b76-4f6f-a4d2-583919b2cb09


Also, if I add -TargetKB 250, it tries 3 times, each with similar error message, and then throws message "...unable to achieve target after 3 iterations..." However, the test message did come through in Pushover afterward.

Code:
PS C:\Users\Admin\Desktop\pushover_resize> .\pushover_resize.ps1 -Msg "Testing" -Title "Testing PS Script" -AttachFile .\GarageCam2.20230602_100000.1018686.17-0.jpg -TargetKB 250
===========================================================================
Pushover Notification with Resized Image Attachment
Usage: pushover_resize.ps1 Msg [Priority AttachFile Quality Width TargetKB]
---------------------------------------------------------------------------
SourceImagePath = '.\GarageCam2.20230602_100000.1018686.17-0.jpg'
orig height/width/size(KB) = 1520/2688/593.6
iterating to achieve file size < 250 KB...
trying size reduction = -25%
Exception calling "Save" with "3" argument(s): "A generic error occurred in GDI+."
At C:\Users\Admin\Desktop\pushover_resize\pushover_resize.ps1:347 char:48
+ ...          $bmpResized.Save($OutputLocation, $Codec, $($encoderParams))
+                                                          ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ExternalException

--- iter 1 height/width/size(KB) = 1140/2016/593.6
trying size reduction = -50%
Exception calling "Save" with "3" argument(s): "A generic error occurred in GDI+."
At C:\Users\Admin\Desktop\pushover_resize\pushover_resize.ps1:347 char:48
+ ...          $bmpResized.Save($OutputLocation, $Codec, $($encoderParams))
+                                                          ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ExternalException

--- iter 2 height/width/size(KB) = 760/1344/593.6
trying size reduction = -75%
Exception calling "Save" with "3" argument(s): "A generic error occurred in GDI+."
At C:\Users\Admin\Desktop\pushover_resize\pushover_resize.ps1:347 char:48
+ ...          $bmpResized.Save($OutputLocation, $Codec, $($encoderParams))
+                                                          ~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ExternalException

--- iter 3 height/width/size(KB) = 380/672/593.6
unable to achieve target after 3 iterations
new height/width/size(KB) = 380/672/593.6
NewImagePath = 'C:\Users\Admin\Desktop\pushover_resize\GarageCam2.20230602_100000.1018686.17-0.jpg'

Pushover notification sent

current resized files count = 607890
purge list cnt (files older than 12 hrs) = 0

script execution time = 3606.3 msec

status request
------ -------
     1 6eb04ad4-f740-4059-9ddb-34a08b3c342e
 
No, I haven't seen that error. Thanks for reporting it. I'll look into it.

The -TargetKB approach runs only for a max of three iterations, then uses the result whether or not the target size is attained. This was a design choice to keep the processing time as short as possible. I could improve the description so that it doesn’t sound like something unexpected happened.

The -TargetKB approach simply reduces the image WxH by 25% each iteration. You could edit the code to use a smaller step (say 20%, or 10%). The target might actually be attained, but at the cost of a slower response time sending the notification. How much is too slow is subjective.

I also played with using the quality in a similar fashion, but in limited testing it seemed that the size method converged faster. Again, I was thinking faster is better.

Here’s the code section you could play with…
Code:
function ResizeImage() {
    ...
    if ($TargetKb -gt 0) {
        ...
        for ($x=75; $x -gt 0; $x=$x-25) {
            ...
        }
    }
    ...
}

For 20% steps, use
for ($x=80; $x -gt 0; $x=$x-20) {

For 10% steps, use
for ($x=90; $x -gt 0; $x=$x-10) {

If you find something that works much better for your use case, I would be willing to make the hard-coded 25% iteration term a user-configurable setting.
 
Last edited:
Updated Powershell script 'pushover_resize.ps1' (post #347)
Script updated to V1.8
  • added options to tune image resizing; 'WxH' (default), 'Quality' and 'Hybrid'; see USER SETTINGS $targetkb_method
  • added new named argument -Demo Y to suspend notifications & BI logfile posting (useful for tuning resize settings)
  • added automatic renaming of user settings file; changed hard-coded filename, now using 'THIS_SCRIPTNAME_user_settings.ps1'
  • fixed bugs for arguments -Quality, -Width & -TargetKB (conditionals incorrectly assumed [int] typing)
  • fixed bugs that prevented the posting of (some) error messages to the Blue Iris logfile
KEY POINT: To use the new options in the 1st bullet above, you must update the user settings file with the new one in the attached zip file.

The most significant benefits of these changes are:
1. The Resize function has been updated with options for user-defined tuning (see bullets 1&2)
2. You can now rename the script (see bullet 3)
 
Last edited:
I'm currently looking at solutions to get rich notifications on my phone and pushover looks to be the easiest to implement but aren't you guys concerned about privacy with images being uploaded to third party services?

One of the main reasons I went with BI was so all my data stays local, but that seems almost impossible if one wants proper notifications.
 
One of the main reasons I went with BI was so all my data stays local, but that seems almost impossible if one wants proper notifications.
Not sure if you're into home automation, but with Home Assistant you can get notifications that are local. When the notification pops up on your phone you have the option of selecting a live view of the camera or viewing the UI3 alert clip.

IMG_2807.PNG
 
  • Like
Reactions: aesterling
aren't you guys concerned about privacy with images being uploaded to third party services?
Perhaps this excerpt from the the Pushover API will give some assurance that your attachments aren’t being retained and used/sold.

“Note that, like messages, once attachments are downloaded by the device, they are deleted from our servers and only stored on the device going forward. “
 
  • Like
Reactions: TonyR
Is it possible to also push the image to the cloud when motion is detected? It's nice to have on my phone which should be fine. But in some kind of disaster scenario where someone broke in and stole the PC and phone, there would be no evidence. It would be nice to also have it stored to the cloud. Also if this is possible, which cloud provider do you use?
 
Is it possible to also push the image to the cloud when motion is detected? It's nice to have on my phone which should be fine. But in some kind of disaster scenario where someone broke in and stole the PC and phone, there would be no evidence. It would be nice to also have it stored to the cloud. Also if this is possible, which cloud provider do you use?

Just send the images to email as well.
 
Is it possible to also push the image to the cloud when motion is detected? It's nice to have on my phone which should be fine. But in some kind of disaster scenario where someone broke in and stole the PC and phone, there would be no evidence. It would be nice to also have it stored to the cloud. Also if this is possible, which cloud provider do you use?

I use freefilesync and keep my alerts folder synced to a FTP server on my web host provider. I also have a dynamic image gallery on it so I can look at alert images when I'm not home.
 
I'm currently looking at solutions to get rich notifications on my phone and pushover looks to be the easiest to implement but aren't you guys concerned about privacy with images being uploaded to third party services?

One of the main reasons I went with BI was so all my data stays local, but that seems almost impossible if one wants proper notifications.
Guess it depends on your use case. I’m definitely not worried about anyone looking at images of people/cars in my driveway.

Now if you are monitoring the inside of a bank vault or the inside of a home/private space, then I’d be more worried.
 
  • Like
Reactions: kklee and TonyR
I've figured out how to send Pushover notifications with pictures and hyperlinks from Blue Iris Actions without using external scripts.

This approach uses curl and the Pushover API, and provides functionality similar to that recently described for Telegram <link>.

EDIT (5/16/2022) - For those who prefer a TLDR version of this thread, I’ve appended a copy-paste-ready API Reference section, and a Testing section to the end of this post. I’ve also added links to key topic posts that have appeared later (e.g., custom sounds, emergency notifications).

Pushover also lets you
  • specify which of your Pushover devices receive the notification (so you don't have to get the notification on every device on which you've installed the app)
  • use built-in Pushover sounds <list> (and Pushover's new custom sounds <link>). See these posts: <Intro>, <Download all Blue Iris Sounds> … EDIT (7/4/2022) If you want to try custom sounds, please note these requirements: ”… sound files must be in MP3 format and are limited to 500 kilobytes in size, and for iOS devices, cannot be longer than 30 seconds or they will not play.”
  • send emergency notifications. See these posts: <Intro>, <Overriding Android Do not disturb>

Caveats:
  • Pushover can only send pictures that exist in your server's file structure. This means it cannot send Blue Iris database images, The examples below assume you are saving high-res alert images, either directly in the 'Trigger' tab, or if you are using AI (DeepStack), by checking 'Burn label mark-up on alert images'. EDIT (1/8/23) These settings are no longer required. See this <post>.
  • Streaming UI3 on remote devices can result in choppy video if you don't have an excellent cellular connection. In this case you can view an adequate stream by adding &streamingprofile=Jpeg%20HD to the UI3 URLs in the code sections below.
EDIT (11/16/2022) About Pushover:
  • If you have any qualms about migrating to Pushover as your primary notification service, read this 2022 10-year anniversary blog post by the developer. I think his commitment and longevity is admirable.

Blue Iris Action setup:
via Camera settings > Alerts tab > 'On alert...' action set


View attachment 102328

Example 1...

Notification as received in the Pushover App.
View attachment 102329
Note that this example includes 2 hyperlinks in the message body.
IMPORTANT: The hyperlinks are active only AFTER you touch the notification.

Notification as touched.
View attachment 102330
  • The 1st hyperlink 'Hi-Res' shows the full-size markup that you can pinch/zoom to read the tiny AI labels.
  • The 2nd hyperlink 'UI3' streams the alert on your device.
Here is the code that you need to enter into the 'Parameters' field for Example 1.
Code:
https://api.pushover.net/1/messages.json -s --form-string "token=YOUR_APP_TOKEN_HERE" --form-string "user=YOUR_USER_KEY_HERE" --form-string "message=<b>&CAM</b> &MEMO <a href='&WAN/alerts/&ALERT_DB?fulljpeg'>Hi-Res</a> <a href='&WAN/ui3.htm?rec=&ALERT_DB'>UI3</a>" --form-string "html=1" --form-string "device=YOUR_PUSHOVER_DEVICE_NAME(S)_HERE" --form-string "sound=YOUR_PUSHOVER_SOUND_HERE" -F "attachment=@D:\BlueIris\Alerts\&ALERT_PATH"

Required & optional edits:
  • You must replace the placeholders YOUR_APP_TOKEN_HERE and YOUR_USER_KEY_HERE.
  • You must edit the 'attachment' string to reflect the actual path to your Blue Iris 'Alerts' folder.
  • Placeholders YOUR_PUSHOVER_DEVICE_NAME(S)_HERE and YOUR_PUSHOVER_SOUND_HERE are optional. Leave as is, or edit them as desired. For the former, you can specify multiple devices using a comma delimiter. Keep in mind that these are devices names as shown in your Pushover account.
Example 2...

Notification as received in the Pushover App.
View attachment 102332
Note that this example includes no hyperlinks in the message body.

Notification as touched.
View attachment 102333
Note the hyperlink below the image - it uses 'UI3' to stream the alert on your device.

Here's the code that you need to enter into the 'Parameters' field for Example 2.
Code:
https://api.pushover.net/1/messages.json -s --form-string "token=YOUR_APP_TOKEN_HERE" --form-string "user=YOUR_USER_KEY_HERE" --form-string "message=<b>&CAM</b> &MEMO" --form-string "html=1" --form-string "device=YOUR_PUSHOVER_DEVICE_NAME(S)_HERE" --form-string "sound=YOUR_PUSHOVER_SOUND_HERE" --form-string "url_title=Stream Alert via UI3" --form-string "url=&WAN/ui3.htm?rec=&ALERT_DB&maximize=1" -F "attachment=@D:\BlueIris\Alerts\&ALERT_PATH"



=====
API Syntax Reference Guide

Required code:
Code:
https://api.pushover.net/1/messages.json -s --form-string "token=YOUR_APP_TOKEN_HERE" --form-string  "user=YOUR_USER_KEY_HERE" --form-string "message=<b>&CAM</b> &MEMO" -F "attachment=@D:\BlueIris\Alerts\&ALERT_PATH"
Essential arguments:
Credentials
--form-string "token=YOUR_TOKEN_HERE" --form-string "user=YOUR_USER_KEY_HERE"
(EDIT 11/25/22) TIP: To future proof these arguments -- in the event that you create a new account, or a new application token -- you might consider storing your token strings in Blue Iris macros... to learn more, see the section near the end of this post.

Message
--form-string "message=<b>&CAM</b> &MEMO"
- Note that the message text may include Blue Iris macros, and HTML formatting code.
- Note that use of HTML formatting code requires an add-on argument.


Attachment
-F "attachment=@D:\BlueIris\Alerts\&ALERT_PATH"
NOTE: Failure to observe this syntax is the top reason why new users report first use problems
- Be sure to prefix the path with @ (the ‘at sign’ ).
- Be sure to provide the full path to your Blue Iris 'Alerts' folder.
- Be sure to pay attention to spaces … e.g., some users have a space between Blue & Iris
-
EDIT (9/29/22) Be sure that alert images are actually being saved to the folder path specified… <example>
-
EDIT (1/8/23) Attachments are size limited at 2.5MB.
-
EDIT (2/8/23) You may not need to use settings 'Add to alerts list: Hi-res JPEG files' or 'Burn label mark-up onto alert images'. See this post. Note the caveat.
- EDIT (5/24/23) For a work around for the attachment file size limit, see this post

Add-on arguments:

To include links and HTML formatting tags in the message argument:
--form-string "html=1"

To include a UI3 link to stream the alert:
--form-string "url_title=Stream Alert via UI3" --form-string "url=&WAN/ui3.htm?rec=&ALERT_DB&maximize=1"
Notes:

- REDACTED (9/30/22) the @ before &ALERT_DB is recommended for Blue versions 5.5.7.4+. For the reason why, see this post.
- To restrict data usage on mobile devices, you can add a URL argument like &streamingprofile=Jpeg%20HD to the UI3 URL. For more options see UI3 help (URL parameters).
- UI3 now supports short form URL parameters, allowing users to shorten long URLs. For example

"url=&WAN/ui3.htm?r=&ALERT_DB&m=1&p=Jpeg%20HD"


To send to specific device(s) only:
Use a comma delimiter. Keep in mind that these must be device names as shown in your Pushover account
dashboard.
--form-string "device=YOUR_PUSHOVER_DEVICE_NAME(S)_HERE"

(EDIT 11/25/22) TIP: To future proof this argument -- e.g., when you get a new device -- you might consider storing your device list in a Blue Iris macro... to learn more, see the section near the end of this post.

To use a custom notification sound:
Must be a sound names from this Pushover list, or a custom sound from your Pushover account dashboard.
--form-string "sound=YOUR_PUSHOVER_SOUND_HERE"

(EDIT 11/25/22) TIP: To future proof this argument -- e.g., you find a better sound -- you might consider storing your sound name in a Blue Iris macro... to learn more, see the section near the end of this post.

To send emergency notifications:
Edit arguments retry and expire as desired. The units are seconds.
--form-string "priority=2" --form-string "retry=30" --form-string "expire=300"

=====
Testing using the Windows Command Prompt

To verify that curl.exe is installed on your system, type curl.exe -V in a cmd.exe window.

View attachment 128177

To test your API command syntax before using it in a Blue Iris 'Run a program' action, try sending it directly in a cmd.exe window.
curl.exe https://api.pushover.net/1/messages.json YOUR_ARGUMENTS_HERE

Example:
View attachment 131348

EDIT (6/21/2022): You can also add add argument --verbose to examine details.
View attachment 131349

=====
Debugging

EDIT (1/29/2023) Do not use the Action Set ‘Test’ button (lightning bolt) to test your Pushover ‘Run a Program’ actions. Use real triggers instead, e.g., actually walk in front of the camera... To learn more, read the Help PDF, specifically the section ‘Testing the Action Set’ in the ’Alerts and Actions’ chapter. See also this thread <link>.

Using Blue Iris actions requires that you are not running the Blue Iris service using a LocalSystem account.
To learn more, read the Help PDF, specifically the first section in the Administration chapter.

If you are already running the Blue Service service using a user account, then try these 'tricks':
1. Make sure the macros are resolving when requested from the service <link>, and/or
2. Capture the actual Pushover API command in a *.txt file for inspection <link>.


=====
How to store and use your pushover credentials (and device_list and sound) in Blue Iris numbered macros

You might like this trick to shorten your lengthy API command strings, and future proof your setup... With it, your API commands may look like this:
Code:
https://api.pushover.net/1/messages.json -s --form-string "token=%996" --form-string  "user=%997" --form-string "message=<b>&CAM</b> &MEMO" -F "attachment=@D:\BlueIris\Alerts\&ALERT_PATH" --form-string "device="%998" --form-string "sound=%999"
Note the numbered macros %996, %997, %998 and %999 in the credential, device and sound arguments.

To successfully execute the code above, you first need to create the macros.
1. Edit the registry directly -- or perhaps safer, use your browser and the URLs below -- to create numbered macros higher than %10.
Replace my webserver address with yours.
2. Open 'regedit.exe'.
3. Navigate to registry key Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Perspective Software\Blue Iris\Macros.
4. Double-click reg key %996 and paste in your pushover 'token'.
5. Double-click reg key %997 and paste in your pushover 'user'.
6. Double-click reg key %998 and paste in your pushover devices list (comma delimited).
6. Double-click reg key %999 and paste in your pushover sound.

Comments:
1. Why do this? If you ever need to change your API credentials and/or device list (new devices?), storing them in macros is far easier than editing all the Blue Iris actions that use them. It also reduces the string length of the API command.
2. Of course you can use any macro numbers you want. I like high ones for constants, and I reserve lower numbers for my dynamic macros.
3. EDIT (9/29/22) Another reason you may want to change your credentials in the future is that Pushover lets you create multiple applications. For example, you could create applications like 'Blue Iris Tools', 'Blue Iris Actions', 'PowerShell', and 'OpenHAB' to separately track notifications from each source. A neat benefit of this is that you can view stats for each application in your Pushover dashboard; furthermore, each Application has its own 10,000 notifications quota! <link>
Nice going to try that. Been having issues with telegram connection issues recently. No idea why.
 
What is the advantage of the above #2 option?
It's a matter of personal preference.

I commented on some benefits in my reply to post #11 in the GIF thread.

The cons are:
  1. it works best only if the camera is configured to use AI, AND to save a DAT file with sufficient images (the script grabs the images from the DAT file to create the GIF).
  2. it is perhaps a few seconds slower in sending sending the notification.
[EDIT] For me, I am willing to tolerate a small delay in receiving GIF notifications because they help me immediately understand what is happening.
This is a result of the additional information they provide -- as described in post #11 in the GIF thread.
 
Last edited:
  • Like
Reactions: Pentagano
Updated Powershell script 'pushover_resize.ps1' (post #347)
Script updated to V1.9
  • fixed bug with Pushover -Priority parameter (mis-typed as [string] instead of [int])
  • reworked function PurgeOldFile()