You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+99Lines changed: 99 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1125,6 +1125,105 @@ When you exceed the rate limits for an endpoint, you will receive a `429` status
1125
1125
|`X-RateLimit-Reset`| The amount of time in milliseconds before you can make another request to this endpoint. Pause/sleep your workflow for this duration. |
1126
1126
|`X-RateLimit-Interval`| The duration of interval in milliseconds for which this rate limit was exceeded. |
1127
1127
1128
+
## Verify webhook events
1129
+
1130
+
ImageKit sends `x-ik-signature` in the webhook request header, which can be used to verify the authenticity of the webhook request.
1131
+
1132
+
Verifing webhook signature is easy with imagekit SDK. All you need is `x-ik-signature`, rawRequestBody and secretKey. You can copy webhook secret from imagekit dashboard.
1133
+
1134
+
```js
1135
+
try {
1136
+
const {
1137
+
timestamp, // Unix timestamp in milliseconds
1138
+
event, // Parsed webhook event object
1139
+
} =imagekit.verifyWebhookEvent(
1140
+
'{"type":"video.transformation.accepted","id":"58e6d24d-6098-4319-be8d-40c3cb0a402d"...', // Raw request body encoded as Uint8Array or UTF8 string
// It is triggered when a new video transformation request is accepted for processing. You can use this for debugging purposes.
1202
+
break;
1203
+
case'video.transformation.ready':
1204
+
// 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.
1205
+
break;
1206
+
case'video.transformation.error':
1207
+
// 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].
1208
+
break;
1209
+
// ... handle other event types
1210
+
default:
1211
+
console.log(`Unhandled event type ${event.type}`);
1212
+
}
1213
+
1214
+
// Acknowledge webhook is received and processed successfully
0 commit comments