I built a custom web-push module and I want to return a message from that module.
Below is the code
This is my module
const webpush = require("web-push");
exports.pushNotification = function (options) {
options = this.parse(options);
const mailto = options.mailto;
const publicKey = options.publickey;
const privateKey = options.privateKey;
const endpoint = options.endpoint;
const authKey = options.authKey;
const p256dh = options.p256dh;
const pushConfig = {
endpoint: endpoint,
keys: {
auth: authKey,
p256dh: p256dh,
},
};
webpush.setVapidDetails(`mailto:${mailto}`, publicKey, privateKey);
webpush
.sendNotification(
pushConfig,
JSON.stringify({
title: "New Comment",
content: "New Comment added!",
openUrl: "/help",
})
)
.catch(function (err) {
console.log(err);
});
return {
message: "Push notification sent"
}
}
This is the hjson
{
type:"webpush",
module:"webpush",
action:"pushNotification",
groupTitle:"Custom Actions",
groupIcon:"fas fa-lg fa-database comp-data",
title:"Web Push",
icon:"fas fa-lg fa-table comp-data",
dataPickObject:true,
dataScheme:[
{
name:"message",
type:"object",
sub:[
{
name:"message",
type:"text"
}
]
}
],
properties:[
{
group:"Web Push Properties",
variables:[
{
name:"mail",
optionName:"mail",
title:"mail",
type:"text",
required:true,
defaultValue:"",
serverDataBindings:true
},
{
name:"publicKey",
optionName:"publicKey",
title:"Public Key",
type:"text",
serverDataBindings:true,
type:"text",
defaultValue:""
},
{
name:"privateKey",
optionName:"privateKey",
title:"Private Key",
type:"text",
defaultValue:"",
serverDataBindings:true
},
{
name:"endpoint",
optionName:"endpoint",
title:"End Point",
type:"text",
defaultValue:"",
serverDataBindings:true
},
{
name:"authKey",
optionName:"authKey",
title:"Auth Key",
type:"text",
defaultValue:"",
serverDataBindings:true
},
{
name:"p256dh",
optionName:"p256dh",
title:"p256dh",
type:"text",
defaultValue:"",
serverDataBindings:true
}
]
}
]
}
This is the server connect
This is the response where I can’t see my module response

