Skip to content

Commit ba5614e

Browse files
committed
Document alternate interface to validateWebhook()
Fixes #261
1 parent 8d8e599 commit ba5614e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,19 @@ export async function POST(request) {
210210
}
211211
```
212212

213+
If your environment doesn't support `Request` objects, you can pass the required information to `validateWebhook` directly:
214+
215+
```js
216+
const requestData = {
217+
id: "123", // the `Webhook-Id` header
218+
timestamp: "0123456", // the `Webhook-Timestamp` header
219+
signature: "xyz", // the `Webhook-Signature` header
220+
body: "{...}", // the request body as a string, ArrayBuffer or ReadableStream
221+
secret: "shhh", // the webhook secret, obtained from the `replicate.webhooks.defaul.secret` endpoint
222+
};
223+
const webhookIsValid = await validateWebhook(requestData);
224+
```
225+
213226
## TypeScript
214227

215228
The `Replicate` constructor and all `replicate.*` methods are fully typed.

0 commit comments

Comments
 (0)