Overview
Safe for Work (SFW) is one of the intelligence services of the Filestack platform. This feature shows you whether the uploaded file contains any unsafe content, or it is safe for your business.
Processing API
Safe for Work is available as a synchronous operation in the Processing API using the following task:
sfw
Response
If the uploaded file is safe:
{ "sfw": true }
If the uploaded file is not safe:
{ "sfw": false }
Response Parameters
sfw | Indicates whether your uploaded file is safe or not. |
Examples
Get the safety information of your uploaded file:
https://cdn.filestackcontent.com/security=p:<POLICY>,s:<SIGNATURE>/sfw/<HANDLE>
Use sfw in a chain with other tasks such as tagging:
https://cdn.filestackcontent.com/security=p:<POLICY>,s:<SIGNATURE>/tags/sfw/<HANDLE>
Use sfw with an external URL:
https://cdn.filestackcontent.com/<FILESTACK_API_KEY>/security=p:<POLICY>,s:<SIGNATURE>/sfw/<EXTERNAL_URL>
Use sfw with Storage Aliases:
https://cdn.filestackcontent.com/<FILESTACK_API_KEY>/security=p:<POLICY>,s:<SIGNATURE>/sfw/src://<STORAGE_ALIAS>/<PATH_TO_FILE>
Workflows Task Configuration
In order to learn how you can use Workflows UI to configure tasks and logic items, please visit Creating Workflows Tutorial.
Safe for Work task is available in Intelligence tasks category.
Workflows Parameters
Task Name | Unique name of the task which will be included in the webhook response and can be used to build logic below. |
Logic
Safe for Work task returns following response to the workflow:
{
"data": {
"sfw": false
}
}
or
{
"data": {
"sfw": true
}
}
Logic Parameters
data | Includes the information of safe for work task. | |
sfw | Indicates whether the file is safe for work or not. |
Considering the response from the task, you can build logic in order to make independent flows with different executing tasks. For example, if you would like to run another task if the file is not safe, you can use following rule:
sfw eq false
or
sfw neq true
In Workflows UI this command would be similar to the example below:
Visit Creating Workflows Tutorial to learn how you can use Workflows UI to configure your tasks and logic between them.
Webhook
Below you can find an example webhook payload for a safe for work task
Uploaded file is safe:
{ "id": 65374400, "action": "fs.workflow", "timestamp": 1551126123, "text": { "workflow": "c516519f-3755-4fb5-85a4-15ae4b31d475", "createdAt": "2019-02-25T20:21:53.929686708Z", "updatedAt": "2019-02-25T20:21:56.716186556Z", "sources": [ "H2swKXwhRxKFrylkjGcz" ], "results": { "sfw_1551120182170": { "data": { "sfw": true } } }, "status": "Finished" } }
Uploaded file is not safe:
{ "id": 65374401, "action": "fs.workflow", "timestamp": 1551126197, "text": { "workflow": "c516519f-3755-4fb5-85a4-15ae4b31d475", "createdAt": "2019-02-25T20:21:53.929686791Z", "updatedAt": "2019-02-25T20:21:56.716186597Z", "sources": [ "H2swKXwhRxKFrylakLwcd" ], "results": { "sfw_1551120182170": { "data": { "sfw": false } } }, "status": "Finished" } }
Please visit the webhooks documentation page to learn more.