Skip to main content

Handling Webhook Events

Info: This documentent primarily focuses on library authors. If you want to integrate Lancer into your application please checkout SDK & Packages page

Webhook Events

Below are the webhook events implemented in the system :

  • Session Events

  1. SESSION_CREATED : Triggered when a new upload session is created.
  2. SESSION_CANCELLED : Triggered when an upload session is cancelled.
  3. SESSION_COMPLETED : Triggered when an upload session completes.
  • File Events

  1. FILE_UPLOAD : Triggered when a file is uploaded successfully.
  2. FILE_DELETE : Triggered when a file is deleted.

Event Payload

Webhook events sends some json as payload to the listening server. The data is in this format :

{
"event" : "<event-type>", // It can be one of these (SESSION_CREATED , SESSION_CANCELLED, SESSION_COMPLETED, FILE_UPLOAD, FILE_DELETE)
"data" : {} // It is the event payload
}

Webhook Payloads

Payload for Session Events

FieldTypeDescription
idstringUnique identifier for the session.
file_sizeint64Size of the file being uploaded (in bytes).
chunk_sizeint64Size of each chunk (in bytes).
max_chunkint64Total number of chunks for the session.
file_namestringName of the file being uploaded.
temp_pathstringTemporary storage path for the session.
owner_idstringID of the user who owns the session.
current_chunkint64Current chunk being uploaded.
providerstringThe storage provider for the session.

Example JSON Payload for SESSION_CREATED:

{
"id": "session-12345",
"file_size": 10485760,
"chunk_size": 5242880,
"max_chunk": 2,
"file_name": "example.txt",
"temp_path": "/tmp/session-12345",
"owner_id": "user-67890",
"current_chunk": 0,
"provider": "LOCAL"
}

Payload for File Events

FieldTypeDescription
idstringUnique identifier for the uploaded file.
file_namestringName of the uploaded file.
file_pathstringPath where the file is stored.
file_sizeint64Size of the uploaded file (in bytes).
file_typestringMIME type of the uploaded file.
uploaded_bystringID of the user who uploaded the file.
uploaded_atstring (ISO8601)Timestamp of when the file was uploaded.
is_deletedbooleanWhether the file has been marked as deleted.
checksumstringSHA-256 checksum of the file.
descriptionstringOptional description of the file.
providerstringThe storage provider for the file.
provider_metadataobjectAdditional metadata related to the provider.

Example JSON Payload for FILE_UPLOAD:

{
"id": "file-12345",
"file_name": "example.txt",
"file_path": "/storage/files/example.txt",
"file_size": 10485760,
"file_type": "text/plain",
"uploaded_by": "user-67890",
"uploaded_at": "2025-01-22T15:30:00Z",
"is_deleted": false,
"checksum": "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890",
"description": "Sample text file",
"provider": "LOCAL",
"provider_metadata": {}
}