# Virus Detection

## Overview

Virus detection is one of the intelligence tasks in the Filestack platform. Using this mechanism, you can detect infected content in files your users upload asynchronously immediately after the file hits the storage.

This task is only available at Filestack Workflows. Read more about Workflows [here](https://www.filestack.com/docs/workflows/overview/).

## Workflows Task Configuration

Visit [Creating Workflows Tutorial](https://www.filestack.com/docs/tutorials/create-workflow/) to learn how you can use Workflows UI to configure your tasks and logic between them.

Virus detection task is available under [Intelligence](https://www.filestack.com/docs/workflows/overview/#tasks) tasks category.

### Workflows Parameters

|     |     |     |
| --- | --- | --- |
| **Task Name** | [string](https://www.filestack.com/docs/transformations/intelligence/virus-detection/#color-options) | Unique name of the task. It will be included in the webhook response and can be used to build [logic](https://www.filestack.com/docs/transformations/intelligence/virus-detection/#logic) below. |

## Logic

Virus Detection task returns following response to the workflows:

- If your file **does not contain** any virus or malware:

```json
{
"data": {
      "infected": false,
      "infections_list": []
}
}
```

- If your file **contains** any virus or malware:

```json
{
"data": {
      "infected": true,
      "infections_list": [
          "content.malicious.ait-trojan-nymeria-315"
      ]
}
}
```

### Logic Parameters

|     |     |     |
| --- | --- | --- |
| **data** | [dictionary](https://www.filestack.com/docs/transformations/intelligence/virus-detection/#color-options) | Includes the response from this service. |
| **infected** | [boolean](https://www.filestack.com/docs/transformations/intelligence/virus-detection/#color-options) | Indicates whether the file is infected or not. |
| **infections_list** | [array of strings](https://www.filestack.com/docs/transformations/intelligence/virus-detection/#color-options) | List of strings with names of any malware found in the file, if the file is not infected list will be empty. |

Based on the task’s response you can build [logic](https://www.filestack.com/docs/workflows/overview/#logic) that tells the workflow how dependent tasks should be executed. For example, if you would like to run another task if a virus was detected you can use following rule:

`infected eq true`

In Workflows UI this command would look like in the example below:

## Webhook

Below you can find an example webhook payload for a virus detection task

- no virus detected

```json
{
"workflow": "687227d2-5f84-44a0-b20b-1c29a1deb2ab",
"createdAt": "2019-01-23T03:30:55.400729934Z",
"updatedAt": "2019-01-23T03:30:57.437268735Z",
"sources": [
      "VJQTvCboRVivuJ2BDKgd"
],
"results": {
      "virus_detection_1548213592150": {
          "data": {
              "infected": false,
              "infections_list": []
          }
      }
},
"status": "Finished"
}
```

- virus detected

```json
{
"workflow": "687227d2-5f84-44a0-b20b-1c29a1deb2ab",
"createdAt": "2019-01-23T03:30:55.400729934Z",
"updatedAt": "2019-01-23T03:30:57.437268735Z",
"sources": [
      "VJQTvCboRVivuJ2BDKgd"
],
"results": {
      "virus_detection_1548213592150": {
          "data": {
              "infected": true,
              "infections_list": [
                  "content.malicious.ait-trojan-nymeria-315"
              ]
          }
      }
},
"status": "Finished"
}
```

Please visit the [webhooks](https://www.filestack.com/docs/api/webhooks/#workflow) documentation page to see full payload of the webhook.
