add octopush notification service

This commit is contained in:
Alexandre Gagner 2021-08-12 00:15:53 +02:00
parent 6a8ccf627a
commit ed93aae1c2
2 changed files with 59 additions and 0 deletions

View file

@ -193,6 +193,33 @@ class Notification {
console.log(error)
return false;
}
} else if (notification.type === "octopush") {
try {
let config = {
headers: {
'api-key': notification.octopushAPIKey,
'api-login': notification.octopushLogin,
'cache-control': 'no-cache'
}
};
let data = {
"recipients": [
{
"phone_number": notification.octopushPhoneNumber
}
],
"text": msg,
"type": notification.octopushSMSType,
"purpose": "alert",
"sender": notification.octopushSenderName
};
await axios.post(`https://api.octopush.com/v1/public/sms-campaign/send`, data, config)
return true;
} catch (error) {
console.log(error)
return false;
}
} else if (notification.type === "slack") {
try {
if (heartbeatJSON == null) {