Help with passing URL into notification
Hi, I am trying to pass a url into an actionable notification that is to take doorbell press as a trigger to check for doubletake if there is a facial match, send the snapshot into a notification or if its unknown to send the latest unknown snapshot from the doorbell. if i check the debug it shows the URL, but when pressing the notification on my phone it doesnt open the image, it instead loads my dashboard.
This is the function node:
function toProperCase(str) {
return str.replace(/\w+/g, function(txt) {
return txt.charAt(0).toUpperCase() + txt.slice(1).toLowerCase();
});
}
// Check if msg.doubletake and its properties exist
if (msg.payload && msg.payload.attributes && msg.payload.attributes.matches && msg.payload.attributes.matches[0]) {
var name = msg.payload.attributes.matches[0].name;
var snapshot = msg.payload.attributes.matches[0].filename;
if (name && snapshot) {
// Both 'name' and 'image' exist, publish them as is
msg.name = toProperCase(name); // Use proper case for 'name'
msg.snapshot = 'https://domain.com/api/storage/matches/' + snapshot;
} else {
// At least one of them is missing, publish holding image and name "Someone"
msg.name = "Someone";
msg.snapshot = 'https://domain.com/api/storage/matches/' + snapshot; // Remove the extra single quote here
}
} else {
// If msg.doubletake.attributes.matches[0] doesn't exist, publish holding image and name "Someone"
msg.name = "Someone";
msg.snapshot = 'https://domain.com/api/storage/latest/front_door.jpg'; // Replace with your desired holding image URI
}
return msg;
This is the call service node data:
{
"title": "Front Door",
"message": "{{name}} Rang the Doorbell at {{mytime}}",
"data": {
"ttl": 0,
"priority": "high",
"image": "/api/camera_proxy/camera.front_door",
"channel": "Doorbell-Test",
"color": "#ff5722",
"notification_icon": "mdi:doorbell-video",
"tag": "Doorbell-Test",
"alert_once": true,
"actions": [
{
"action": "URI",
"title": "Open Reolink App",
"uri": "app://com.mcu.reolink"
},
{
"action": "URI",
"title": "Open Snapshot",
"uri": "{{snapshot}}"
}
]
}
}