Webhooks
Webhooks allow your application to receive updates in real-time, rather than having to constantly poll the Editframe API for new data. This can be more efficient and cost-effective than constantly checking for updates, as it reduces the number of requests that the server you have to handle.
Configuring webhooks
To begin receiving webhooks, you must enable the feature within your application. You can enable or disable webhooks directly from the main Editframe dashboard page. Once they have been enabled, you can provide your webhook URL under the Webhooks
tab.
When submitting your webhook URL, we'll send a test request to ensure that it is valid (we're expecting a 2xx response). If the request fails, we won't send out webhooks until your URL is operational.
A webhook will now be fired off by Editframe whenver something notable happens. Let's examine what webhook requests look like.
Receiving webhooks
When your app receives a webhook request from Editframe, check the event
attribute to see what event triggered the request. The first portion of the event is the object type while the second portion is the name of the trigger.
Example webhook payload
{
"id": "X3Jq5j12GN",
"event": "video.created",
"timestamp": 1671228849,
//...
}
In the example above, a video was triggered by the created
event, and the object type is a video
.
Webhook signing
To know for sure that a webhook was, in fact, sent by Editframe instead of a malicious actor, you can verify the request signature. Each webhook request contains a header named X-Editframe-Signature
. The signature is an HMAC hash of the request payload hashed using your API token. Here is an example of how to verify the signature in your applcation:
Verifying a request
const signature = req.headers['X-Editframe-Signature']
const hash = crypto.createHmac('sha256', secret).update(payload).digest('hex')
if (hash === signature) {
// Request is verified
} else {
// Request could not be verified
}
Available events
- Name
video.created
- Type
- Description
A new video was created in Editframe.
- Name
video.encoded
- Type
- Description
A video has finished processing and can be accessed.
- Name
video.failed
- Type
- Description
A video failed to be rendered, properly.
- Name
workflow.failed
- Type
- Description
A workflow failed to process in its entirety.
- Name
workflow.processed
- Type
- Description
A workflow has finished processing and its deliverables are available.
Example payload
{
"id": "X3Jq5j12GN",
"event": "video.encoded",
"timestamp": 1671238849,
"webhook_version": 2,
"metadata": {
//...
}
}