Skip to main content

Webhooks

Webhooks are web application URLs (such as https://www.example.org/my-hook) that you specify in your Settings profile for FileSpin service to provide automatic callback notification of events such as asset uploads, updates, etc.

You can save multiple webhooks in your settings profile to receive these callback notifications.

Asset Events

Webhook callbacks are issued for the following asset events:

EventDescription
file-savedWhen a file is stored in your storage after user uploads a file through File Picker or through Upload API
file-processedWhen image and video conversions are processed for a file as part of upload workflow or via Image or Video Conversion API
file-data-updatedWhen custom data is attached to a file using FileSpin.update method of File Picker or using Update File Data API
file-deletedWhen image conversions, video transcodes or the original file is deleted using Delete API
file-undeletedWhen the original file is undeleted using Undelete API
addon-processedAn addon has completed processing
Retry Behavior

Webhook callback will be attempted up to 8 times if the webhook does not respond with a HTTP 20x code (200, 201 or 202). If callback fails, re-attempts will follow a back-off algorithm that spreads calls out over an 8 hour period.

Webhook Data Format

The events and their webhook callback data format is as listed below:

EventData format
file-savedAsset Data Format
file-processedAsset Data Format
file-data-updatedAsset Data Format
file-deletedSee below
file-undeletedSee below
addon-processedAsset Data Format

On-demand image (ODI) is available for assets after they are processed the first time. Availability of ODI for an asset is indicated with the ON_DEMAND_IMAGE key in addons_info of Asset Data JSON.

"addons_info": {
"ON_DEMAND_IMAGE": {
"available": true
}
}

file-deleted and file-undeleted Events

Unlike the other events, file-deleted and file-undeleted events only provide details about the deletion/undeletion and not the complete file details.

JSON Parameters

KeyTypeDescription
idstringFile id
eventstringfile-deleted or file-undeleted
keysJSONList of keys sent in original request for deletion
statusstring"OK" if call was successful, "MAYBE" if FileSpin is uncertain (check the statusMsg in this case), "ERROR" if call could not be fully completed. If "ERROR", errors will contain details.
messagestringAdditional details about status
errorsJSONContains the keys that failed and specific error message. See sample responses below.

Successful "file-deleted" event

{
"event": "file-deleted",
"id": "d78aa1a301ef4a2fbd8fa0cffd835b79",
"keys": ["deepzoom"],
"status": "OK",
"statusMsg": ""
}

Unsuccessful "file-deleted" event

{
"event": "file-deleted",
"id": "d78aa1a301ef4a2fbd8fa0cffd835b79",
"keys": ["deepzoom"],
"status": "ERROR",
"message": "S3 Permission denied",
"errors": {
"deepzoom": "S3 Permission denied"
}
}

Successful "file-undeleted" event

{
"event": "file-undeleted",
"id": "d78aa1a301ef4a2fbd8fa0cffd835b79",
"keys": ["original"],
"status": "OK",
"message": ""
}

Unsuccessful "file-undeleted" event

{
"event": "file-undeleted",
"id": "d78aa1a301ef4a2fbd8fa0cffd835b79",
"keys": ["original"],
"status": "ERROR",
"message": "Undeletion error"
}