app.post('/webhook', express.json({type: 'application/json'}), (request, response) => {
const event = request.body;
case 'video.transformation.accepted':
// It is triggered when a new video transformation request is accepted for processing. You can use this for debugging purposes.
case 'video.transformation.ready':
// It is triggered when a video encoding is finished and the transformed resource is ready to be served. You should listen to this webhook and update any flag in your database or CMS against that particular asset so your application can start showing it to users.
case 'video.transformation.error':
// It is triggered if an error occurs during encoding. Listen to this webhook to log the reason. You should check your origin and URL-endpoint settings if the reason is related to download failure. If the reason seems like an error on the ImageKit side, then raise a support ticket at [email protected] // ... handle other event types
console.log(`Unhandled event type ${event.type}`);
// Return a response to acknowledge receipt of the event
response.json({received: true});