From bb6dd3cf3e78ecfe55458d5e746dc56ff84375ce Mon Sep 17 00:00:00 2001 From: Tony Stork Date: Sat, 22 Mar 2025 23:16:59 -0400 Subject: [PATCH] Send notifications to my phone from issue reporter --- issue-reports/notifications.js | 20 ++++++++++++++++++++ issue-reports/prep-api-data.js | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 issue-reports/notifications.js diff --git a/issue-reports/notifications.js b/issue-reports/notifications.js new file mode 100644 index 0000000..fc75121 --- /dev/null +++ b/issue-reports/notifications.js @@ -0,0 +1,20 @@ +const statusCode = msg.statusCode +const issueNumber = msg.payload.number +const issueTitle = msg.payload.title +const url = msg.payload.html_url +const user = msg.user + +let notification = { + "title": "Issue Submitted", + "message": `${user.firstName} ${user.lastName} submitted a new issue: #${issueNumber} - ${issueTitle}`, + "actions": [ + { + "action": "URI", + "uri": url, + "title": "View Issue" + } + ] +} + +node.send(notification) +node.status({fill:'green',shape:'dot',text:`Issue #${issueNumber} notification sent`}) \ No newline at end of file diff --git a/issue-reports/prep-api-data.js b/issue-reports/prep-api-data.js index 0a5bf89..2852734 100644 --- a/issue-reports/prep-api-data.js +++ b/issue-reports/prep-api-data.js @@ -4,6 +4,7 @@ const typeEnhancementLabel = flow.get("typeEnhancementLabel", "diskCon") const typeAdjustmentLabel = flow.get("typeAdjustmentLabel", "diskCon") const title = msg.text const type = msg.type +const user = msg.user let labels = [needsReponseLabel] let formatType = {} @@ -23,7 +24,7 @@ let newTitle = `${formatType}: ${title}` msg.payload = { "title": newTitle, - "body": "This issue was submitted by the automated form on the main Home Assistant dashboard", + "body": `This issue was submitted by ${user.firstName} ${user.lastName}, using the automated form on the main Home Assistant dashboard`, "assignees":["tm24fan8"], "labels": labels }