33 lines
629 B
JavaScript
33 lines
629 B
JavaScript
const axios = require('axios');
|
|
|
|
|
|
async function send(contact, notification)
|
|
{
|
|
try
|
|
{
|
|
const data = {
|
|
token: contact.token,
|
|
user: contact.user,
|
|
message: notification.message,
|
|
priority: notification.priority,
|
|
timestamp: notification.timestamp,
|
|
url: notification.url,
|
|
url_title: contact.urlTitle || 'Manage notifications'
|
|
};
|
|
|
|
if (notification.sound)
|
|
data.sound = notification.sound;
|
|
|
|
const response = await axios.post("https://api.pushover.net/1/messages.json", data);
|
|
return response.statu;
|
|
}
|
|
catch
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
module.exports = {
|
|
send
|
|
} |