added click send to number

This commit is contained in:
Tarun Singh 2021-10-25 04:11:57 -04:00
parent fed611d1b9
commit ba1e025353
2 changed files with 8 additions and 6 deletions

View File

@ -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);
} }

View File

@ -12,9 +12,13 @@
<div class="mb-3"> <div class="mb-3">
<div class="form-text"> <div class="form-text">
{{ $t("checkPrice", [$t("clicksendsms")]) }} {{ $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> </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"> <div class="mb-3">
<label for="clicksendsms-sender-name" class="form-label">From Name/Number - <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> <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 class="form-text">Leave blank to use a shared sender number.</div>
</div> </div>
</template> </template>
<script> <script>
import HiddenInput from "../HiddenInput.vue"; import HiddenInput from "../HiddenInput.vue";