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>