Table of Contents
You can trigger webhooks on any file storage operations (create/delete) performed via Space Cloud.
Open a project in Mission Control, head to the Event Triggers section and click on the Add button to open the form below:

Trigger Name
Give a unique name for an event trigger. (e.g., upload-profile-pic )
Source
Select File Storage as the event source.
Trigger operation
Select the file storage operation for which you want to create the event trigger. Can be one of:
Webhook URL
The HTTP(s) URL that should get triggered with the event payload on the configured operation. Must be a POST handler.
Retries
The number of times to retry a failed invocation. Default value is 3.
Timeout
Timeout in milliseconds. Default value is 5000.
The webhook is delivered over HTTP POST request to the specified webhook URL with the following headers:
Content-Type: application/jsonThe POST body of the webhook is a JSON object which follows the Cloud Events specs:
{
"specversion": "1.0-rc1",
"id": "<unique-uuid>",
"type": "<event-type>",
"source": "<space-cloud-node-id>",
"time": "<date-string>",
"data": {
"path": "<file-path>",
"meta": "Object"
}
}| Key | Type | Description |
|---|---|---|
| specversion | String | Version of the Cloud Events specifications. |
| id | String | A unique identifier of an event. |
| type | String | Event type. One of FILE_CREATE or FILE_DELETE . |
| source | String | Unique identifier of a Space Cloud instance. |
| time | String | Time at which the event occurred(ISO 8601 format). |
| data.path | String | Path of the concerned file/folder. |
| data.meta | String | meta object sent by the client while creating/deleting file. |
For example:
{
"specversion" : "1.0-rc1",
"id": "43e32d79-f2bf-41c0-be5f-a75c8c1bcfbf",
"type": "DB_INSERT",
"source": "1fb07d5d-b670-468e-ba94-ad5f06a5c053",
"time": "2019-10-19T12:40:50.053Z",
"data": {
"path": "/users/1/profile.jpg",
"meta": {
"file_size": 100,
"upload_date": "2019-10-19T12:40:50.053Z"
}
}
}Note: The
metaobject is not generated by Space Cloud. It is an optional field sent by the client as a stringified JSON in the formdata atmetakey while creating/deleting a file/folder.
A 2xx response status code from the webhook target is deemed to be a successful invocation of the webhook. Any other response status results in an unsuccessful invocation that causes retries as per the retry configuration.