# Functionality

Automations allow users to execute non-interactive components using external triggers or on a specific schedule.  The functionality replaces and improves on the Machine Workflow feature in Novacura Flow Classic

## Requirements

* Automations must have a [Component ](https://docs.novacura.com/flow-connect/working-with-connect/create-and-design/components)developed and deployed **without** any user interaction (User steps)
  * Components can have input and output for Webhook execution
  * Components that have Flow Script REST executions must be configured with a connector agent.
* Access Keys must be generated to execute Automation via an external system webhook.&#x20;
* Automations can only be triggered externally or scheduled when deployed to non-dev environments. (e.g: Q.A, Test, Production)

## Technical Notes

* HTTP Requests support Async, If an execution takes longer than 3 minutes, a unique callback URL with a HTTP 202 Accepted response will be returned, which has a maximum runtime of an additional 10 minutes before the execution is terminated.
* With HTTP Triggers, the Access Key must be passed as a header option `x-api-key`.
* The request body structure must match the input for the Automation Component.&#x20;
* Automations support JSON or XML requests and response formats.&#x20;
  * Use the header option `Accept` to define the required response format type.&#x20;
  * The default response format will be JSON unless you specify `application/xml` or `text/xml` for XML. `*/*` or `application/json` will force a JSON response.&#x20;
* Execution Errors are returned in the format defined below.&#x20;
  * If no execution error is returned, the returned structure will match the output variables from the component end step.

```json
//HTTP code 400 Response structure
{
    "errors": [
        {
            "code": null,
            "message": "Some Error message"
        }
    ]
}
```

* When an execution takes longer than 3 minutes, then a Async callback URL will be returned with a `202 Accepted` response code.
  * &#x20;The callback URL will require the Access Key header to check the status or retrieve the result of an ongoing execution.

```json
//HTTP 202 Response structure
{
"AutomationResultUrl": "https://**CallBackURL**"
}
```

## Access Keys

An access key is required for executing an Automation webhook to ensure security, authentication, and controlled access. The access key acts as a verification mechanism, ensuring that only trusted sources can execute the webhook.&#x20;

This helps prevent unauthorized access, protects sensitive data, and ensures that the webhook is only triggered by authenticated and approved users or external systems.

{% hint style="warning" %}
When creating Access Keys, they will only be displayed to the user once. It is important to make sure you store the access key securely.
{% endhint %}

## Scheduling

Scheduling automations are supported and can be configured with advanced CRON expressions if UX/UI options provided in the schedule configuration screen are not adequate for your business needs.

{% hint style="info" %}
The minimum allowed schedule interval is 1 minute.
{% endhint %}

#### Schedule Options

* Interval - Run every X Months, Days, Hours, Minutes
* Weekly - Run on selected days of the week (Multiple choice) from the start date/time
* Monthly - Select specific Month Days, or select On (First, Second, Third, Fourth, Last) named day of week per month.
* Advanced - Enter your own CRON expression. You can use online tools or AI Chatbots for assistance in creating your own expressions. e.g.: `*/5 * * * *` = Run every 5 minutes
