Sending image (binary data) via pushover

Hello

Just wondering if anyone has managed to send an image (binary format) via pushover ?

I have pushover working successfully with nodered using node-red-node-pushover. Just can't work out how to send an image.

AFAIK - pushover only supports text notifications.

You can send images now. I think they've updated it.

Aah - yes - I can see that images can be attached :slight_smile:
https://pushover.net/api#attachments
I'll try it out (I use Pushover a lot) and see if it can be used.

It might be that the NR node needs updating to match

I found node-red-contrib-pushover-inline-image which seems to support attaching images (both raw + file), but for some reason I cannot get it to send any message to my pushover account (let alone an image)

I get the error ""TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined" when sending injecting a string of abcdef into the node.

1 Like

That mentions things called "glances" and the node is 5 years old so I wonder if it was a deprecitated method

I'm just going to try using exec node to call curl to get something going

No worries thanks for your help

I got this working on my Pi

[{"id":"283d8e38809b8112","type":"inject","z":"7f8871c5134029d6","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":150,"y":530,"wires":[["9a1d93ce76cc3892"]]},{"id":"520ecc120e844d1e","type":"debug","z":"7f8871c5134029d6","name":"debug 396","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":530,"wires":[]},{"id":"336d93dd1bc803c8","type":"exec","z":"7f8871c5134029d6","command":"curl -s \\  ","addpay":"payload","append":"","useSpawn":"false","timer":"","winHide":false,"oldrc":false,"name":"","x":530,"y":530,"wires":[["520ecc120e844d1e"],["520ecc120e844d1e"],["520ecc120e844d1e"]]},{"id":"9a1d93ce76cc3892","type":"template","z":"7f8871c5134029d6","name":"","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":" --form-string \"token=APP_TOKEN\" \\\n --form-string \"user=USER_KEY\" \\\n --form-string \"message=hello world\" \\\n -F \"attachment=@/home/pi/image.jpg\" \\\n https://api.pushover.net/1/messages.json","output":"str","x":330,"y":530,"wires":[["336d93dd1bc803c8"]]}]

image

This is what it looked like on my phone and watch

2 Likes

Sweet - thanks! So you can only send an actual image file, not the raw binary data?

Hey - I've only been working on this for 30 mins :slight_smile:

1 Like

So, what is it your actually wanting to send?

Lets start again :slight_smile:
I'd assumed that you tried the main node-red pushover node and that hadn't worked

But it does :slight_smile:
image
You just set msg.attachment to your image and it just works :slight_smile:
image

The node-red-node-pushover node help also says you can make the attachment a buffer

image

:slight_smile:

I didn't see that in the help menu for the node. Thanks for pointing that out.

I have the raw binary data for the image, but I can't work out how to send this data using msg.attachment.

When I set msg.attachment to the binary data (i.e. msg.attachment = raw binary data as a string), I get the error "Error: File Read Error: Error: ENOENT: no such file or directory, open..."

Obviously it is looking for an image file. Do you know how to send the binary data as an image instead of saving the image to a file then sending it using the node?

Dont set a string, set a buffer.

Where does the image come from? Do you process it convert it from a buffer into a string?

The image is coming from a camera snapshot URL via http request node.

It is stored in payload as a buffer. In the debug node, I can view it as raw which looks like this:
ÿØÿàJFIFÿÛÅaaaa 

 $.' ",#(7),01444'9=82<.342 bla bla

or as a string array with 499 parts, each having as hex value.

When I take the raw data and send it as a buffer using msg.attachment and an inject node, I get "SyntaxError: Unexpected token 'ÿ', "ÿØÿàJFIF"... is not valid JSON"

Connect a debug node showing what is going into the pushover node. Set the debug node to Output Full Message and show us what you see in the debug pane. Click in the debug node to expand what is there if necessary.

Ok here is the flow:

image

This is the output of the http request node (debug 6):

image

This is the output of the set node (debug 8) going into pushover:

image

I get nothing on my pushover account.

When I use a template node via injection to set payload to some characters and send to the pushover node, I get the message containing those characters.

Isn't payload supposed to be a string containing the message body?

Also, please expand and show me the first 20 bytes of attachment.

Well according to @cymplecy and the help menu, the attachment is sent via msg.attachment.

First 20 bytes are as follows:
image

Ok so this is a JPEG image (good) but really it is a JFIF & that may not be supported by pushover? (Probably is, but worth noting)

JPEG image files begin with FF D8 and end with FF D9. JPEG/JFIF files contain the ASCII code for "JFIF" (4A 46 49 46) as a null terminated string


You did not respond to this part. You are sending the image/buffer in payload as well as attachment. So I'll ask again: Isn't payload supposed to be a string containing the message body?