Skip to content

Commit 9f1576d

Browse files
committed
docs: harden the Hookdeck trigger API example
Send the wrapped body as JSON, accept any payload type, and require authentication on the Hookdeck source.
1 parent 3dc7440 commit 9f1576d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎docs/webhooks/providers/hookdeck.mdx‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,19 @@ You can also point a Hookdeck destination at the [trigger task API](/management/
7777
```javascript
7878
addHandler("transform", (request, context) => {
7979
request.body = { payload: request.body };
80+
request.headers["content-type"] = "application/json";
8081
return request;
8182
});
8283
```
8384

84-
3. Create a connection from your source to that destination and transformation.
85+
3. Create a connection from your source to that destination and transformation. Turn on authentication for the Hookdeck source, such as the provider's signature verification: the destination's API key only authenticates Hookdeck to Trigger.dev, so an unauthenticated source would forward anyone's requests.
8586

8687
```ts /trigger/webhook-handler.ts
8788
import { task } from "@trigger.dev/sdk";
8889

8990
export const webhookHandler = task({
9091
id: "webhook-handler",
91-
run: async (payload: Record<string, unknown>) => {
92+
run: async (payload: unknown) => {
9293
console.log("Received webhook:", payload);
9394
},
9495
});

0 commit comments

Comments
 (0)