> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # CreateAutomation # Package: automations # Namespace: AutomationsService # Method link: https://dev.wix.com/docs/api-reference/business-management/automations/automations/automations-v2/create-automation.md ## Permission Scopes: Set Up Automations: SCOPE.CRM.SETUP-AUTOMATIONS ## Introduction Creates an automation. --- ## REST API ### Schema ``` Method: createAutomation Description: Creates an automation. URL: https://www.wixapis.com/v2/automations Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: automation, automation.name, automation.origin, automation.configuration, automation.configuration.status, automation.configuration.trigger, automation.configuration.trigger.appId, automation.configuration.trigger.triggerKey, automation.configuration.rootActionIds, automation.configuration.actions Method parameters: param name: automation | type: Automation | required: true - ONE-OF: - required: true - name: applicationInfo | type: ApplicationOrigin | description: When the origin of the automation is `APPLICATION`, the details of the app that created it. - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id). You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard. - name: preinstalledInfo | type: PreinstalledOrigin | description: When the origin of the automation is `PREINSTALLED`, the details of the preinstalled automation. - name: appId | type: string | description: GUID of the app that added the [preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md). - name: templateInfo | type: TemplateOrigin | description: When the origin of the automation is `TEMPLATE`, the details of the template automation. - name: appId | type: string | description: GUID of the app that added the template automation. - name: name | type: string | description: Automation name as displayed on the user's site. | required: true - name: description | type: string | description: Automation description. - name: configuration | type: AutomationConfiguration | description: Automation configuration. | required: true - name: status | type: Status | description: Status of the automation on the site. | required: true - enum: - ACTIVE: Active. Active automations can be triggered. - INACTIVE: Inactive. Inactive automations cannot be triggered. - name: trigger | type: Trigger | description: Trigger configuration. | required: true - name: appId | type: string | description: GUID of the app that defines the trigger. | required: true - name: triggerKey | type: string | description: Trigger key. Learn about [setting up a trigger](https://dev.wix.com/docs/rest/business-management/automations/triggers/add-a-trigger-to-your-app.md#step-1--set-up-the-trigger). | required: true - name: filters | type: array | description: Schema field filters. All filter conditions must be met for the automation to run. Learn more about setting up [automation filters](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#filters). - name: id | type: string | description: Filter GUID. - name: fieldKey | type: string | description: Field key. You can find the field key in [the trigger payload schema](https://dev.wix.com/docs/rest/business-management/automations/triggers/the-trigger-payload-schema.md). - name: filterExpression | type: string | description: Filter expression in bracket notation. For the automation to run, the expression must evaluate to `true`. - name: scheduledEventOffset | type: FutureDateActivationOffset | description: Automation offset. You can schedule automations to run before the trigger occurs. Learn more about [scheduled events](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#scheduled-events). - name: preScheduledEventOffsetExpression | type: string | description: Amount of time before the trigger to run the automation. > **Note**: To delay an automation after the trigger event occurs, use a [delay action](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#delay-action). - name: scheduledEventOffsetTimeUnit | type: TimeUnit | description: Unit in which to set the action offset. - enum: - MINUTES: Minutes. - HOURS: Hours. - DAYS: Days. - WEEKS: Weeks. - MONTHS: Months. - name: rateLimit | type: RateLimit | description: Limit on the number of times an automation can be triggered. - name: maxActivationsExpression | type: string | description: Maximum number of times the trigger can be activated. - name: durationExpression | type: string | description: Duration of the rate limit. The rate limit applies for the specified duration and then expires. When empty, the rate limit does not expire. - name: durationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit. - name: uniqueIdentifierExpression | type: string | description: Activation identifier used to count the number of activations. - name: overrideSchema | type: object | description: Trigger schema override. When specified, this replaces the trigger schema. - name: rootActionIds | type: array | description: Root action GUIDs. A root action is the first action that runs after the trigger occurs. Root actions run in parallel. > **Note**: You can currently only specify 1 root action. | required: true - name: actions | type: Map | description: Actions the automation can execute, as `key:value` pairs. For the key, specify the action GUID. The value must be an object structured as described below. | required: true - ONE-OF: - name: appDefinedInfo | type: AppDefinedAction | description: Details of the action whose `type` is `APP_DEFINED`. - name: appId | type: string | description: GUID of the app that defines the action. - name: actionKey | type: string | description: Action key. - name: inputMapping | type: object | description: Action input mapping as defined in the action's [input schema](https://dev.wix.com/docs/rest/business-management/automations/actions/the-action-input-schema.md). The input mapping must include all parameters specified in the action's input schema's `required` array, and can include any other parameters from the schema. - name: postActionIds | type: array | description: IDs of actions that run in parallel after the action completes. - name: overrideOutputSchema | type: object | description: Action output schema. When specified, this replaces the action schema. - name: conditionInfo | type: ConditionAction | description: Details of the action whose `type` is `CONDITION`. - name: orExpressionGroups | type: array | description: Condition is `true` if one or more of the expression groups evaluates to `true`. - name: operator | type: Operator | description: Logical operator used to evaluate the condition expressions. - enum: - OR: `OR` operator. - AND: `AND` operator. - name: booleanExpressions | type: array | description: Expressions evaluated using the selected operator. - name: truePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `true`. - name: falsePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `false`. - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior). - name: codeConditionInfo | type: CodeConditionAction | description: Details of the action whose `type` is `CODE_CONDITION`. - name: snippet | type: CodeSnippet | description: condition code. This is a code that can be used to identify the condition in the automation. code should return a boolean value. otherwise the value will be tried to be casted to boolean. - name: language | type: Language | description: Logical operator used to evaluate the condition expressions. - enum: - JAVASCRIPT: JavaScript. - name: code | type: string | description: Expressions evaluated using the selected operator. this code should comply the language syntax. and format - name: dynamicVariableExpressions | type: array | description: dynamic variables used in the code snippet. these variables can be used inside the code using var('variableName') function. this list is mainly for validation purpose. - name: truePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `true`. - name: falsePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `false`. - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior). - name: delayInfo | type: DelayAction | description: Details of the action whose `type` is `DELAY`. - name: offsetExpression | type: string | description: Time to wait before running the action. The wait time starts from when the current action completes. > **Note**: To define the wait time from a specific moment in time, use `dueDateExpression`. - name: offsetTimeUnit | type: TimeUnit | description: Unit in which to set the wait time to wait before the action runs. - name: dueDateExpression | type: string | description: Action run date as a timestamp or DateTime expression using bracket notation. > **Note**: If an `offsetExpression` is defined, the delay is calculated from the time of the offset. - name: postActionIds | type: array | description: IDs of actions to run in parallel after the time delay. - name: rateLimitInfo | type: RateLimitAction | description: Details of the action whose `type` is `RATE_LIMIT`. - name: maxActivationsExpression | type: string | description: Maximum number of times the action can run. - name: rateLimitDurationExpression | type: string | description: Rate limit duration. When empty, the rate limit does not expire. - name: rateLimitDurationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit. - name: uniqueIdentifierExpression | type: string | description: Unique identifier of each activation by which rate limiter counts activations. - name: postActionIds | type: array | description: IDs of actions to run in parallel after the action completes. - name: id | type: string | description: Action GUID. Unique identifier for the action instance in the current automation. Use this to refer to this action in the automation flow. If not specified, automatically generated by Wix. - name: type | type: Type | description: [Action type](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#action-type). - enum: - APP_DEFINED: Defined by a [Wix app](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#app-defined-action). This action type is available in the site dashboard. - CONDITION: Condition action. Evaluates a condition to determine which action runs next. Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations. > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `conditionInfo.truePostActionIds` run and those in `conditionInfo.falsePostActionIds` are skipped. - CODE_CONDITION: Code condition action. Evaluates custom code to determine which action runs next. Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations. > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `codeConditionInfo.truePostActionIds` run and those in `codeConditionInfo.falsePostActionIds` are skipped. - DELAY: Delay. The automation must wait before executing the next step. - RATE_LIMIT: Rate-limiter. This stops the automation flow if the subsequent action has reached its maximum allowed executions. - name: displayName | type: string | description: Editable display name for the action. - name: namespace | type: string | description: [Action namespace](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#namespace). This differentiates it from other actions of the same type. If the action outputs any data, the data appears under the namespace in the payload sent to the subsequent steps in the automation. If the user has multiple actions with the same `appId` and `actionKey`, the output of the previous action is overwritten. - name: skipActionExpression | type: string | description: Evaluated to determine whether the action is skipped. When evaluated to `true`, the action is skipped. Otherwise, the action runs. When empty, the action runs. - name: origin | type: Origin | description: How the automation was added to the user's site. | required: true - enum: - USER: Created by a [Wix user](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-user). - APPLICATION: Created by a [Wix app](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-app) for a particular site. - PREINSTALLED: [Preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md). - name: settings | type: AutomationSettings | description: Automation settings. Applied only for pre-installed and application automations. Not applied to User origin automations - name: hidden | type: boolean | description: Whether the automation is hidden from users. Default: `false` - name: readonly | type: boolean | description: Whether the automation is read-only. When `true`, site owners can't modify the automation or any of its actions. When `false`, users can configure specific actions as skippable or read-only using `settings.actionSettings`. Default: `false`. > **Note**: Setting `readOnly` to `true` overrides `settings.actionSettings`. - name: disableDelete | type: boolean | description: Whether to disable the option to delete the automation from the site. Default: `false`. - name: disableStatusChange | type: boolean | description: Whether to disable the option to change the automation's `configuration.status`. Default: `false`. - name: actionSettings | type: ActionSettings | description: Automation action settings. - name: permanentActionIds | type: array | description: IDs of actions whose `skipActionExpression` can't be modified. An action's `skipActionExpression` determines whether the action is skipped. Including an action's GUID in this array makes its `skipActionExpression` permanent, so it can't be changed. When empty, the `skipActionExpression` of all actions can be edited. - name: readonlyActionIds | type: array | description: IDs of read-only actions. Read-only actions cannot be modified. When empty and the automation's `settings.readonly` is `false`, all actions are modifiable. - name: archived | type: boolean | description: Whether the automation is archived. To archive an automation, set this to `true`. To restore an archived automation, set this to `false`. - name: autoArchivePolicy | type: AutoArchivePolicy | description: Auto archive policy - name: archiveDate | type: string | description: Date when to archive the automation If this date in the past, nothing will happen (automation will not go into archived state) If this date in the future, on this date the automation will be updated with archived = true and configuration.status = INACTIVE After this date the automation may be unarchived and archived again, this date will have no influence Return type: CreateAutomationResponse - name: automation | type: Automation | description: Details of the created automation. - ONE-OF: - name: applicationInfo | type: ApplicationOrigin | description: When the origin of the automation is `APPLICATION`, the details of the app that created it. - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id). You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard. - name: preinstalledInfo | type: PreinstalledOrigin | description: When the origin of the automation is `PREINSTALLED`, the details of the preinstalled automation. - name: appId | type: string | description: GUID of the app that added the [preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md). - name: override | type: boolean | description: Whether the automation is an override. When a user modifies the preinstalled automation installed on their site, a site-specific version of the automation is created that overrides the automation that was originally installed. This override automation has the same automation GUID as the original preinstalled automation. > **Note**: An override automation can no longer be updated by the app that originally installed it. > > To revert to the original preinstalled version, the user must delete the override by calling the Delete Automation method. Calling Delete Automation on an override automation removes the override method and restores the preinstalled automation that was previously installed. Default: `false`. - name: templateInfo | type: TemplateOrigin | description: When the origin of the automation is `TEMPLATE`, the details of the template automation. - name: appId | type: string | description: GUID of the app that added the template automation. - name: id | type: string | description: Automation GUID. - name: revision | type: string | description: Revision number. This increments by 1 whenever the automation is updated. Specify the current revision number whenever updating an existing automation. - name: createdBy | type: AuditInfo | description: Who created the automation. - ONE-OF: - name: userId | type: string | description: [User GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#user-id). - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id). You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard. - name: createdDate | type: string | description: When the automation was created. - name: updatedBy | type: AuditInfo | description: Who last updated the automation. - name: updatedDate | type: string | description: When the automation was last updated. - name: name | type: string | description: Automation name as displayed on the user's site. - name: description | type: string | description: Automation description. - name: configuration | type: AutomationConfiguration | description: Automation configuration. - name: status | type: Status | description: Status of the automation on the site. - enum: - ACTIVE: Active. Active automations can be triggered. - INACTIVE: Inactive. Inactive automations cannot be triggered. - name: trigger | type: Trigger | description: Trigger configuration. - name: appId | type: string | description: GUID of the app that defines the trigger. - name: triggerKey | type: string | description: Trigger key. Learn about [setting up a trigger](https://dev.wix.com/docs/rest/business-management/automations/triggers/add-a-trigger-to-your-app.md#step-1--set-up-the-trigger). - name: filters | type: array | description: Schema field filters. All filter conditions must be met for the automation to run. Learn more about setting up [automation filters](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#filters). - name: id | type: string | description: Filter GUID. - name: fieldKey | type: string | description: Field key. You can find the field key in [the trigger payload schema](https://dev.wix.com/docs/rest/business-management/automations/triggers/the-trigger-payload-schema.md). - name: filterExpression | type: string | description: Filter expression in bracket notation. For the automation to run, the expression must evaluate to `true`. - name: scheduledEventOffset | type: FutureDateActivationOffset | description: Automation offset. You can schedule automations to run before the trigger occurs. Learn more about [scheduled events](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#scheduled-events). - name: preScheduledEventOffsetExpression | type: string | description: Amount of time before the trigger to run the automation. > **Note**: To delay an automation after the trigger event occurs, use a [delay action](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#delay-action). - name: scheduledEventOffsetTimeUnit | type: TimeUnit | description: Unit in which to set the action offset. - enum: - MINUTES: Minutes. - HOURS: Hours. - DAYS: Days. - WEEKS: Weeks. - MONTHS: Months. - name: rateLimit | type: RateLimit | description: Limit on the number of times an automation can be triggered. - name: maxActivationsExpression | type: string | description: Maximum number of times the trigger can be activated. - name: durationExpression | type: string | description: Duration of the rate limit. The rate limit applies for the specified duration and then expires. When empty, the rate limit does not expire. - name: durationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit. - name: uniqueIdentifierExpression | type: string | description: Activation identifier used to count the number of activations. - name: overrideSchema | type: object | description: Trigger schema override. When specified, this replaces the trigger schema. - name: rootActionIds | type: array | description: Root action GUIDs. A root action is the first action that runs after the trigger occurs. Root actions run in parallel. > **Note**: You can currently only specify 1 root action. - name: actions | type: Map | description: Actions the automation can execute, as `key:value` pairs. For the key, specify the action GUID. The value must be an object structured as described below. - ONE-OF: - name: appDefinedInfo | type: AppDefinedAction | description: Details of the action whose `type` is `APP_DEFINED`. - name: appId | type: string | description: GUID of the app that defines the action. - name: actionKey | type: string | description: Action key. - name: inputMapping | type: object | description: Action input mapping as defined in the action's [input schema](https://dev.wix.com/docs/rest/business-management/automations/actions/the-action-input-schema.md). The input mapping must include all parameters specified in the action's input schema's `required` array, and can include any other parameters from the schema. - name: postActionIds | type: array | description: IDs of actions that run in parallel after the action completes. - name: overrideOutputSchema | type: object | description: Action output schema. When specified, this replaces the action schema. - name: conditionInfo | type: ConditionAction | description: Details of the action whose `type` is `CONDITION`. - name: orExpressionGroups | type: array | description: Condition is `true` if one or more of the expression groups evaluates to `true`. - name: operator | type: Operator | description: Logical operator used to evaluate the condition expressions. - enum: - OR: `OR` operator. - AND: `AND` operator. - name: booleanExpressions | type: array | description: Expressions evaluated using the selected operator. - name: truePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `true`. - name: falsePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `false`. - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior). - name: codeConditionInfo | type: CodeConditionAction | description: Details of the action whose `type` is `CODE_CONDITION`. - name: snippet | type: CodeSnippet | description: condition code. This is a code that can be used to identify the condition in the automation. code should return a boolean value. otherwise the value will be tried to be casted to boolean. - name: language | type: Language | description: Logical operator used to evaluate the condition expressions. - enum: - JAVASCRIPT: JavaScript. - name: code | type: string | description: Expressions evaluated using the selected operator. this code should comply the language syntax. and format - name: dynamicVariableExpressions | type: array | description: dynamic variables used in the code snippet. these variables can be used inside the code using var('variableName') function. this list is mainly for validation purpose. - name: truePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `true`. - name: falsePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `false`. - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior). - name: delayInfo | type: DelayAction | description: Details of the action whose `type` is `DELAY`. - name: offsetExpression | type: string | description: Time to wait before running the action. The wait time starts from when the current action completes. > **Note**: To define the wait time from a specific moment in time, use `dueDateExpression`. - name: offsetTimeUnit | type: TimeUnit | description: Unit in which to set the wait time to wait before the action runs. - name: dueDateExpression | type: string | description: Action run date as a timestamp or DateTime expression using bracket notation. > **Note**: If an `offsetExpression` is defined, the delay is calculated from the time of the offset. - name: postActionIds | type: array | description: IDs of actions to run in parallel after the time delay. - name: rateLimitInfo | type: RateLimitAction | description: Details of the action whose `type` is `RATE_LIMIT`. - name: maxActivationsExpression | type: string | description: Maximum number of times the action can run. - name: rateLimitDurationExpression | type: string | description: Rate limit duration. When empty, the rate limit does not expire. - name: rateLimitDurationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit. - name: uniqueIdentifierExpression | type: string | description: Unique identifier of each activation by which rate limiter counts activations. - name: postActionIds | type: array | description: IDs of actions to run in parallel after the action completes. - name: id | type: string | description: Action GUID. Unique identifier for the action instance in the current automation. Use this to refer to this action in the automation flow. If not specified, automatically generated by Wix. - name: type | type: Type | description: [Action type](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#action-type). - enum: - APP_DEFINED: Defined by a [Wix app](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#app-defined-action). This action type is available in the site dashboard. - CONDITION: Condition action. Evaluates a condition to determine which action runs next. Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations. > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `conditionInfo.truePostActionIds` run and those in `conditionInfo.falsePostActionIds` are skipped. - CODE_CONDITION: Code condition action. Evaluates custom code to determine which action runs next. Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations. > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `codeConditionInfo.truePostActionIds` run and those in `codeConditionInfo.falsePostActionIds` are skipped. - DELAY: Delay. The automation must wait before executing the next step. - RATE_LIMIT: Rate-limiter. This stops the automation flow if the subsequent action has reached its maximum allowed executions. - name: displayName | type: string | description: Editable display name for the action. - name: namespace | type: string | description: [Action namespace](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#namespace). This differentiates it from other actions of the same type. If the action outputs any data, the data appears under the namespace in the payload sent to the subsequent steps in the automation. If the user has multiple actions with the same `appId` and `actionKey`, the output of the previous action is overwritten. - name: skipActionExpression | type: string | description: Evaluated to determine whether the action is skipped. When evaluated to `true`, the action is skipped. Otherwise, the action runs. When empty, the action runs. - name: origin | type: Origin | description: How the automation was added to the user's site. - enum: - USER: Created by a [Wix user](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-user). - APPLICATION: Created by a [Wix app](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-app) for a particular site. - PREINSTALLED: [Preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md). - name: settings | type: AutomationSettings | description: Automation settings. Applied only for pre-installed and application automations. Not applied to User origin automations - name: hidden | type: boolean | description: Whether the automation is hidden from users. Default: `false` - name: readonly | type: boolean | description: Whether the automation is read-only. When `true`, site owners can't modify the automation or any of its actions. When `false`, users can configure specific actions as skippable or read-only using `settings.actionSettings`. Default: `false`. > **Note**: Setting `readOnly` to `true` overrides `settings.actionSettings`. - name: disableDelete | type: boolean | description: Whether to disable the option to delete the automation from the site. Default: `false`. - name: disableStatusChange | type: boolean | description: Whether to disable the option to change the automation's `configuration.status`. Default: `false`. - name: actionSettings | type: ActionSettings | description: Automation action settings. - name: permanentActionIds | type: array | description: IDs of actions whose `skipActionExpression` can't be modified. An action's `skipActionExpression` determines whether the action is skipped. Including an action's GUID in this array makes its `skipActionExpression` permanent, so it can't be changed. When empty, the `skipActionExpression` of all actions can be edited. - name: readonlyActionIds | type: array | description: IDs of read-only actions. Read-only actions cannot be modified. When empty and the automation's `settings.readonly` is `false`, all actions are modifiable. - name: draftInfo | type: DraftInfo | description: When the automation is a draft, the draft details. - name: originalAutomationId | type: string | description: GUID of the original automation. - name: archived | type: boolean | description: Whether the automation is archived. To archive an automation, set this to `true`. To restore an archived automation, set this to `false`. - name: autoArchivePolicy | type: AutoArchivePolicy | description: Auto archive policy - name: archiveDate | type: string | description: Date when to archive the automation If this date in the past, nothing will happen (automation will not go into archived state) If this date in the future, on this date the automation will be updated with archived = true and configuration.status = INACTIVE After this date the automation may be unarchived and archived again, this date will have no influence ``` ### Examples ### Create automation ```curl curl -X POST 'https://manage.wix.com/automations-service/v2/automations' \ -H 'authorization: ' \ -d '{ "automation": { "configuration": { "rootActionIds": [ "e1b2f243-73a8-44d0-8d4a-9da62e7aed6e" ], "actions": { "e1b2f243-73a8-44d0-8d4a-9da62e7aed6e": { "id": "e1b2f243-73a8-44d0-8d4a-9da62e7aed6e", "delayInfo": { "offsetExpression": "{{1}}", "offsetTimeUnit": "DAYS", "postActionIds": [ "f59b713e-6b4e-48cb-8c8f-d87fccd4a2e9" ] }, "type": "DELAY", "namespace": "DELAY-1" }, "f59b713e-6b4e-48cb-8c8f-d87fccd4a2e9": { "id": "f59b713e-6b4e-48cb-8c8f-d87fccd4a2e9", "type": "APP_DEFINED", "appDefinedInfo": { "actionKey": "send-email", "appId": "0217a814-bf20-4c08-9da9-e14545da7e2f", "postActionIds": [], "skipConditionOrExpressionGroups": [], "inputMapping": { "contactId": "{{var(\"contactId\")}}", "messageId": "8f68b403-5a0f-43ff-ba98-15d3125a3f1e" } }, "namespace": "triggered-emails-2" } }, "trigger": { "triggerKey": "wix_form_app-form_submitted", "appId": "225dd912-7dea-4738-8688-4b8c6955ffc2", "filters": [] }, "status": "ACTIVE" }, "origin": "USER", "name": "Send reminder email" } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.automations.AutomationsService.createAutomation(automation) Description: Creates an automation. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: automation, automation.name, automation.origin, automation.configuration, automation.configuration.status, automation.configuration.trigger, automation.configuration.trigger.appId, automation.configuration.trigger.triggerKey, automation.configuration.rootActionIds, automation.configuration.actions Method parameters: param name: automation | type: Automation | required: true - ONE-OF: - required: true - name: applicationInfo | type: ApplicationOrigin | description: When the origin of the automation is `APPLICATION`, the details of the app that created it. - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id). You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard. - name: preinstalledInfo | type: PreinstalledOrigin | description: When the origin of the automation is `PREINSTALLED`, the details of the preinstalled automation. - name: appId | type: string | description: GUID of the app that added the [preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md). - name: templateInfo | type: TemplateOrigin | description: When the origin of the automation is `TEMPLATE`, the details of the template automation. - name: appId | type: string | description: GUID of the app that added the template automation. - name: name | type: string | description: Automation name as displayed on the user's site. | required: true - name: description | type: string | description: Automation description. - name: configuration | type: AutomationConfiguration | description: Automation configuration. | required: true - name: status | type: Status | description: Status of the automation on the site. | required: true - enum: - ACTIVE: Active. Active automations can be triggered. - INACTIVE: Inactive. Inactive automations cannot be triggered. - name: trigger | type: Trigger | description: Trigger configuration. | required: true - name: appId | type: string | description: GUID of the app that defines the trigger. | required: true - name: triggerKey | type: string | description: Trigger key. Learn about [setting up a trigger](https://dev.wix.com/docs/rest/business-management/automations/triggers/add-a-trigger-to-your-app.md#step-1--set-up-the-trigger). | required: true - name: filters | type: array | description: Schema field filters. All filter conditions must be met for the automation to run. Learn more about setting up [automation filters](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#filters). - name: _id | type: string | description: Filter GUID. - name: fieldKey | type: string | description: Field key. You can find the field key in [the trigger payload schema](https://dev.wix.com/docs/rest/business-management/automations/triggers/the-trigger-payload-schema.md). - name: filterExpression | type: string | description: Filter expression in bracket notation. For the automation to run, the expression must evaluate to `true`. - name: scheduledEventOffset | type: FutureDateActivationOffset | description: Automation offset. You can schedule automations to run before the trigger occurs. Learn more about [scheduled events](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#scheduled-events). - name: preScheduledEventOffsetExpression | type: string | description: Amount of time before the trigger to run the automation. > **Note**: To delay an automation after the trigger event occurs, use a [delay action](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#delay-action). - name: scheduledEventOffsetTimeUnit | type: TimeUnit | description: Unit in which to set the action offset. - enum: - MINUTES: Minutes. - HOURS: Hours. - DAYS: Days. - WEEKS: Weeks. - MONTHS: Months. - name: rateLimit | type: RateLimit | description: Limit on the number of times an automation can be triggered. - name: maxActivationsExpression | type: string | description: Maximum number of times the trigger can be activated. - name: durationExpression | type: string | description: Duration of the rate limit. The rate limit applies for the specified duration and then expires. When empty, the rate limit does not expire. - name: durationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit. - name: uniqueIdentifierExpression | type: string | description: Activation identifier used to count the number of activations. - name: overrideSchema | type: object | description: Trigger schema override. When specified, this replaces the trigger schema. - name: rootActionIds | type: array | description: Root action GUIDs. A root action is the first action that runs after the trigger occurs. Root actions run in parallel. > **Note**: You can currently only specify 1 root action. | required: true - name: actions | type: Map | description: Actions the automation can execute, as `key:value` pairs. For the key, specify the action GUID. The value must be an object structured as described below. | required: true - ONE-OF: - name: appDefinedInfo | type: AppDefinedAction | description: Details of the action whose `type` is `APP_DEFINED`. - name: appId | type: string | description: GUID of the app that defines the action. - name: actionKey | type: string | description: Action key. - name: inputMapping | type: object | description: Action input mapping as defined in the action's [input schema](https://dev.wix.com/docs/rest/business-management/automations/actions/the-action-input-schema.md). The input mapping must include all parameters specified in the action's input schema's `required` array, and can include any other parameters from the schema. - name: postActionIds | type: array | description: IDs of actions that run in parallel after the action completes. - name: overrideOutputSchema | type: object | description: Action output schema. When specified, this replaces the action schema. - name: conditionInfo | type: ConditionAction | description: Details of the action whose `type` is `CONDITION`. - name: orExpressionGroups | type: array | description: Condition is `true` if one or more of the expression groups evaluates to `true`. - name: operator | type: Operator | description: Logical operator used to evaluate the condition expressions. - enum: - OR: `OR` operator. - AND: `AND` operator. - name: booleanExpressions | type: array | description: Expressions evaluated using the selected operator. - name: truePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `true`. - name: falsePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `false`. - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior). - name: codeConditionInfo | type: CodeConditionAction | description: Details of the action whose `type` is `CODE_CONDITION`. - name: snippet | type: CodeSnippet | description: condition code. This is a code that can be used to identify the condition in the automation. code should return a boolean value. otherwise the value will be tried to be casted to boolean. - name: language | type: Language | description: Logical operator used to evaluate the condition expressions. - enum: - JAVASCRIPT: JavaScript. - name: code | type: string | description: Expressions evaluated using the selected operator. this code should comply the language syntax. and format - name: dynamicVariableExpressions | type: array | description: dynamic variables used in the code snippet. these variables can be used inside the code using var('variableName') function. this list is mainly for validation purpose. - name: truePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `true`. - name: falsePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `false`. - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior). - name: delayInfo | type: DelayAction | description: Details of the action whose `type` is `DELAY`. - name: offsetExpression | type: string | description: Time to wait before running the action. The wait time starts from when the current action completes. > **Note**: To define the wait time from a specific moment in time, use `dueDateExpression`. - name: offsetTimeUnit | type: TimeUnit | description: Unit in which to set the wait time to wait before the action runs. - name: dueDateExpression | type: string | description: Action run date as a timestamp or DateTime expression using bracket notation. > **Note**: If an `offsetExpression` is defined, the delay is calculated from the time of the offset. - name: postActionIds | type: array | description: IDs of actions to run in parallel after the time delay. - name: rateLimitInfo | type: RateLimitAction | description: Details of the action whose `type` is `RATE_LIMIT`. - name: maxActivationsExpression | type: string | description: Maximum number of times the action can run. - name: rateLimitDurationExpression | type: string | description: Rate limit duration. When empty, the rate limit does not expire. - name: rateLimitDurationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit. - name: uniqueIdentifierExpression | type: string | description: Unique identifier of each activation by which rate limiter counts activations. - name: postActionIds | type: array | description: IDs of actions to run in parallel after the action completes. - name: _id | type: string | description: Action GUID. Unique identifier for the action instance in the current automation. Use this to refer to this action in the automation flow. If not specified, automatically generated by Wix. - name: type | type: Type | description: [Action type](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#action-type). - enum: - APP_DEFINED: Defined by a [Wix app](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#app-defined-action). This action type is available in the site dashboard. - CONDITION: Condition action. Evaluates a condition to determine which action runs next. Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations. > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `conditionInfo.truePostActionIds` run and those in `conditionInfo.falsePostActionIds` are skipped. - CODE_CONDITION: Code condition action. Evaluates custom code to determine which action runs next. Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations. > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `codeConditionInfo.truePostActionIds` run and those in `codeConditionInfo.falsePostActionIds` are skipped. - DELAY: Delay. The automation must wait before executing the next step. - RATE_LIMIT: Rate-limiter. This stops the automation flow if the subsequent action has reached its maximum allowed executions. - name: displayName | type: string | description: Editable display name for the action. - name: namespace | type: string | description: [Action namespace](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#namespace). This differentiates it from other actions of the same type. If the action outputs any data, the data appears under the namespace in the payload sent to the subsequent steps in the automation. If the user has multiple actions with the same `appId` and `actionKey`, the output of the previous action is overwritten. - name: skipActionExpression | type: string | description: Evaluated to determine whether the action is skipped. When evaluated to `true`, the action is skipped. Otherwise, the action runs. When empty, the action runs. - name: origin | type: Origin | description: How the automation was added to the user's site. | required: true - enum: - USER: Created by a [Wix user](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-user). - APPLICATION: Created by a [Wix app](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-app) for a particular site. - PREINSTALLED: [Preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md). - name: settings | type: AutomationSettings | description: Automation settings. Applied only for pre-installed and application automations. Not applied to User origin automations - name: hidden | type: boolean | description: Whether the automation is hidden from users. Default: `false` - name: readonly | type: boolean | description: Whether the automation is read-only. When `true`, site owners can't modify the automation or any of its actions. When `false`, users can configure specific actions as skippable or read-only using `settings.actionSettings`. Default: `false`. > **Note**: Setting `readOnly` to `true` overrides `settings.actionSettings`. - name: disableDelete | type: boolean | description: Whether to disable the option to delete the automation from the site. Default: `false`. - name: disableStatusChange | type: boolean | description: Whether to disable the option to change the automation's `configuration.status`. Default: `false`. - name: actionSettings | type: ActionSettings | description: Automation action settings. - name: permanentActionIds | type: array | description: IDs of actions whose `skipActionExpression` can't be modified. An action's `skipActionExpression` determines whether the action is skipped. Including an action's GUID in this array makes its `skipActionExpression` permanent, so it can't be changed. When empty, the `skipActionExpression` of all actions can be edited. - name: readonlyActionIds | type: array | description: IDs of read-only actions. Read-only actions cannot be modified. When empty and the automation's `settings.readonly` is `false`, all actions are modifiable. - name: archived | type: boolean | description: Whether the automation is archived. To archive an automation, set this to `true`. To restore an archived automation, set this to `false`. - name: autoArchivePolicy | type: AutoArchivePolicy | description: Auto archive policy - name: archiveDate | type: Date | description: Date when to archive the automation If this date in the past, nothing will happen (automation will not go into archived state) If this date in the future, on this date the automation will be updated with archived = true and configuration.status = INACTIVE After this date the automation may be unarchived and archived again, this date will have no influence Return type: PROMISE - ONE-OF: - name: applicationInfo | type: ApplicationOrigin | description: When the origin of the automation is `APPLICATION`, the details of the app that created it. - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id). You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard. - name: preinstalledInfo | type: PreinstalledOrigin | description: When the origin of the automation is `PREINSTALLED`, the details of the preinstalled automation. - name: appId | type: string | description: GUID of the app that added the [preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md). - name: override | type: boolean | description: Whether the automation is an override. When a user modifies the preinstalled automation installed on their site, a site-specific version of the automation is created that overrides the automation that was originally installed. This override automation has the same automation GUID as the original preinstalled automation. > **Note**: An override automation can no longer be updated by the app that originally installed it. > > To revert to the original preinstalled version, the user must delete the override by calling the Delete Automation method. Calling Delete Automation on an override automation removes the override method and restores the preinstalled automation that was previously installed. Default: `false`. - name: templateInfo | type: TemplateOrigin | description: When the origin of the automation is `TEMPLATE`, the details of the template automation. - name: appId | type: string | description: GUID of the app that added the template automation. - name: _id | type: string | description: Automation GUID. - name: revision | type: string | description: Revision number. This increments by 1 whenever the automation is updated. Specify the current revision number whenever updating an existing automation. - name: createdBy | type: AuditInfo | description: Who created the automation. - ONE-OF: - name: userId | type: string | description: [User GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#user-id). - name: appId | type: string | description: [App GUID](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#app-id). You can find the app GUID on the [Home page](https://manage.wix.com/app-selector?title=Select+an+App&primaryButtonText=Select+Site&actionUrl=https%3A%2F%2Fdev.wix.com%2Fapps%2F%7BappId%7D%home) in the app's dashboard. - name: _createdDate | type: Date | description: When the automation was created. - name: updatedBy | type: AuditInfo | description: Who last updated the automation. - name: _updatedDate | type: Date | description: When the automation was last updated. - name: name | type: string | description: Automation name as displayed on the user's site. - name: description | type: string | description: Automation description. - name: configuration | type: AutomationConfiguration | description: Automation configuration. - name: status | type: Status | description: Status of the automation on the site. - enum: - ACTIVE: Active. Active automations can be triggered. - INACTIVE: Inactive. Inactive automations cannot be triggered. - name: trigger | type: Trigger | description: Trigger configuration. - name: appId | type: string | description: GUID of the app that defines the trigger. - name: triggerKey | type: string | description: Trigger key. Learn about [setting up a trigger](https://dev.wix.com/docs/rest/business-management/automations/triggers/add-a-trigger-to-your-app.md#step-1--set-up-the-trigger). - name: filters | type: array | description: Schema field filters. All filter conditions must be met for the automation to run. Learn more about setting up [automation filters](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#filters). - name: _id | type: string | description: Filter GUID. - name: fieldKey | type: string | description: Field key. You can find the field key in [the trigger payload schema](https://dev.wix.com/docs/rest/business-management/automations/triggers/the-trigger-payload-schema.md). - name: filterExpression | type: string | description: Filter expression in bracket notation. For the automation to run, the expression must evaluate to `true`. - name: scheduledEventOffset | type: FutureDateActivationOffset | description: Automation offset. You can schedule automations to run before the trigger occurs. Learn more about [scheduled events](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#scheduled-events). - name: preScheduledEventOffsetExpression | type: string | description: Amount of time before the trigger to run the automation. > **Note**: To delay an automation after the trigger event occurs, use a [delay action](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#delay-action). - name: scheduledEventOffsetTimeUnit | type: TimeUnit | description: Unit in which to set the action offset. - enum: - MINUTES: Minutes. - HOURS: Hours. - DAYS: Days. - WEEKS: Weeks. - MONTHS: Months. - name: rateLimit | type: RateLimit | description: Limit on the number of times an automation can be triggered. - name: maxActivationsExpression | type: string | description: Maximum number of times the trigger can be activated. - name: durationExpression | type: string | description: Duration of the rate limit. The rate limit applies for the specified duration and then expires. When empty, the rate limit does not expire. - name: durationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit. - name: uniqueIdentifierExpression | type: string | description: Activation identifier used to count the number of activations. - name: overrideSchema | type: object | description: Trigger schema override. When specified, this replaces the trigger schema. - name: rootActionIds | type: array | description: Root action GUIDs. A root action is the first action that runs after the trigger occurs. Root actions run in parallel. > **Note**: You can currently only specify 1 root action. - name: actions | type: Map | description: Actions the automation can execute, as `key:value` pairs. For the key, specify the action GUID. The value must be an object structured as described below. - ONE-OF: - name: appDefinedInfo | type: AppDefinedAction | description: Details of the action whose `type` is `APP_DEFINED`. - name: appId | type: string | description: GUID of the app that defines the action. - name: actionKey | type: string | description: Action key. - name: inputMapping | type: object | description: Action input mapping as defined in the action's [input schema](https://dev.wix.com/docs/rest/business-management/automations/actions/the-action-input-schema.md). The input mapping must include all parameters specified in the action's input schema's `required` array, and can include any other parameters from the schema. - name: postActionIds | type: array | description: IDs of actions that run in parallel after the action completes. - name: overrideOutputSchema | type: object | description: Action output schema. When specified, this replaces the action schema. - name: conditionInfo | type: ConditionAction | description: Details of the action whose `type` is `CONDITION`. - name: orExpressionGroups | type: array | description: Condition is `true` if one or more of the expression groups evaluates to `true`. - name: operator | type: Operator | description: Logical operator used to evaluate the condition expressions. - enum: - OR: `OR` operator. - AND: `AND` operator. - name: booleanExpressions | type: array | description: Expressions evaluated using the selected operator. - name: truePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `true`. - name: falsePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `false`. - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior). - name: codeConditionInfo | type: CodeConditionAction | description: Details of the action whose `type` is `CODE_CONDITION`. - name: snippet | type: CodeSnippet | description: condition code. This is a code that can be used to identify the condition in the automation. code should return a boolean value. otherwise the value will be tried to be casted to boolean. - name: language | type: Language | description: Logical operator used to evaluate the condition expressions. - enum: - JAVASCRIPT: JavaScript. - name: code | type: string | description: Expressions evaluated using the selected operator. this code should comply the language syntax. and format - name: dynamicVariableExpressions | type: array | description: dynamic variables used in the code snippet. these variables can be used inside the code using var('variableName') function. this list is mainly for validation purpose. - name: truePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `true`. - name: falsePostActionIds | type: array | description: IDs of actions to run when the condition evaluates to `false`. - name: mergeActionId | type: string | description: GUID of the MERGE action for this condition. When absent, branches run independently (current behavior). - name: delayInfo | type: DelayAction | description: Details of the action whose `type` is `DELAY`. - name: offsetExpression | type: string | description: Time to wait before running the action. The wait time starts from when the current action completes. > **Note**: To define the wait time from a specific moment in time, use `dueDateExpression`. - name: offsetTimeUnit | type: TimeUnit | description: Unit in which to set the wait time to wait before the action runs. - name: dueDateExpression | type: string | description: Action run date as a timestamp or DateTime expression using bracket notation. > **Note**: If an `offsetExpression` is defined, the delay is calculated from the time of the offset. - name: postActionIds | type: array | description: IDs of actions to run in parallel after the time delay. - name: rateLimitInfo | type: RateLimitAction | description: Details of the action whose `type` is `RATE_LIMIT`. - name: maxActivationsExpression | type: string | description: Maximum number of times the action can run. - name: rateLimitDurationExpression | type: string | description: Rate limit duration. When empty, the rate limit does not expire. - name: rateLimitDurationTimeUnit | type: TimeUnit | description: Unit in which to set the duration of the rate limit. - name: uniqueIdentifierExpression | type: string | description: Unique identifier of each activation by which rate limiter counts activations. - name: postActionIds | type: array | description: IDs of actions to run in parallel after the action completes. - name: _id | type: string | description: Action GUID. Unique identifier for the action instance in the current automation. Use this to refer to this action in the automation flow. If not specified, automatically generated by Wix. - name: type | type: Type | description: [Action type](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#action-type). - enum: - APP_DEFINED: Defined by a [Wix app](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#app-defined-action). This action type is available in the site dashboard. - CONDITION: Condition action. Evaluates a condition to determine which action runs next. Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations. > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `conditionInfo.truePostActionIds` run and those in `conditionInfo.falsePostActionIds` are skipped. - CODE_CONDITION: Code condition action. Evaluates custom code to determine which action runs next. Learn more about [adding and setting up conditions](https://support.wix.com/en/article/the-new-automation-builder-understanding-conditions-operators) in Wix Automations. > **Note**: When `skipActionExpression` evaluates to `true`, the actions in `codeConditionInfo.truePostActionIds` run and those in `codeConditionInfo.falsePostActionIds` are skipped. - DELAY: Delay. The automation must wait before executing the next step. - RATE_LIMIT: Rate-limiter. This stops the automation flow if the subsequent action has reached its maximum allowed executions. - name: displayName | type: string | description: Editable display name for the action. - name: namespace | type: string | description: [Action namespace](https://dev.wix.com/docs/rest/business-management/automations/automations/automations-v2/configure-your-automation.md#namespace). This differentiates it from other actions of the same type. If the action outputs any data, the data appears under the namespace in the payload sent to the subsequent steps in the automation. If the user has multiple actions with the same `appId` and `actionKey`, the output of the previous action is overwritten. - name: skipActionExpression | type: string | description: Evaluated to determine whether the action is skipped. When evaluated to `true`, the action is skipped. Otherwise, the action runs. When empty, the action runs. - name: origin | type: Origin | description: How the automation was added to the user's site. - enum: - USER: Created by a [Wix user](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-user). - APPLICATION: Created by a [Wix app](https://dev.wix.com/docs/build-apps/get-started/overview/glossary.md#wix-app) for a particular site. - PREINSTALLED: [Preinstalled automation](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/backend-extensions/automations/pre-installed-automations/about-pre-installed-automations.md). - name: settings | type: AutomationSettings | description: Automation settings. Applied only for pre-installed and application automations. Not applied to User origin automations - name: hidden | type: boolean | description: Whether the automation is hidden from users. Default: `false` - name: readonly | type: boolean | description: Whether the automation is read-only. When `true`, site owners can't modify the automation or any of its actions. When `false`, users can configure specific actions as skippable or read-only using `settings.actionSettings`. Default: `false`. > **Note**: Setting `readOnly` to `true` overrides `settings.actionSettings`. - name: disableDelete | type: boolean | description: Whether to disable the option to delete the automation from the site. Default: `false`. - name: disableStatusChange | type: boolean | description: Whether to disable the option to change the automation's `configuration.status`. Default: `false`. - name: actionSettings | type: ActionSettings | description: Automation action settings. - name: permanentActionIds | type: array | description: IDs of actions whose `skipActionExpression` can't be modified. An action's `skipActionExpression` determines whether the action is skipped. Including an action's GUID in this array makes its `skipActionExpression` permanent, so it can't be changed. When empty, the `skipActionExpression` of all actions can be edited. - name: readonlyActionIds | type: array | description: IDs of read-only actions. Read-only actions cannot be modified. When empty and the automation's `settings.readonly` is `false`, all actions are modifiable. - name: draftInfo | type: DraftInfo | description: When the automation is a draft, the draft details. - name: originalAutomationId | type: string | description: GUID of the original automation. - name: archived | type: boolean | description: Whether the automation is archived. To archive an automation, set this to `true`. To restore an archived automation, set this to `false`. - name: autoArchivePolicy | type: AutoArchivePolicy | description: Auto archive policy - name: archiveDate | type: Date | description: Date when to archive the automation If this date in the past, nothing will happen (automation will not go into archived state) If this date in the future, on this date the automation will be updated with archived = true and configuration.status = INACTIVE After this date the automation may be unarchived and archived again, this date will have no influence ``` ### Examples ### createAutomation ```javascript import { automationsV2 } from '@wix/automations'; async function createAutomation(automation) { const response = await automationsV2.createAutomation(automation); }; ``` ### createAutomation (with elevated permissions) ```javascript import { automationsV2 } from '@wix/automations'; import { auth } from '@wix/essentials'; async function myCreateAutomationMethod(automation) { const elevatedCreateAutomation = auth.elevate(automationsV2.createAutomation); const response = await elevatedCreateAutomation(automation); } ``` ### createAutomation (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { automationsV2 } from '@wix/automations'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { automationsV2 }, // Include the auth strategy and host as relevant }); async function createAutomation(automation) { const response = await myWixClient.automationsV2.createAutomation(automation); }; ``` ---