feat: webhooks config on v1

This commit is contained in:
rafaelsideguide
2024-08-30 16:22:59 -03:00
parent c8e0bb93ea
commit dc189e1e9d
2 changed files with 5 additions and 11 deletions
+3 -3
View File
@@ -2,9 +2,9 @@ import { legacyDocumentConverter } from "../../src/controllers/v1/types";
import { Logger } from "../../src/lib/logger";
import { supabase_service } from "./supabase";
export const callWebhook = async (teamId: string, jobId: string, data: any, specified?: string, v1 = false) => {
export const callWebhook = async (teamId: string, id: string, data: any, specified?: string, v1 = false) => {
try {
const selfHostedUrl = process.env.SELF_HOSTED_WEBHOOK_URL?.replace("{{JOB_ID}}", jobId);
const selfHostedUrl = process.env.SELF_HOSTED_WEBHOOK_URL?.replace("{{JOB_ID}}", id);
const useDbAuthentication = process.env.USE_DB_AUTHENTICATION === 'true';
let webhookUrl = specified ?? selfHostedUrl;
@@ -50,7 +50,7 @@ export const callWebhook = async (teamId: string, jobId: string, data: any, spec
},
body: JSON.stringify({
success: data.success,
jobId: jobId,
id: id,
data: dataToSend,
error: data.error || undefined,
}),