Added support for the CallMeBot API (WhatsApp, Telegram Call and Facebook Messanger)

pull/4605/head
BothimTV 2 months ago
parent 45690a25a0
commit 4bd9df8a55

@ -0,0 +1,21 @@
const NotificationProvider = require("./notification-provider");
const axios = require("axios");
class CallMeBot extends NotificationProvider {
name = "CallMeBot";
/**
* @inheritdoc
*/
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
const okMsg = "Sent Successfully.";
try {
await axios.get(`${notification.callMeBotEndpoint}&text=${encodeURIComponent(msg)}`);
return okMsg;
} catch (error) {
this.throwGeneralAxiosError(error);
}
}
}
module.exports = CallMeBot;

@ -6,6 +6,7 @@ const AliyunSms = require("./notification-providers/aliyun-sms");
const Apprise = require("./notification-providers/apprise");
const Bark = require("./notification-providers/bark");
const ClickSendSMS = require("./notification-providers/clicksendsms");
const CallMeBot = require("./notification-providers/call-me-bot");
const SMSC = require("./notification-providers/smsc");
const DingDing = require("./notification-providers/dingding");
const Discord = require("./notification-providers/discord");
@ -78,6 +79,7 @@ class Notification {
new Apprise(),
new Bark(),
new ClickSendSMS(),
new CallMeBot(),
new SMSC(),
new DingDing(),
new Discord(),

@ -115,6 +115,7 @@ export default {
"apprise": this.$t("apprise"),
"Bark": "Bark",
"clicksendsms": "ClickSend SMS",
"CallMeBot": "CallMeBot (WhatsApp, Telegram Call, Facebook Messanger)",
"discord": "Discord",
"GoogleChat": "Google Chat (Google Workspace)",
"gorush": "Gorush",

@ -0,0 +1,45 @@
<template>
<div class="mb-3">
<label for="callmebot-endpoint" class="form-label">{{ $t("Endpoint") }}</label>
<div class="input-group mb-3">
<input id="callmebot-endpoint" v-model="$parent.notification.callMeBotEndpoint" type="text" class="form-control" required>
<button v-if="$parent.notification.callMeBotEndpoint" class="btn btn-outline-secondary" type="button" @click="cleanupEndpoint">
{{ $t("Cleanup") }}
</button>
</div>
<i18n-t tag="div" keypath="callMeBotGet" class="form-text">
<a href="https://www.callmebot.com/blog/free-api-facebook-messenger/" target="_blank">Facebook Messenger</a>
</i18n-t>
<i18n-t tag="div" keypath="callMeBotGet" class="form-text">
<a href="https://www.callmebot.com/blog/test-whatsapp-api/" target="_blank">WhatsApp</a>
</i18n-t>
<i18n-t tag="div" keypath="callMeBotGet" class="form-text">
<a href="https://www.callmebot.com/blog/telegram-phone-call-using-your-browser/" target="_blank">Telegram Call</a>
</i18n-t>
<i18n-t tag="div" keypath="callMeBotInfo" class="form-text" />
</div>
</template>
<script>
export default {
methods: {
/**
* Remove the &text= param to be able to append one later
* @returns {Promise<void>}
* @throws The provided URL is invalid
*/
cleanupEndpoint() {
try {
const url = new URL(this.$parent.notification.callMeBotEndpoint);
url.searchParams.delete("text");
this.$parent.notification.callMeBotEndpoint = url;
this.$root.toastSuccess("URL was cleaned successfully");
} catch (e) {
this.$root.toastError("Invalid URL");
}
},
}
};
</script>

@ -4,6 +4,7 @@ import AliyunSMS from "./AliyunSms.vue";
import Apprise from "./Apprise.vue";
import Bark from "./Bark.vue";
import ClickSendSMS from "./ClickSendSMS.vue";
import CallMeBot from "./CallMeBot.vue";
import SMSC from "./SMSC.vue";
import DingDing from "./DingDing.vue";
import Discord from "./Discord.vue";
@ -65,6 +66,7 @@ const NotificationFormList = {
"apprise": Apprise,
"Bark": Bark,
"clicksendsms": ClickSendSMS,
"CallMeBot": CallMeBot,
"smsc": SMSC,
"DingDing": DingDing,
"discord": Discord,

@ -918,5 +918,8 @@
"statusPageSpecialSlugDesc": "Spezieller Slug {0}: diese Seite wird angezeigt, wenn kein Slug angegeben wird",
"ntfyPriorityHelptextAllEvents": "Alle Ereignisse werden mit der höchsten Priorität gesendet",
"ntfyPriorityHelptextAllExceptDown": "Alle Ereignisse werden mit dieser Priorität gesendet, außer {0}-Ereignisse, die eine Priorität von {1} haben",
"What is a Remote Browser?": "Was ist ein Remote-Browser?"
"What is a Remote Browser?": "Was ist ein Remote-Browser?",
"callMeBotGet": "Bekomme den Endpoint für {0}.",
"callMeBotInfo": "Beachte, dass du evtl. ratenbegrenzt wirst. Beispiel: Du darfst nur einen Telegram call pro 65 sekunden versenden! Bitte benutze den Cleanup-Button, um die URL nutzen zu können.",
"callMeBotInvalidEndpoint": "The specifyed endpoint is invalid!"
}

@ -887,5 +887,8 @@
"Browser Screenshot": "Browser Screenshot",
"What is a Remote Browser?": "What is a Remote Browser?",
"wayToGetHeiiOnCallDetails": "How to get the Trigger ID and API Keys is explained in the {documentation}",
"documentationOf": "{0} Documentation"
"documentationOf": "{0} Documentation",
"callMeBotGet": "Get the endpoint for {0}.",
"callMeBotInfo": "Note that you may get rate limited. Example: You are only allowed to send one Telegram call per 65 seconds! Please use the cleanup button to be able to use the URL.",
"callMeBotInvalidEndpoint": "The specifyed endpoint is invalid!"
}

Loading…
Cancel
Save