mirror of
https://github.com/louislam/uptime-kuma.git
synced 2026-08-07 09:14:58 +00:00
feat: Add ClickUp notification provider (#7677)
This commit is contained in:
@@ -0,0 +1,47 @@
|
|||||||
|
const NotificationProvider = require("./notification-provider");
|
||||||
|
const axios = require("axios");
|
||||||
|
|
||||||
|
class ClickUp extends NotificationProvider {
|
||||||
|
name = "ClickUp";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritdoc
|
||||||
|
*/
|
||||||
|
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||||
|
const okMsg = "Sent Successfully.";
|
||||||
|
|
||||||
|
try {
|
||||||
|
let config = this.getAxiosConfigWithProxy({
|
||||||
|
headers: {
|
||||||
|
Authorization: notification.clickupToken,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
let content = msg;
|
||||||
|
if (heartbeatJSON) {
|
||||||
|
content += `\n\n**Time (${heartbeatJSON["timezone"]}):** ${heartbeatJSON["localDateTime"]}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let address = this.extractAddress(monitorJSON);
|
||||||
|
if (address && !notification.clickupDisableUrl) {
|
||||||
|
content += `\n**Address:** ${address}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = {
|
||||||
|
type: "message",
|
||||||
|
content,
|
||||||
|
content_format: "text/md",
|
||||||
|
};
|
||||||
|
|
||||||
|
const url = `https://api.clickup.com/api/v3/workspaces/${notification.clickupWorkspaceId}/chat/channels/${notification.clickupChannelId}/messages`;
|
||||||
|
|
||||||
|
await axios.post(url, data, config);
|
||||||
|
return okMsg;
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = ClickUp;
|
||||||
@@ -8,6 +8,7 @@ const Bale = require("./notification-providers/bale");
|
|||||||
const Bark = require("./notification-providers/bark");
|
const Bark = require("./notification-providers/bark");
|
||||||
const BearSMS = require("./notification-providers/bearsms");
|
const BearSMS = require("./notification-providers/bearsms");
|
||||||
const Bitrix24 = require("./notification-providers/bitrix24");
|
const Bitrix24 = require("./notification-providers/bitrix24");
|
||||||
|
const ClickUp = require("./notification-providers/clickup");
|
||||||
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");
|
||||||
@@ -127,6 +128,7 @@ class Notification {
|
|||||||
new Bark(),
|
new Bark(),
|
||||||
new BearSMS(),
|
new BearSMS(),
|
||||||
new Bitrix24(),
|
new Bitrix24(),
|
||||||
|
new ClickUp(),
|
||||||
new ClickSendSMS(),
|
new ClickSendSMS(),
|
||||||
new CallMeBot(),
|
new CallMeBot(),
|
||||||
new SMSC(),
|
new SMSC(),
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ export default {
|
|||||||
let chatPlatforms = {
|
let chatPlatforms = {
|
||||||
bale: "Bale",
|
bale: "Bale",
|
||||||
Bitrix24: "Bitrix24",
|
Bitrix24: "Bitrix24",
|
||||||
|
ClickUp: "ClickUp",
|
||||||
discord: "Discord",
|
discord: "Discord",
|
||||||
max: this.$t("maxMessenger"),
|
max: this.$t("maxMessenger"),
|
||||||
fluxer: "Fluxer",
|
fluxer: "Fluxer",
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<template>
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="clickup-token" class="form-label">
|
||||||
|
{{ $t("ClickUp API Token") }}
|
||||||
|
<span style="color: red"><sup>*</sup></span>
|
||||||
|
</label>
|
||||||
|
<HiddenInput
|
||||||
|
id="clickup-token"
|
||||||
|
v-model="$parent.notification.clickupToken"
|
||||||
|
:required="true"
|
||||||
|
autocomplete="new-password"
|
||||||
|
></HiddenInput>
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("ClickUp API Token Description") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="clickup-workspace-id" class="form-label">
|
||||||
|
{{ $t("ClickUp Workspace ID") }}
|
||||||
|
<span style="color: red"><sup>*</sup></span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
id="clickup-workspace-id"
|
||||||
|
v-model="$parent.notification.clickupWorkspaceId"
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
required
|
||||||
|
autocomplete="off"
|
||||||
|
/>
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("ClickUp Workspace ID Description") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="clickup-channel-id" class="form-label">
|
||||||
|
{{ $t("ClickUp Channel ID") }}
|
||||||
|
<span style="color: red"><sup>*</sup></span>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
id="clickup-channel-id"
|
||||||
|
v-model="$parent.notification.clickupChannelId"
|
||||||
|
type="text"
|
||||||
|
class="form-control"
|
||||||
|
required
|
||||||
|
autocomplete="off"
|
||||||
|
/>
|
||||||
|
<div class="form-text">
|
||||||
|
{{ $t("ClickUp Channel ID Description") }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mb-3">
|
||||||
|
<div class="form-check form-switch">
|
||||||
|
<input
|
||||||
|
id="clickup-disable-url"
|
||||||
|
v-model="$parent.notification.clickupDisableUrl"
|
||||||
|
type="checkbox"
|
||||||
|
class="form-check-input"
|
||||||
|
/>
|
||||||
|
<label for="clickup-disable-url" class="form-check-label">
|
||||||
|
{{ $t("Disable URL in Notification") }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import HiddenInput from "../HiddenInput.vue";
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
HiddenInput,
|
||||||
|
},
|
||||||
|
mounted() {},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -6,6 +6,7 @@ import Bale from "./Bale.vue";
|
|||||||
import Bark from "./Bark.vue";
|
import Bark from "./Bark.vue";
|
||||||
import BearSMS from "./BearSMS.vue";
|
import BearSMS from "./BearSMS.vue";
|
||||||
import Bitrix24 from "./Bitrix24.vue";
|
import Bitrix24 from "./Bitrix24.vue";
|
||||||
|
import ClickUp from "./ClickUp.vue";
|
||||||
import Notifery from "./Notifery.vue";
|
import Notifery from "./Notifery.vue";
|
||||||
import ClickSendSMS from "./ClickSendSMS.vue";
|
import ClickSendSMS from "./ClickSendSMS.vue";
|
||||||
import CallMeBot from "./CallMeBot.vue";
|
import CallMeBot from "./CallMeBot.vue";
|
||||||
@@ -114,6 +115,7 @@ const NotificationFormList = {
|
|||||||
Bark: Bark,
|
Bark: Bark,
|
||||||
bearsms: BearSMS,
|
bearsms: BearSMS,
|
||||||
Bitrix24: Bitrix24,
|
Bitrix24: Bitrix24,
|
||||||
|
ClickUp: ClickUp,
|
||||||
clicksendsms: ClickSendSMS,
|
clicksendsms: ClickSendSMS,
|
||||||
CallMeBot: CallMeBot,
|
CallMeBot: CallMeBot,
|
||||||
smsc: SMSC,
|
smsc: SMSC,
|
||||||
|
|||||||
@@ -1152,6 +1152,12 @@
|
|||||||
"Bitrix24 Webhook URL": "Bitrix24 Webhook URL",
|
"Bitrix24 Webhook URL": "Bitrix24 Webhook URL",
|
||||||
"wayToGetBitrix24Webhook": "You can create a webhook by following the steps at {0}",
|
"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.",
|
"bitrix24SupportUserID": "Enter your user ID in Bitrix24. You can find out the ID from the link by going to the user's profile.",
|
||||||
|
"ClickUp API Token": "ClickUp API Token",
|
||||||
|
"ClickUp API Token Description": "You can create a personal access token in ClickUp by going to Settings -> Integrations & ClickApps -> ClickUp API -> API Token",
|
||||||
|
"ClickUp Workspace ID": "ClickUp Workspace ID",
|
||||||
|
"ClickUp Workspace ID Description": "You can find it in your workspace's URL, right after app.clickup.com/, e.g. app.clickup.com/12345678/home.",
|
||||||
|
"ClickUp Channel ID": "ClickUp Channel ID",
|
||||||
|
"ClickUp Channel ID Description": "You can find it in the Chat channel's URL, right after /chat/r/, e.g. .../chat/r/abc123-4567.",
|
||||||
"Saved.": "Saved.",
|
"Saved.": "Saved.",
|
||||||
"authUserInactiveOrDeleted": "The user is inactive or deleted.",
|
"authUserInactiveOrDeleted": "The user is inactive or deleted.",
|
||||||
"authInvalidToken": "Invalid Token.",
|
"authInvalidToken": "Invalid Token.",
|
||||||
|
|||||||
Reference in New Issue
Block a user