-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add HostedSMS.pl notification provider #3176
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed CRLF -> LF
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution, I have left some small inline comments, but nothing major
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution, I have left some small inline comments, but nothing major
|
||
name = "hostedsms"; | ||
|
||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that msg
is never used.
When monitorJSON
and heartbeantJSON
are null, msg
is used for other general messages such as testing or certificate alert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a few inline comments.
Some of them are for style by, but two of them also address the issue noted by Louis ^^
(sorry for making faulty suggestions before)
let textMsg = ""; | ||
if (heartbeatJSON && heartbeatJSON.status === UP) { | ||
textMsg = `✅ [${monitorJSON.name}] is back online`; | ||
} else { | ||
textMsg = `🔴 [${monitorJSON.name}] went down`; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let textMsg = ""; | |
if (heartbeatJSON && heartbeatJSON.status === UP) { | |
textMsg = `✅ [${monitorJSON.name}] is back online`; | |
} else { | |
textMsg = `🔴 [${monitorJSON.name}] went down`; | |
} | |
let textMsg = msg; | |
if (heartbeatJSON && heartbeatJSON.status === UP) { | |
textMsg = `✅ [${monitorJSON.name}] is back online`; | |
} else if (heartbeatJSON && heartbeatJSON.status === DOWN) { | |
textMsg = `🔴 [${monitorJSON.name}] went down`; | |
} |
/* | ||
Create shorter alert message to avoid extra SMS costs (1 SMS with unicode has limit to 70 characters) | ||
https://github.com/louislam/uptime-kuma/pull/3176#discussion_r1199601497 | ||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/* | |
Create shorter alert message to avoid extra SMS costs (1 SMS with unicode has limit to 70 characters) | |
https://github.com/louislam/uptime-kuma/pull/3176#discussion_r1199601497 | |
*/ | |
// Create shorter alert message to avoid extra SMS costs (1 SMS with unicode has limit to 70 characters) |
@@ -0,0 +1,52 @@ | |||
const NotificationProvider = require("./notification-provider"); | |||
const axios = require("axios"); | |||
const { UP } = require("../../src/util"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const { UP } = require("../../src/util"); | |
const { UP, DOWN } = require("../../src/util"); |
let okMsg = "Sent Successfully."; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let okMsg = "Sent Successfully."; | |
const okMsg = "Sent Successfully."; | |
const url = "https://api.hostedsms.pl/SimpleApi"; | |
"Sender": notification.hostedsmsSenderName, | ||
}; | ||
|
||
let resp = await axios.post("https://api.hostedsms.pl/SimpleApi", data, config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let resp = await axios.post("https://api.hostedsms.pl/SimpleApi", data, config); | |
let resp = await axios.post(url, data, config); |
let okMsg = "Sent Successfully."; | ||
|
||
try { | ||
let config = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let config = { | |
const config = { |
textMsg = `🔴 [${monitorJSON.name}] went down`; | ||
} | ||
|
||
let data = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let data = { | |
const data = { |
https://github.com/louislam/uptime-kuma/blob/master/CONTRIBUTING.md#can-i-create-a-pull-request-for-uptime-kuma
Tick the checkbox if you understand [x]:
Description
This PR adds support HostedSMS.pl SMS gateway via HTTPS SimpleApi.
Type of change
Please delete any options that are not relevant.
Checklist
(including JSDoc for methods)
Screenshots (if any)