Skip to content

Commit 06a9c48

Browse files
committed
let pushover take an attachment object
1 parent 9a67173 commit 06a9c48

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

social/pushover/57-pushover.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,13 @@ module.exports = function(RED) {
118118
// Unset these temporary values
119119
attachmentBuffer = attachmentString = undefined;
120120
// attach the buffer
121-
pushmsg.file = { data: attachment };
121+
pushmsg.file = { data:attachment };
122+
}
123+
else if (typeof(msg.attachment) === 'object' && msg.attachment.hasOwnProperty('name') && msg.attachment.hasOwnProperty('data')) {
124+
pushmsg.file = msg.attachment;
122125
}
123126
else if (attachment) {
124-
node.error("[57-pushover.js] Error: attachment property must be a path to a local file or a Buffer containing an image");
127+
node.error("[57-pushover.js] Error: attachment property must be a path to a local file or a Buffer containing an image, or an object containing both name and data properties");
125128
return;
126129
}
127130
pushMessage(pushmsg,msg);

social/pushover/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Optionally uses `msg.topic` to set the configuration, if not already set in the
2121
- `msg.device`: to set the device
2222
- `msg.priority`: to set the priority
2323
- `msg.topic`: to set the title
24-
- `msg.attachment`: to specify an image to attach to message (path as a string or Buffer containing image)
24+
- `msg.attachment`: to specify an image to attach to message. Either as a path as a string, or Buffer containing image as either binary or base64 encoded, or an object containing "name" and "data" properties.
2525
- `msg.url`: to add a web address
2626
- `msg.url_title`: to add a url title
2727
- `msg.html`: set to true or 1 if message is HTML formatted, see the [supported tags](https://pushover.net/api#html)

social/pushover/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "node-red-node-pushover",
3-
"version": "0.2.2",
3+
"version": "0.3.0",
44
"description": "A Node-RED node to send alerts via Pushover",
55
"dependencies": {
66
"pushover-notifications": "^1.2.3"

0 commit comments

Comments
 (0)