Pushover Node Image Attachment Support

Pushover Node Image Attachment Support

Hi Node-redders,

I’m keen to add image attachment support to the built in node-red pushover node. Handy to attach a picture from a security camera that detects motion for instance.

I'm preparing a PR for the pushover-notifications module that underpins node-red-node-pushover to implement the new v3 API image attachment feature.

It's a surprisingly simple enhancement, and I'm reasonably confident that the author will accept the PR. With this PR merged, adding this feature to node-red-node-pushover should be relatively straight-forward. I’m happy to implement this feature and issue a PR to the [node-red-nodes]repository containing the source.

So the purpose of this topic is to:

  1. consult with @knolleary, @dceejay and the broader NR community before proceeding with a PR for the pushover node as per accepted practice.
  2. garner input/advice from the broader community about how to implement the feature.

On point 1, I am aware that a contrib node exists([node-red-contrib-pushover]). Apart from the issue of largely duplicated functionality of a core node, there are two other problems. Firstly, it fails when you use it without an image attachment. Secondly it doesn’t support sending images stored as a Buffer within the NR msg object received. I see this as a common use case to the extent that someone else wrote a fork - [node-red-contrib-pushover-inline-image] which still suffers from the above problems rooted in its parent.

The following briefly outlines what I propose, but if there are better ideas, please share.

  1. Introduce an attachment msg property to provide an image for the message. This property name aligns with the pushover API
  2. This property's value can be either a path to a local file expressed as a string or a Buffer object that holds the image itself to send

With this implementation, the node can, asynchronously, send a pushover message attaching an image from the filesystem. But it can also, synchronously, send a pushover message attaching an image from a Buffer object provided in the NR msg object.

Over to the community. :slight_smile:

Cheers,
Damo.

A PR sounds good to me

Hey Dave/Everyone,

I've prepared and published an experimental version of the pushover node that supports image attachments on my github page. It includes instructions for installing it, and removing it without disrupting your existing flows. Of course, you should always backup just in case. :wink:

If you are interested in having image support, you can install this version and it will work with all your existing nodes. Removing it as per the instructions will replace it with the standard node-red version.

I'm using it with my Foscam cameras to send a screenshot when motion is detected. So far, working very well. :+1:

Any issues, please report them on the github issues page.

The reason I'm putting this out to the community for testing and feedback is that there are no existing test scripts for the pushover node. It appears to be one created early in node-red's lifetime. So I'm putting it out this way first for community testing before issuing a PR.

Dave, if a PR must have tests written, might you be able to assist me with that?

Cheers,
Damo.