Browse Source

added click send to number

pull/798/head
Tarun Singh 3 years ago
parent
commit
ba1e025353
  1. 7
      server/notification-providers/clicksendsms.js
  2. 7
      src/components/notifications/ClickSendSMS.vue

7
server/notification-providers/clicksendsms.js

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

7
src/components/notifications/ClickSendSMS.vue

@ -12,9 +12,13 @@
<div class="mb-3">
<div class="form-text">
{{ $t("checkPrice", [$t("clicksendsms")]) }}
<a href="https://www.clicksend.com/us/pricing" target="_blank">here</a>
<a href="https://www.clicksend.com/us/pricing" target="_blank">https://clicksend.com/us/pricing</a>
</div>
</div>
<div class="mb-3">
<label for="clicksendsms-to-number" class="form-label">Recipient Number</label>
<input id="clicksendsms-to-number" v-model="$parent.notification.clicksendsmsToNumber" type="text" minlength="8" maxlength="14" class="form-control" required>
</div>
<div class="mb-3">
<label for="clicksendsms-sender-name" class="form-label">From Name/Number -
<a href="https://help.clicksend.com/article/4kgj7krx00-what-is-a-sender-id-or-sender-number" target="_blank">More Info</a>
@ -23,7 +27,6 @@
<div class="form-text">Leave blank to use a shared sender number.</div>
</div>
</template>
<script>
import HiddenInput from "../HiddenInput.vue";

Loading…
Cancel
Save