diff --git a/apps/api/lib/validations/webhook.ts b/apps/api/lib/validations/webhook.ts index 91d8560195..71219d2fa0 100644 --- a/apps/api/lib/validations/webhook.ts +++ b/apps/api/lib/validations/webhook.ts @@ -20,6 +20,7 @@ export const schemaWebhookCreateParams = z payloadTemplate: 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.ts index 35c2810f39..fd0f8db3f5 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.ts index 2a99c903e8..8c36bcbcf6 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: