Validate hookdeck webhooks

This commit is contained in:
2025-06-02 12:05:41 +03:00
parent 0cd5c6cb69
commit 80fe63b82e
6 changed files with 31 additions and 0 deletions

View File

@@ -1,6 +1,9 @@
import { get } from "radash";
export default defineEventHandler(async (event) => {
await validateHookdeck(event);
const config = useRuntimeConfig();
const body = await readBody(event);
const aspectType = get(body, "aspect_type");
@@ -9,5 +12,8 @@ export default defineEventHandler(async (event) => {
await $fetch(`/webhooks/strava/${objectType}-${aspectType}`, {
method: "post",
body,
headers: {
"X-Hookdeck-Key": config.hookdeckKey,
},
});
});