calcom/lib/webhooks/subscriptions.tsx
Alex van Andel 5b3dd02747
Webhook tweaks + Support added for "Custom payload templates" / x-www-form-urlencoded / json (#1193)
* Changed styling of webhook test & updated <Form> component

* Implements custom webhook formats

Co-authored-by: Bailey Pumfleet <pumfleet@hey.com>
2021-11-22 11:37:07 +00:00

27 lines
555 B
TypeScript

import { WebhookTriggerEvents } from "@prisma/client";
import prisma from "@lib/prisma";
const getSubscribers = async (userId: number, triggerEvent: WebhookTriggerEvents) => {
const allWebhooks = await prisma.webhook.findMany({
where: {
userId: userId,
AND: {
eventTriggers: {
has: triggerEvent,
},
active: {
equals: true,
},
},
},
select: {
subscriberUrl: true,
payloadTemplate: true,
},
});
return allWebhooks;
};
export default getSubscribers;