Scheduling infrastructure for absolutely everyone.
fix: Allow passing secret for the webhooks via API (#12039)
Syed Ali Shahbazce64c494f4c1
diff --git a/apps/api/lib/validations/webhook.ts b/apps/api/lib/validations/webhook.tsindex 91d8560195d..71219d2fa04 100644--- a/apps/api/lib/validations/webhook.ts+++ b/apps/api/lib/validations/webhook.ts@@ -20,6 +20,7 @@ export const schemaWebhookCreateParams = zpayloadTemplate: z.string().optional().nullable(),eventTypeId: z.number().optional(),userId: z.number().optional(),+ secret: z.string().optional().nullable(),// API shouldn't mess with Apps webhooks yet (ie. Zapier)// appId: z.string().optional().nullable(),})@@ -31,6 +32,7 @@ export const schemaWebhookEditBodyParams = schemaWebhookBaseBodyParams.merge(z.object({eventTriggers: z.enum(WEBHOOK_TRIGGER_EVENTS).array().optional(),+ secret: z.string().optional().nullable(),})).partial()diff --git a/apps/api/pages/api/webhooks/[id]/_patch.ts b/apps/api/pages/api/webhooks/[id]/_patch.tsindex 35c2810f393..fd0f8db3f5a 100644--- a/apps/api/pages/api/webhooks/[id]/_patch.ts+++ b/apps/api/pages/api/webhooks/[id]/_patch.ts@@ -51,6 +51,9 @@ import { schemaWebhookEditBodyParams, schemaWebhookReadPublic } from "~/lib/vali* eventTypeId:* type: number* description: The event type ID if this webhook should be associated with only that event type+ * secret:+ * type: string+ * description: The secret to verify the authenticity of the received payload* tags:* - webhooks* externalDocs:diff --git a/apps/api/pages/api/webhooks/_post.ts b/apps/api/pages/api/webhooks/_post.tsindex 2a99c903e8f..8c36bcbcf65 100644--- a/apps/api/pages/api/webhooks/_post.ts+++ b/apps/api/pages/api/webhooks/_post.ts@@ -49,6 +49,9 @@ import { schemaWebhookCreateBodyParams, schemaWebhookReadPublic } from "~/lib/va* eventTypeId:* type: number* description: The event type ID if this webhook should be associated with only that event type+ * secret:+ * type: string+ * description: The secret to verify the authenticity of the received payload* tags:* - webhooks* externalDocs: