Alert Action -> Telegram sendPhoto

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
1638029919456.png

results in:

1638029966598.png

and a delivery to Telegram:

1638030010667.png

With Telegram's sendPhoto, I understand cURL is required :

curl -F chat_id=-CHATID -F photo=@PHOTO -F caption=CAPTION

Which delivers a test image to Telegram.

However, all attempts in doing this from the Alert Action fails:

1638032017908.png

resulting in:

1638032070899.png

Any advise on how to correctly populate the Action in BI ?
 
Last edited:

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
657
Reaction score
629
Location
SF Bay Area
I use a full Windows path in the 'photo=' argument
Code:
https://api.telegram.org/botxxxx/sendphoto -F chat_id=xxxx -F photo=@"D:\Blue Iris\Alerts\&ALERT_PATH" -F caption="[*&CAM*](&WAN/alerts/&ALERT_DB?fulljpeg)  [UI3](&WAN/ui3.htm?rec=&ALERT_DB&maximize=1) \- &MEMO" -F parse_mode=MarkdownV2
~~~~~
BTW, you can use the following 'trick' to see what Blue Iris is sending for the macro values...
Use the following action and edit the 'Parameters' field for the macro(s) in question.
I've assigned this action to a camera preset 'On call' action which I use as a utility.

1629576871850.png


It will pop up a 5-second duration self-closing window like this

1629571942172.png
 

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
Hi jaydeel.

Thanks for replying, yet unfortunately not that much joy as yet. Setting the parameter as :

-F chat_id=xxxx -F photo=@"C:\BlueIris\Telegram_Alerts\&ALERT_PATH" -F caption=&CAM -F parse_mode=MarkdownV2

Results in:

1638143568335.png

No errors, yet no image or anything in Telegram.

Changing the parameter as to specify an image :

-F chat_id=xxxx -F photo=@"C:\BlueIris\Telegram_Alerts\test.jpg" -F caption=&CAM -F parse_mode=MarkdownV2

1638143140471.png
Results in:

1638143568335.png

with an image delivered to Telegram with the &CAM value set correctly :thumb:

Changing the image location path to either "C:\BlueIris\Telegram_Alerts\&ALERT_PATH" or "C:\BlueIris\Telegram_Alerts\&ALERT_JPEG" results in the Test completed window, yet without anything delivered to Telegram.

1638144310957.png

Adding /TIME:5 to the parameter unfortunately does not keep the window open long enough as to validate any error or the variables being send in any of the scenarios. Unfortunately I'm still stumped...
 

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
1638152931081.png

results in the only window being:

1638152976903.png

Sorta expected as I can't find an msg.exe on the box :thumbdown:

and with

1638153089972.png

I get:

1638153367373.png

Yet no other window.


So I then created a script file containing only

curl -F chat_id=XXXX -F caption=$1 -F photo=@C:\BlueIris\Telegram_Alerts\$2

1638153632934.png

of which I get only the "Test completed" window and still no image delivered to Telegram.

1638153697673.png
 

Attachments

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
Reverting back to a message alone:

1638154454162.png

also results in the "Test completed" window only, yet with no message in Telegram.

1638154519279.png

Yet, if I run the script from the command line, the message is delivered to Telegram.

Message.cmd Test
{"ok":true,"result":{"message_id":xxxx,"sender_chat":{"id":xxxx,"title":"Info","type":"channel"},"chat":{"id":xxxx,"title":"Info","type":"channel"},"date":1638154671,"text":"Test"}}

Is there a log file which could be referenced ?
 

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
657
Reaction score
629
Location
SF Bay Area
1. My ‘photo=‘ argument photo=@"D:\Blue Iris\Alerts\&ALERT_PATH" points to the Blue Iris Alerts folder. Does yours?

1638155642486.png

2. msg.exe may be missing on your system (more). Mine is located here (Windows 10 Pro):
C:\Windows\System32\msg.exe

3. I don’t understand why you are using the msg.exe ‘* /TIME:5’ parameter in non ‘msg.exe’ actions.
 
Last edited:

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
1. 'photo=' argument points to C:\BlueIris\Telegram_Alerts

1638157884938.png

which I created

1638158086093.png

and is being populated upon alerts

1638159838236.png

1638159085633.png

2. Indeed, no "msg.exe" on the box. Will look into it.

3. :oops: cause I had no idea on msg.exe previously. Though it was somehow related to BI. :facepalm:
 

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
It's definitely the variables.

1638166691107.png

results in:

1638167102593.png

yet the files in c:\BlueIris\Telegram_Alerts

1638167197608.png

How would the &ALERT_PATH match to a file as &ALERT_JPEG is unknown and as seen before, only &CAM is "usefull"

How to fix this ...
 
Last edited:

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
P.S. Deepstack is implemented as to validate an image before sending it.
 
Last edited:

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
657
Reaction score
629
Location
SF Bay Area
BTW, what you are calling ‘variables’ are called ‘macros’ in the Blue Iris help pdf (e.g., &ALERT_PATH). This may matter when you are searching the help file and this forum.

You would need to confirm with with the developer, but I suspect macro &ALERT_PATH requires the existence of the ‘Alerts’ folder on the ‘Clips and archiving’ page. This folder is not apparent in your screenshot above. Perhaps you’ve renamed or deleted it?

This is what I see when using msg.exe with parameter ‘* /TIME:15 DB=&ALERT_DB, PATH=&ALERT_PATH’.
1638204287771.jpeg
Tip: I’ve assigned this action to a preset on all cameras of interest so I can execute it on demand while debugging scripts, etc.
 

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
After days of battling, finally a win !

Did a complete re-install of Windows + BlueIris.

This time round, did not create a new folder for Alert Action Images. Basically, made no changes in Clips & Archiving.

In each cameras' settings, set "When triggered" to "Add to alert list: Hi-res JPEG files" which then populates the c:\BlueIris\Alerts folder.

1638230680896.png

Under "Immediate actions" set a run Action to "msg the macros' values at time of trigger".

1638230774444.png

Under "Artificial Intelligence"

unchecked "Use main stream if available"
checked "Apply to motion triggers only"

1638230939657.png

Under the camera's "Alerts", run curl with parameter - -F chat_id=XXXX -F photo=@"c:\BlueIris\Alerts\&ALERT_PATH" -F caption=&CAM

1638231319223.png

Executing a manual "Trigger" from the camera's context menu:

1638231635622.png

Pops up the macros' values and the image is received in Telegram

1638231419961.png

As such, no JPEG "recording" as previous used.

1638231928154.png

Thank YOU @jaydeel !!

P.S. and your parameter "-F photo=@"C:\Blue Iris\Alerts\&ALERT_PATH" -F caption="[*&CAM*](&WAN/alerts/&ALERT_DB?fulljpeg) [UI3](&WAN/ui3.htm?rec=&ALERT_DB&maximize=1) \- &MEMO" -F parse_mode=MarkdownV2" is brilliant !
 
Last edited:

jaydeel

BIT Beta Team
Joined
Nov 9, 2016
Messages
657
Reaction score
629
Location
SF Bay Area
A heads up… the two links have a finite lifetime… Ken reminded me recently that the DB locators are valid for long as the database is not rebuilt or compressed, which is daily by default.
 

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
Unfortunately I'm back again.

The success was related to doing a new install on a totally different machine, which never had BlueIris on before.

Reverting back to the original BlueIris machine and having uninstalled BlueIris, then also

1. deleting the registry keys
- Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Perspective Software &
- Computer\HKEY_CURRENT_USER\Software\Perspective Software
2. deleting the folder
- C:\BlueIris

followed by a reinstall and once again I am not receiving the Telegram images.

Applying the msg action and I get on a motion event:

1638423757819.png

... the @ALERT_PATH not being a filename anymore ...

1638424730483.png

The "Clips and archiving" is as default as per a new installation:

1638423815575.png

and though Alerts reflect within the console:

1638424387332.png

No files are being created within "C:\BlueIris\Alerts" as expected from the "Clips and archiving", having been the original issue ...

The cameras are recreated from scratch and under the "Record tab", only the "Pre-trigger video buffer" and "Combine or cut video" was amended.

1638424525648.png

Neither does the option exist to having the JPEGs specified to the Alerts folder. This being the reasoning I originally created the Telegram_Alerts folder.

Is it a case of enabling the JPEGs and storing it to a new folder, changes a value somewhere hidden than cannot be reverted back by a user ?

Problem being, even a re-install on the same machine does not resolve the issue and once you've touched the JPEGs setting ... no AI Alerts for you anymore ...

If I have it correct, what would be the best means to advise the developers ?
 

_Peek

Young grasshopper
Joined
Jun 1, 2020
Messages
36
Reaction score
11
Location
South
Too little sleep ... Too bad of an excuse.... Under "Trigger" tab, "When triggered" -> "Add to alert list" ---> Hi-res JPEG files

1638438894095.png

Doh !

Problem solved !
 
Top