Webhooks for Status
Reference for creating webhooks for asynchronous events.
Gumlet uses webhooks to notify your application about things that happen asynchronously, apart from the API request-response cycle. For example, you may want to update something on your end when a video asset status changes from queued
to ready
or erorred
. When these events happen, Gumlet will make a POST request to the address you give us and you can do whatever you need with it on your end.
Configure Webhook via dashboard
Webhooks can be configured here using a webhook endpoint URL, trigger, and a secret token to ensure authenticity. Once the webhook is configured for a video source or different video sources, a notification will be sent for each event for the source/s. Currently, Gumlet webhook will be triggered with following events.
Event Type | Relevance |
---|---|
video.status.created | Video Asset is created on Gumlet. |
video.status.downloaded | Video file is downloaded on Gumlet server for processing |
video.status.ready | Video is ready for streaming |
video.status.errored | Video is errored while processing |
video.status.deleted | Video Asset is deleted by the user. |
video.status.repackaged | Subtitle or Audio stream is successfully added to the video asset |
video.status.stream_ready | Video is available for streaming with single resolution, triggers immediately after video upload |
Here, the optional parameter Secret Token is used to ensure in your code that the Webhook is coming from Gumlet. If you give this parameter, you will receive it back as x-gumlet-token
inside the request header with each request.
Webhook Failure
If Gumlet doesn't receive a
2xx
response from your system, we will continue to try the message for the next 24 hours (with half an hour of delay between attempts).
If process_low_resolution_input
flag is passed as true
, and the video asset frame size is lower than the minimum supported frame size for the specified format, Gumlet will simply put your video asset into the specified format and will provide an additional warning block like below in the webhook response.
warning: {
code: 'WRN_LOW_FRAME_SIZE',
message: "Video Asset dimensions are lower than minimum supported frame size (240 pixels for HLS/DASH and 145 pixels for mp4). Any types transformation (resize, crop, pad, overlay etc.) specified would not be applied."
}
Webhook response
{
"type": "video.status.ready",
"asset_id": "5fd088e0a47da8246f1fb756",
"progress": 100,
"created_at": 1607502048309,
"status": "ready",
"tag": "Gumlet",
"input": {
"transformations": {
"resolution": [
"480p",
"540p",
"720p"
],
"format": "hls",
"audio_codec": "aac",
"video_codec": "libx264",
"thumbnail": [
"auto"
],
"thumbnail_format": "png",
"mp4_access": false
},
"metadata": {
"key1": "value1",
"key2": "value2"
}
"source_url": "https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.mp4",
"size": 15240078,
"duration": 20.32,
"aspect_ratio": "16:9",
"fps": "30000/1001",
"width": 1920,
"height": 1080
},
"output": {
"status_url": "https://api.gumlet.com/video/v1/status/5fd088e0a47da8246f1fb756",
"playback_url": "https://video.gumlet.io/5f462c1561cf8a766464ffc4/5fd088e0a47da8246f1fb756/1.m3u8",
"thumbnail_url": [
"https://video.gumlet.io/5f462c1561cf8a766464ffc4/5fd088e0a47da8246f1fb756/thumbnail-1-0.png"
],
"storage_bytes": 26683207,
"format": "hls"
}
}
Configure Webhook via API
You can also use a post request to subscribe to a webhook. The sample curl request is added here:
curl -L -X POST 'https://api.gumlet.com/v1/org/webhooks' \
-H 'Authorization: Bearer <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"url": <webhook_URL>,
"sources": [<collection_id_1>, <collection_id_2>],
"triggers": ["status"]
}'
To get the API_KEY
, follow the docs here.
Updated 4 months ago