feat: add Open Source Deployment webhook support and related configuration

This commit is contained in:
Nawaz Dhandala
2026-02-10 14:11:03 +00:00
parent 12b78249c5
commit f9f5bff4ce
6 changed files with 38 additions and 1 deletions

View File

@@ -1,8 +1,12 @@
import OpenSourceDeployment from "../../Models/DatabaseModels/OpenSourceDeployment";
import { JSONObject } from "../../Types/JSON";
import URL from "../../Types/API/URL";
import API from "../../Utils/API";
import OpenSourceDeploymentService, {
Service as OpenSourceDeploymentServiceType,
} from "../Services/OpenSourceDeploymentService";
import { OpenSourceDeploymentWebhookUrl } from "../EnvironmentConfig";
import logger from "../Utils/Logger";
import Response from "../Utils/Response";
import {
ExpressRequest,
@@ -49,6 +53,22 @@ export default class OpenSourceDeploymentAPI extends BaseAPI<
},
});
if (OpenSourceDeploymentWebhookUrl) {
API.post({
url: URL.fromString(OpenSourceDeploymentWebhookUrl),
data: {
email: deployment.email?.toString() || "",
name: deployment.name?.toString() || "",
companyName: deployment.companyName?.toString() || "",
companyPhoneNumber: deployment.companyPhoneNumber?.toString() || "",
oneuptimeVersion: deployment.oneuptimeVersion?.toString() || "",
instanceUrl: deployment.instanceUrl?.toString() || "",
},
}).catch((err: Error) => {
logger.error(err);
});
}
return Response.sendEmptySuccessResponse(req, res);
} catch (err) {
next(err);

View File

@@ -148,6 +148,9 @@ export const EncryptionSecret: ObjectID = new ObjectID(
process.env["ENCRYPTION_SECRET"] || "secret",
);
export const OpenSourceDeploymentWebhookUrl: string =
process.env["OPEN_SOURCE_DEPLOYMENT_WEBHOOK_URL"] || "";
export const AirtableApiKey: string = process.env["AIRTABLE_API_KEY"] || "";
export const AirtableBaseId: string = process.env["AIRTABLE_BASE_ID"] || "";

View File

@@ -225,6 +225,9 @@ Usage:
value: {{ default "" $.Values.captcha.secretKey | quote }}
- name: OPEN_SOURCE_DEPLOYMENT_WEBHOOK_URL
value: {{ default "" $.Values.openSourceDeployment.webhookUrl | quote }}
- name: NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_USER
value: {{ $.Values.notifications.webhooks.slack.onCreateUser }}

View File

@@ -524,6 +524,10 @@ externalClickhouse:
cert:
key:
openSourceDeployment:
# This webhook is called when a new self-hosted open source deployment registers.
webhookUrl:
# Notification webhooks when certain events happen in the system. (usually they are slack webhooks)
notifications:
webhooks:

View File

@@ -276,9 +276,13 @@ LETS_ENCRYPT_ACCOUNT_KEY=
# This is the number of active monitors allowed in the free plan.
ALLOWED_ACTIVE_MONITOR_COUNT_IN_FREE_PLAN=10
# Open Source Deployment Webhook
# This webhook is called when a new self-hosted open source deployment registers.
OPEN_SOURCE_DEPLOYMENT_WEBHOOK_URL=
# Notifications Webhook (Slack)
# This webhook notifies slack when the new user signs up or is created.
# This webhook notifies slack when the new user signs up or is created.
NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_USER=
# This webhook notifies slack when the new project is created.
NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_PROJECT=

View File

@@ -127,6 +127,9 @@ x-common-runtime-variables: &common-runtime-variables
DISABLE_AUTOMATIC_ALERT_CREATION: ${DISABLE_AUTOMATIC_ALERT_CREATION}
# Open Source Deployment Webhook
OPEN_SOURCE_DEPLOYMENT_WEBHOOK_URL: ${OPEN_SOURCE_DEPLOYMENT_WEBHOOK_URL}
# Notification Webhooks
NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_USER: ${NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_USER}
NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_PROJECT: ${NOTIFICATION_SLACK_WEBHOOK_ON_CREATED_PROJECT}