Merge 5da89e3f56 into 9169a647cb
This commit is contained in:
commit
136ada3f3d
59
server/notification-providers/clickup.js
Normal file
59
server/notification-providers/clickup.js
Normal file
@ -0,0 +1,59 @@
|
||||
const NotificationProvider = require("./notification-provider");
|
||||
const axios = require("axios");
|
||||
const { DOWN, UP } = require("../../src/util");
|
||||
|
||||
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",
|
||||
},
|
||||
});
|
||||
|
||||
// Build the message
|
||||
let title = "Uptime Kuma Alert";
|
||||
if (monitorJSON && heartbeatJSON) {
|
||||
if (heartbeatJSON["status"] === DOWN) {
|
||||
title = `❌ ${monitorJSON["name"]} went down`;
|
||||
} else if (heartbeatJSON["status"] === UP) {
|
||||
title = `✅ ${monitorJSON["name"]} is back online`;
|
||||
}
|
||||
}
|
||||
|
||||
// Build message content
|
||||
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}`;
|
||||
}
|
||||
|
||||
// Construct the payload for Clickup Chat API
|
||||
const data = {
|
||||
text: `${title}\n${content}`,
|
||||
};
|
||||
|
||||
// Send to the specified channel
|
||||
const url = `https://api.clickup.com/api/v2/channel/${notification.clickupChannelId}/chat/message`;
|
||||
|
||||
await axios.post(url, data, config);
|
||||
return okMsg;
|
||||
} catch (error) {
|
||||
this.throwGeneralAxiosError(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = Clickup;
|
||||
@ -7,6 +7,7 @@ const Apprise = require("./notification-providers/apprise");
|
||||
const Bale = require("./notification-providers/bale");
|
||||
const Bark = require("./notification-providers/bark");
|
||||
const Bitrix24 = require("./notification-providers/bitrix24");
|
||||
const Clickup = require("./notification-providers/clickup");
|
||||
const ClickSendSMS = require("./notification-providers/clicksendsms");
|
||||
const CallMeBot = require("./notification-providers/call-me-bot");
|
||||
const SMSC = require("./notification-providers/smsc");
|
||||
@ -108,6 +109,7 @@ class Notification {
|
||||
new Bale(),
|
||||
new Bark(),
|
||||
new Bitrix24(),
|
||||
new Clickup(),
|
||||
new ClickSendSMS(),
|
||||
new CallMeBot(),
|
||||
new SMSC(),
|
||||
|
||||
@ -214,6 +214,7 @@ export default {
|
||||
let chatPlatforms = {
|
||||
bale: "Bale",
|
||||
Bitrix24: "Bitrix24",
|
||||
clickup: "Clickup",
|
||||
discord: "Discord",
|
||||
GoogleChat: "Google Chat (Google Workspace)",
|
||||
gorush: "Gorush",
|
||||
|
||||
57
src/components/notifications/Clickup.vue
Normal file
57
src/components/notifications/Clickup.vue
Normal file
@ -0,0 +1,57 @@
|
||||
<template>
|
||||
<div class="mb-3">
|
||||
<label for="clickup-token" class="form-label">
|
||||
{{ $t("Clickup API Token") }}
|
||||
<span style="color: red"><sup>*</sup></span>
|
||||
</label>
|
||||
<input
|
||||
id="clickup-token"
|
||||
v-model="$parent.notification.clickupToken"
|
||||
type="password"
|
||||
class="form-control"
|
||||
required
|
||||
autocomplete="off"
|
||||
/>
|
||||
<div class="form-text">
|
||||
{{ $t("Clickup API Token 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="false"
|
||||
/>
|
||||
<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>
|
||||
export default {
|
||||
name: "Clickup",
|
||||
};
|
||||
</script>
|
||||
@ -5,6 +5,7 @@ import Apprise from "./Apprise.vue";
|
||||
import Bale from "./Bale.vue";
|
||||
import Bark from "./Bark.vue";
|
||||
import Bitrix24 from "./Bitrix24.vue";
|
||||
import Clickup from "./Clickup.vue";
|
||||
import Notifery from "./Notifery.vue";
|
||||
import ClickSendSMS from "./ClickSendSMS.vue";
|
||||
import CallMeBot from "./CallMeBot.vue";
|
||||
@ -95,6 +96,7 @@ const NotificationFormList = {
|
||||
bale: Bale,
|
||||
Bark: Bark,
|
||||
Bitrix24: Bitrix24,
|
||||
clickup: Clickup,
|
||||
clicksendsms: ClickSendSMS,
|
||||
CallMeBot: CallMeBot,
|
||||
smsc: SMSC,
|
||||
|
||||
@ -1048,6 +1048,10 @@
|
||||
"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.",
|
||||
"Clickup API Token": "Clickup API Token",
|
||||
"Clickup API Token Description": "You can create a personal access token in Clickup by going to Settings -> Apps & Integrations -> API -> Generate token",
|
||||
"Clickup Channel ID": "Clickup Channel ID",
|
||||
"Clickup Channel ID Description": "You can find the channel ID from the channel URL or by using the Clickup API",
|
||||
"Saved.": "Saved.",
|
||||
"authUserInactiveOrDeleted": "The user is inactive or deleted.",
|
||||
"authInvalidToken": "Invalid Token.",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user