mirror of https://github.com/louislam/uptime-kuma
Added Evolution API as notification provider (#6135)
Co-authored-by: Louis Lam <louislam@users.noreply.github.com>master
parent
34e6292397
commit
023079733a
|
@ -0,0 +1,39 @@
|
|||
const NotificationProvider = require("./notification-provider");
|
||||
const axios = require("axios");
|
||||
|
||||
class Evolution extends NotificationProvider {
|
||||
name = "evolution";
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
const okMsg = "Sent Successfully.";
|
||||
|
||||
try {
|
||||
const config = {
|
||||
headers: {
|
||||
"Accept": "application/json",
|
||||
"Content-Type": "application/json",
|
||||
"apikey": notification.evolutionAuthToken,
|
||||
}
|
||||
};
|
||||
|
||||
let data = {
|
||||
"number": notification.evolutionRecipient,
|
||||
"text": msg,
|
||||
};
|
||||
|
||||
let url = (notification.evolutionApiUrl || "https://evolapicloud.com/").replace(/([^/])\/+$/, "$1") + "/message/sendText/" + encodeURIComponent(notification.evolutionInstanceName);
|
||||
|
||||
await axios.post(url, data, config);
|
||||
|
||||
return okMsg;
|
||||
} catch (error) {
|
||||
this.throwGeneralAxiosError(error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = Evolution;
|
|
@ -69,6 +69,7 @@ const ZohoCliq = require("./notification-providers/zoho-cliq");
|
|||
const SevenIO = require("./notification-providers/sevenio");
|
||||
const Whapi = require("./notification-providers/whapi");
|
||||
const WAHA = require("./notification-providers/waha");
|
||||
const Evolution = require("./notification-providers/evolution");
|
||||
const GtxMessaging = require("./notification-providers/gtx-messaging");
|
||||
const Cellsynt = require("./notification-providers/cellsynt");
|
||||
const Onesender = require("./notification-providers/onesender");
|
||||
|
@ -163,6 +164,7 @@ class Notification {
|
|||
new SevenIO(),
|
||||
new Whapi(),
|
||||
new WAHA(),
|
||||
new Evolution(),
|
||||
new GtxMessaging(),
|
||||
new Cellsynt(),
|
||||
new Wpush(),
|
||||
|
|
|
@ -165,6 +165,7 @@ export default {
|
|||
"ZohoCliq": "ZohoCliq",
|
||||
"SevenIO": "SevenIO",
|
||||
"whapi": "WhatsApp (Whapi)",
|
||||
"evolution": "WhatsApp (Evolution)",
|
||||
"waha": "WhatsApp (WAHA)",
|
||||
"gtxmessaging": "GtxMessaging",
|
||||
"Cellsynt": "Cellsynt",
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="evolution-instance-name" class="form-label">{{ $t("evolutionInstanceName") }}</label>
|
||||
<input id="evolution-instance-name" v-model="$parent.notification.evolutionInstanceName" type="text" class="form-control" required>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="evolution-api-url" class="form-label">{{ $t("API URL") }}</label>
|
||||
<input id="evolution-api-url" v-model="$parent.notification.evolutionApiUrl" placeholder="https://evoapicloud.com/" type="text" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="evolution-auth-token" class="form-label">{{ $t("Token") }}</label>
|
||||
<HiddenInput id="evolution-auth-token" v-model="$parent.notification.evolutionAuthToken" :required="true" autocomplete="new-password"></HiddenInput>
|
||||
<i18n-t tag="div" keypath="wayToGetEvolutionUrlAndToken" class="form-text">
|
||||
<a href="https://evoapicloud.com" target="_blank">https://evoapicloud.com</a>
|
||||
</i18n-t>
|
||||
</div>
|
||||
|
||||
<div class="mb-3">
|
||||
<label for="evolution-recipient" class="form-label">{{ $t("evolutionRecipient") }}</label>
|
||||
<input id="evolution-recipient" v-model="$parent.notification.evolutionRecipient" type="text" pattern="^[\d-]{10,31}(@[\w\.]{1,})?$" class="form-control" required>
|
||||
<div class="form-text">{{ $t("wayToWriteEvolutionRecipient", ["00117612345678", "00117612345678@s.whatsapp.net", "123456789012345678@g.us"]) }}</div>
|
||||
</div>
|
||||
|
||||
<i18n-t tag="div" keypath="More info on:" class="mb-3 form-text">
|
||||
<a href="https:/evoapicloud.com/" target="_blank">https://evoapicloud.com/</a>
|
||||
</i18n-t>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HiddenInput from "../HiddenInput.vue";
|
||||
|
||||
export default {
|
||||
components: {
|
||||
HiddenInput,
|
||||
}
|
||||
};
|
||||
</script>
|
|
@ -69,6 +69,7 @@ import SpugPush from "./SpugPush.vue";
|
|||
import SevenIO from "./SevenIO.vue";
|
||||
import Whapi from "./Whapi.vue";
|
||||
import WAHA from "./WAHA.vue";
|
||||
import Evolution from "./Evolution.vue";
|
||||
import Cellsynt from "./Cellsynt.vue";
|
||||
import WPush from "./WPush.vue";
|
||||
import SIGNL4 from "./SIGNL4.vue";
|
||||
|
@ -150,6 +151,7 @@ const NotificationFormList = {
|
|||
"ZohoCliq": ZohoCliq,
|
||||
"SevenIO": SevenIO,
|
||||
"whapi": Whapi,
|
||||
"evolution": Evolution,
|
||||
"notifery": Notifery,
|
||||
"waha": WAHA,
|
||||
"gtxmessaging": GtxMessaging,
|
||||
|
|
|
@ -973,6 +973,10 @@
|
|||
"wayToGetWhapiUrlAndToken": "You can get the API URL and the token by going into your desired channel from {0}",
|
||||
"whapiRecipient": "Phone Number / Contact ID / Group ID",
|
||||
"API URL": "API URL",
|
||||
"wayToWriteEvolutionRecipient": "The phone number with the international prefix, but without the plus sign at the start ({0}), the Contact ID ({1}) or the Group ID ({2}).",
|
||||
"wayToGetEvolutionUrlAndToken": "You can get the API URL and the token by going into your desired channel from {0}",
|
||||
"evolutionRecipient": "Phone Number / Contact ID / Group ID",
|
||||
"evolutionInstanceName": "Instance Name",
|
||||
"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",
|
||||
|
|
Loading…
Reference in New Issue