packages/docs/docs/lambda/expresswebhook.mdx
Simplifies the process of setting up a Lambda Webhook in your Express.js server. See pagesRouterWebhook() and appRouterWebhook() for doing the same with Next.js apps.
The function accepts an object with six key-value pairs:
secretYour webhook secret, must be a string
testingWhether or not to allow requests intending to test the endpoint, useful while using Webhook endpoint tester on Webhooks Page. Should be a boolean.
extraHeadersAdd your own custom headers to the outgoing response. Provide key-value pairs where both the key and value are strings.
onSuccess()A function that is called with a WebhookSuccessPayload object as an argument when the incoming request indicates a successful event.
onError()A function that is called with a WebhookErrorPayload object as an argument when the incoming request indicates an error.
onTimeout()A function that is called with a WebhookTimeoutPayload object as an argument when the incoming request indicates a timeout.
Setting up a webhook endpoint in an Express.js server.
import {expressWebhook} from '@remotion/lambda/client';
const handler = expressWebhook({
secret: 'mysecret',
testing: true,
extraHeaders: {
region: "south-asia"
},
onSuccess: () => console.log('Rendering Completed Successfully'),
onError: () => console.log('Something went wrong while rendering'),
onTimeout: () => console.log('Timeout occured while rendering'),
})
router.post("/webhook", jsonParser, handler);
router.options("/webhook", jsonParser, handler);
See Webhooks for a detailed example.