apply pull request suggestions

pull/4481/head
Christoph Fichtmüller 3 months ago
parent a0283734ba
commit a5742d8e9c
No known key found for this signature in database
GPG Key ID: 40D6EF825FF2FA44

@ -10,21 +10,18 @@ class GtxMessaging extends NotificationProvider {
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
let authKey = notification.gtxMessagingApiKey;
let from = notification.gtxMessagingFrom.trim();
let to = notification.gtxMessagingTo.trim();
let text = msg.replaceAll("🔴 ", "").replaceAll("✅ ", "");
const from = notification.gtxMessagingFrom.trim();
const to = notification.gtxMessagingTo.trim();
// The UP/DOWN symbols will be replaced with `???` by gtx-messaging
const text = msg.replaceAll("🔴 ", "").replaceAll("✅ ", "");
try {
let data = new URLSearchParams();
const data = new URLSearchParams();
data.append("from", from);
data.append("to", to);
data.append("text", text);
let url = `https://rest.gtx-messaging.net/smsc/sendsms/${authKey}/json`;
console.log(`will post url: ${url}, data:`, data);
const url = `https://rest.gtx-messaging.net/smsc/sendsms/${notification.gtxMessagingApiKey}/json`;
await axios.post(url, data);

@ -2,14 +2,23 @@
<div class="mb-3">
<label for="gtxmessaging-api-key" class="form-label">{{ $t("gtxMessagingApiKey") }}</label>
<HiddenInput id="gtxmessaging-api-key" v-model="$parent.notification.gtxMessagingApiKey" :required="true"></HiddenInput>
<div class="form-text">
{{ $t("gtxMessagingApiKeyHint") }}
</div>
</div>
<div class="mb-3">
<label for="gtxmessaging-from" class="form-label">{{ $t("gtxMessagingFrom") }}</label>
<input id="gtxmessaging-from" v-model="$parent.notification.gtxMessagingFrom" type="text" class="form-control" required>
<div class="form-text">
{{ $t("gtxMessagingFromHint") }}
</div>
</div>
<div class="mb-3">
<label for="gtxmessaging-to" class="form-label">{{ $t("gtxMessagingTo") }}</label>
<input id="gtxmessaging-to" v-model="$parent.notification.gtxMessagingTo" type="text" pattern="^[\d-]{10,31}(@[\w\.]{1,})?$" class="form-control" required>
<input id="gtxmessaging-to" v-model="$parent.notification.gtxMessagingTo" type="text" pattern="^\+\d+$" class="form-control" required>
<div class="form-text">
{{ $t("gtxMessagingToHint") }}
</div>
</div>
<div class="mb-3">
<i18n-t tag="p" keypath="More info on:" style="margin-top: 8px;">

@ -885,6 +885,9 @@
"Browser Screenshot": "Browser Screenshot",
"What is a Remote Browser?": "What is a Remote Browser?",
"gtxMessagingApiKey": "API Key",
"gtxMessagingFrom": "From",
"gtxMessagingTo": "To"
"gtxMessagingApiKeyHint": "You can find your API key at: My Routing Accounts > Show Account Information > API Credentials > REST API (v2.x)",
"gtxMessagingFrom": "The originator of the message.",
"gtxMessagingFromHint": "Allowed is alphanumeric up to 11 chars, shortcode, local longcode or international number (E.164, E.212 or E.214).",
"gtxMessagingTo": "The recipient of the message.",
"gtxMessagingToHint": "International format, with leading \"+\" (E.164, E.212 or E.214)."
}

Loading…
Cancel
Save