|
|
@ -20,16 +20,15 @@ class ClickSendSMS extends NotificationProvider {
|
|
|
|
messages: [
|
|
|
|
messages: [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
"body": msg.replace(/[^\x00-\x7F]/g, ""),
|
|
|
|
"body": msg.replace(/[^\x00-\x7F]/g, ""),
|
|
|
|
// TODO: To phone number concept to be added
|
|
|
|
"to": notification.clicksendsmsToNumber,
|
|
|
|
"to": "+61411111111",
|
|
|
|
|
|
|
|
"source": "uptime-kuma",
|
|
|
|
"source": "uptime-kuma",
|
|
|
|
"from": notification.clicksendsmsSenderName,
|
|
|
|
"from": notification.clicksendsmsSenderName,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
]
|
|
|
|
};
|
|
|
|
};
|
|
|
|
let resp = await axios.post("https://rest.clicksend.com/v3/sms/send", data, config);
|
|
|
|
let resp = await axios.post("https://rest.clicksend.com/v3/sms/send", data, config);
|
|
|
|
if (resp.data.http_code !== 200) {
|
|
|
|
if (resp.data.data.messages[0].status !== "SUCCESS") {
|
|
|
|
let error = "Something gone wrong. Api returned " + resp.data.response.status + ".";
|
|
|
|
let error = "Something gone wrong. Api returned " + resp.data.data.messages[0].status + ".";
|
|
|
|
this.throwGeneralAxiosError(error);
|
|
|
|
this.throwGeneralAxiosError(error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|