mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-17 18:37:16 +00:00
Add Bitrix24 Webhook notification (#3620)
Co-authored-by: Frank Elsinga <frank@elsinga.de> Co-authored-by: Matthew Nickson <mnickson@sidingsmedia.com>
This commit is contained in:
parent
168d1ca24f
commit
55b2d4b907
6 changed files with 63 additions and 0 deletions
31
server/notification-providers/bitrix24.js
Normal file
31
server/notification-providers/bitrix24.js
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
const NotificationProvider = require("./notification-provider");
|
||||||
|
const axios = require("axios");
|
||||||
|
const { UP } = require("../../src/util");
|
||||||
|
|
||||||
|
class Bitrix24 extends NotificationProvider {
|
||||||
|
name = "Bitrix24";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
|
const okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const params = {
|
||||||
|
user_id: notification.bitrix24UserID,
|
||||||
|
message: "[B]Uptime Kuma[/B]",
|
||||||
|
"ATTACH[COLOR]": (heartbeatJSON ?? {})["status"] === UP ? "#b73419" : "#67b518",
|
||||||
|
"ATTACH[BLOCKS][0][MESSAGE]": msg
|
||||||
|
};
|
||||||
|
|
||||||
|
await axios.get(`${notification.bitrix24WebhookURL}/im.notify.system.add.json`, { params });
|
||||||
|
return okMsg;
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = Bitrix24;
|
|
@ -5,6 +5,7 @@ const AlertNow = require("./notification-providers/alertnow");
|
||||||
const AliyunSms = require("./notification-providers/aliyun-sms");
|
const AliyunSms = require("./notification-providers/aliyun-sms");
|
||||||
const Apprise = require("./notification-providers/apprise");
|
const Apprise = require("./notification-providers/apprise");
|
||||||
const Bark = require("./notification-providers/bark");
|
const Bark = require("./notification-providers/bark");
|
||||||
|
const Bitrix24 = require("./notification-providers/bitrix24");
|
||||||
const ClickSendSMS = require("./notification-providers/clicksendsms");
|
const ClickSendSMS = require("./notification-providers/clicksendsms");
|
||||||
const CallMeBot = require("./notification-providers/call-me-bot");
|
const CallMeBot = require("./notification-providers/call-me-bot");
|
||||||
const SMSC = require("./notification-providers/smsc");
|
const SMSC = require("./notification-providers/smsc");
|
||||||
|
@ -83,6 +84,7 @@ class Notification {
|
||||||
new AliyunSms(),
|
new AliyunSms(),
|
||||||
new Apprise(),
|
new Apprise(),
|
||||||
new Bark(),
|
new Bark(),
|
||||||
|
new Bitrix24(),
|
||||||
new ClickSendSMS(),
|
new ClickSendSMS(),
|
||||||
new CallMeBot(),
|
new CallMeBot(),
|
||||||
new SMSC(),
|
new SMSC(),
|
||||||
|
|
|
@ -114,6 +114,7 @@ export default {
|
||||||
"AlertNow": "AlertNow",
|
"AlertNow": "AlertNow",
|
||||||
"apprise": this.$t("apprise"),
|
"apprise": this.$t("apprise"),
|
||||||
"Bark": "Bark",
|
"Bark": "Bark",
|
||||||
|
"Bitrix24": "Bitrix24",
|
||||||
"clicksendsms": "ClickSend SMS",
|
"clicksendsms": "ClickSend SMS",
|
||||||
"CallMeBot": "CallMeBot (WhatsApp, Telegram Call, Facebook Messanger)",
|
"CallMeBot": "CallMeBot (WhatsApp, Telegram Call, Facebook Messanger)",
|
||||||
"discord": "Discord",
|
"discord": "Discord",
|
||||||
|
|
24
src/components/notifications/Bitrix24.vue
Normal file
24
src/components/notifications/Bitrix24.vue
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<template>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="bitrix24-webhook-url" class="form-label">{{ $t("Bitrix24 Webhook URL") }}</label>
|
||||||
|
<HiddenInput id="bitrix24-webhook-url" v-model="$parent.notification.bitrix24WebhookURL" :required="true" autocomplete="new-password"></HiddenInput>
|
||||||
|
<i18n-t tag="div" keypath="wayToGetBitrix24Webhook" class="form-text">
|
||||||
|
<a href="https://helpdesk.bitrix24.com/open/12357038/" target="_blank">https://helpdesk.bitrix24.com/open/12357038/</a>
|
||||||
|
</i18n-t>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="bitrix24-user-id" class="form-label">{{ $t("User ID") }}</label>
|
||||||
|
<input id="bitrix24-user-id" v-model="$parent.notification.bitrix24UserID" type="text" class="form-control" required>
|
||||||
|
<div class="form-text">{{ $t("bitrix24SupportUserID") }}</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import HiddenInput from "../HiddenInput.vue";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
HiddenInput,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -3,6 +3,7 @@ import AlertNow from "./AlertNow.vue";
|
||||||
import AliyunSMS from "./AliyunSms.vue";
|
import AliyunSMS from "./AliyunSms.vue";
|
||||||
import Apprise from "./Apprise.vue";
|
import Apprise from "./Apprise.vue";
|
||||||
import Bark from "./Bark.vue";
|
import Bark from "./Bark.vue";
|
||||||
|
import Bitrix24 from "./Bitrix24.vue";
|
||||||
import ClickSendSMS from "./ClickSendSMS.vue";
|
import ClickSendSMS from "./ClickSendSMS.vue";
|
||||||
import CallMeBot from "./CallMeBot.vue";
|
import CallMeBot from "./CallMeBot.vue";
|
||||||
import SMSC from "./SMSC.vue";
|
import SMSC from "./SMSC.vue";
|
||||||
|
@ -70,6 +71,7 @@ const NotificationFormList = {
|
||||||
"AliyunSMS": AliyunSMS,
|
"AliyunSMS": AliyunSMS,
|
||||||
"apprise": Apprise,
|
"apprise": Apprise,
|
||||||
"Bark": Bark,
|
"Bark": Bark,
|
||||||
|
"Bitrix24": Bitrix24,
|
||||||
"clicksendsms": ClickSendSMS,
|
"clicksendsms": ClickSendSMS,
|
||||||
"CallMeBot": CallMeBot,
|
"CallMeBot": CallMeBot,
|
||||||
"smsc": SMSC,
|
"smsc": SMSC,
|
||||||
|
|
|
@ -873,6 +873,9 @@
|
||||||
"noOrBadCertificate": "No/Bad Certificate",
|
"noOrBadCertificate": "No/Bad Certificate",
|
||||||
"gamedigGuessPort": "Gamedig: Guess Port",
|
"gamedigGuessPort": "Gamedig: Guess Port",
|
||||||
"gamedigGuessPortDescription": "The port used by Valve Server Query Protocol may be different from the client port. Try this if the monitor cannot connect to your server.",
|
"gamedigGuessPortDescription": "The port used by Valve Server Query Protocol may be different from the client port. Try this if the monitor cannot connect to your server.",
|
||||||
|
"Bitrix24 Webhook URL": "Bitrix24 Webhook URL",
|
||||||
|
"wayToGetBitrix24Webhook": "You can create a webhook by following the steps at {0}",
|
||||||
|
"bitrix24SupportUserID": "Enter your user ID in Bitrix24. You can find out the ID from the link by going to the user's profile.",
|
||||||
"Saved.": "Saved.",
|
"Saved.": "Saved.",
|
||||||
"authUserInactiveOrDeleted": "The user is inactive or deleted.",
|
"authUserInactiveOrDeleted": "The user is inactive or deleted.",
|
||||||
"authInvalidToken": "Invalid Token.",
|
"authInvalidToken": "Invalid Token.",
|
||||||
|
|
Loading…
Reference in a new issue