You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
HelenaExpressApp/www/assets/js/telegram.js

27 lines
1.0 KiB
JavaScript

/*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
function sendTelegram() {
app.dialog.preloader("Sending...");
apirequest(SETTINGS.apis.sendtelegram, {
accountnumber: getStorage("accountnumber"),
accountkey: getStorage("accountkey"),
message: $("#telegrammessage").val(),
to: $("#telegramto").val(),
from: $("#telegramfrom").val(),
instructions: $("#telegraminstructions").val()
}, function (resp) {
app.dialog.close();
if (resp.status == "OK") {
app.dialog.alert(resp.msg, "Telegram Sent!");
} else if (resp.status == "ERROR") {
app.dialog.alert(resp.msg, "Error");
}
}, function (error) {
app.dialog.close();
app.dialog.alert("There's a server or network problem. Check your Internet connection or try again later.", "Error");
});
}