> 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 # CreateAction # Package: actions # Namespace: ActionCatalogService # Method link: https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-catalog/create-action.md ## Introduction Creates an action for the specified app. Once created, users can [create automations](https://support.wix.com/en/wix-automations-7067897) that include this action. Learn more about [actions](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md). > **Note:** You can only create actions for [apps you own or collaborate on](https://dev.wix.com/docs/build-apps/develop-your-app/app-dashboard-setup/manage-collaborators.md). --- ## REST API ### Schema ``` Method: createAction Description: Creates an action for the specified app. Once created, users can [create automations](https://support.wix.com/en/wix-automations-7067897) that include this action. Learn more about [actions](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md). > **Note:** You can only create actions for [apps you own or collaborate on](https://dev.wix.com/docs/build-apps/develop-your-app/app-dashboard-setup/manage-collaborators.md). URL: https://www.wixapis.com/v1/actions Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: action.appId, action.actionKey Method parameters: param name: action | type: Action | description: An action is a building block that Wix users can add to their automations. Each action represents a unit of functionality that an app installed on the site exposes for use in automations, such as sending an SMS, creating a coupon, or assigning loyalty points. A site's action catalog only contains actions provided by apps that are installed on the site. - name: appId | type: string | description: GUID of the [app that created the action](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: format GUID - name: actionKey | type: string | description: Action key. Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: minLength 5, maxLength 50 - name: implementedMethods | type: ImplementedMethods | description: Additional [service plugin methods](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md#implement-the-service-plugin-methods) implemented for this action. - name: validateConfiguration | type: boolean | description: Whether [Validate Configuration](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/validate-configuration.md) is implemented. Default: `false`. - name: getQuotaInfo | type: boolean | description: Whether [Get Quota Info](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/get-quota-info.md) is implemented. Default: `false`. - name: interfaceConfiguration | type: InterfaceConfiguration | description: Selected user interface for the action. The UI is displayed to the Wix user in the site dashboard when they configure the action. - ONE-OF: - name: genericOptions | type: GenericOptions | description: Details for the generic UI. - name: uiSchema | type: object | description: UI schema. - name: type | type: Type | description: Type of action configuration UI. - enum: - UNKNOWN_TYPE: Unknown action configuration UI. - GENERIC: The generic action configuration UI. This requires you to provide a [UI schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-ui-schema). - name: icon | type: Image | description: Action icon displayed in the [site dashboard](https://support.wix.com/en/article/about-your-wix-dashboard) to Wix users. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: altText | type: string | description: Image alt text. - name: baseUri | type: string | description: Action base URI. Wix calls your action at this base address. Learn more about the [Action Provider service plugin](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md). | validation: maxLength 256 param name: baseUri | type: baseUri | description: Base URI of the action provider service plugin that handles the action's invocation. | validation: maxLength 256 Return type: CreateActionResponse - name: action | type: Action | description: Created action. - name: id | type: string | description: Action GUID. | validation: format GUID - name: appId | type: string | description: GUID of the [app that created the action](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | validation: format GUID - name: actionKey | type: string | description: Action key. Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | validation: minLength 5, maxLength 50 - name: inputSchema | type: object | description: Action [input schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-input-schema). - name: outputSchema | type: object | description: Action [output schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-output-schema). - name: displayName | type: string | description: Action display name. Users see this name when they [choose an action for an automation](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-4-choose-an-action). For example, "Send SMS" or "Create Coupon". | validation: minLength 1, maxLength 80 - name: description | type: string | description: Action description displayed in the site dashboard to Wix users. - name: implementedMethods | type: ImplementedMethods | description: Additional [service plugin methods](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md#implement-the-service-plugin-methods) implemented for this action. - name: validateConfiguration | type: boolean | description: Whether [Validate Configuration](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/validate-configuration.md) is implemented. Default: `false`. - name: getQuotaInfo | type: boolean | description: Whether [Get Quota Info](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/get-quota-info.md) is implemented. Default: `false`. - name: interfaceConfiguration | type: InterfaceConfiguration | description: Selected user interface for the action. The UI is displayed to the Wix user in the site dashboard when they configure the action. - ONE-OF: - name: genericOptions | type: GenericOptions | description: Details for the generic UI. - name: uiSchema | type: object | description: UI schema. - name: type | type: Type | description: Type of action configuration UI. - enum: - UNKNOWN_TYPE: Unknown action configuration UI. - GENERIC: The generic action configuration UI. This requires you to provide a [UI schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-ui-schema). - name: icon | type: Image | description: Action icon displayed in the [site dashboard](https://support.wix.com/en/article/about-your-wix-dashboard) to Wix users. - name: id | type: string | description: WixMedia image GUID. - name: url | type: string | description: Image URL. - name: height | type: integer | description: Original image height. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: filename | type: string | description: Image filename. - name: createdDate | type: string | description: Date and time the action was created. | validation: format date-time - name: updatedDate | type: string | description: Date and time the action was last updated. | validation: format date-time - name: baseUri | type: string | description: Action base URI. Wix calls your action at this base address. Learn more about the [Action Provider service plugin](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md). | validation: maxLength 256 Possible Errors: HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: UNAUTHORIZED_APP | Description: The caller is not authorized to manage actions for the requested app. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: ACTION_ALREADY_EXISTS | Description: An action already exists for the requested app and action key. ``` ### Examples ### Create action ```curl curl -X POST 'https://www.wixapis.com/v1/actions' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ -d '{ "action": { "appId": "e4c3e640-0b63-4bd9-8574-53f8c14e0236", "actionKey": "send-gift-card", "displayName": "Send a gift card", "description": "Send a gift card to a contact via email.", "inputSchema": { "$schema": "http://json-schema.org/draft-07/schema", "type": "object", "required": ["contactId", "amount"], "properties": { "contactId": { "type": "string", "format": "uuid", "title": "Contact ID", "identityType": "contact" }, "amount": { "type": "number", "title": "Gift card amount" }, "message": { "type": "string", "title": "Personal message" } } }, "interfaceConfiguration": { "type": "GENERIC" } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.actions.ActionCatalogService.createAction(options) Description: Creates an action for the specified app. Once created, users can [create automations](https://support.wix.com/en/wix-automations-7067897) that include this action. Learn more about [actions](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md). > **Note:** You can only create actions for [apps you own or collaborate on](https://dev.wix.com/docs/build-apps/develop-your-app/app-dashboard-setup/manage-collaborators.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: action.appId, action.actionKey Method parameters: param name: options | type: CreateActionOptions none - name: action | type: Action | description: Action to add to the app. - name: appId | type: string | description: GUID of the [app that created the action](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: format GUID - name: actionKey | type: string | description: Action key. Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | required: true | validation: minLength 5, maxLength 50 - name: implementedMethods | type: ImplementedMethods | description: Additional [service plugin methods](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md#implement-the-service-plugin-methods) implemented for this action. - name: validateConfiguration | type: boolean | description: Whether [Validate Configuration](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/validate-configuration.md) is implemented. Default: `false`. - name: getQuotaInfo | type: boolean | description: Whether [Get Quota Info](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/get-quota-info.md) is implemented. Default: `false`. - name: interfaceConfiguration | type: InterfaceConfiguration | description: Selected user interface for the action. The UI is displayed to the Wix user in the site dashboard when they configure the action. - ONE-OF: - name: genericOptions | type: GenericOptions | description: Details for the generic UI. - name: uiSchema | type: object | description: UI schema. - name: type | type: Type | description: Type of action configuration UI. - enum: - UNKNOWN_TYPE: Unknown action configuration UI. - GENERIC: The generic action configuration UI. This requires you to provide a [UI schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-ui-schema). - name: icon | type: string | description: Action icon displayed in the [site dashboard](https://support.wix.com/en/article/about-your-wix-dashboard) to Wix users. - name: baseUri | type: string | description: Action base URI. Wix calls your action at this base address. Learn more about the [Action Provider service plugin](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md). | validation: maxLength 256 - name: baseUri | type: string | description: Base URI of the action provider service plugin that handles the action's invocation. | validation: maxLength 256 Return type: PROMISE - name: _id | type: string | description: Action GUID. | validation: format GUID - name: appId | type: string | description: GUID of the [app that created the action](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | validation: format GUID - name: actionKey | type: string | description: Action key. Learn about [adding an action to your app](https://dev.wix.com/docs/api-reference/business-management/automations/actions/add-an-action-to-your-app.md). | validation: minLength 5, maxLength 50 - name: inputSchema | type: object | description: Action [input schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-input-schema). - name: outputSchema | type: object | description: Action [output schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-output-schema). - name: displayName | type: string | description: Action display name. Users see this name when they [choose an action for an automation](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-4-choose-an-action). For example, "Send SMS" or "Create Coupon". | validation: minLength 1, maxLength 80 - name: description | type: string | description: Action description displayed in the site dashboard to Wix users. - name: implementedMethods | type: ImplementedMethods | description: Additional [service plugin methods](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md#implement-the-service-plugin-methods) implemented for this action. - name: validateConfiguration | type: boolean | description: Whether [Validate Configuration](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/validate-configuration.md) is implemented. Default: `false`. - name: getQuotaInfo | type: boolean | description: Whether [Get Quota Info](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/get-quota-info.md) is implemented. Default: `false`. - name: interfaceConfiguration | type: InterfaceConfiguration | description: Selected user interface for the action. The UI is displayed to the Wix user in the site dashboard when they configure the action. - ONE-OF: - name: genericOptions | type: GenericOptions | description: Details for the generic UI. - name: uiSchema | type: object | description: UI schema. - name: type | type: Type | description: Type of action configuration UI. - enum: - UNKNOWN_TYPE: Unknown action configuration UI. - GENERIC: The generic action configuration UI. This requires you to provide a [UI schema](https://dev.wix.com/docs/api-reference/business-management/automations/actions/about-actions.md#the-ui-schema). - name: icon | type: string | description: Action icon displayed in the [site dashboard](https://support.wix.com/en/article/about-your-wix-dashboard) to Wix users. - name: _createdDate | type: Date | description: Date and time the action was created. - name: _updatedDate | type: Date | description: Date and time the action was last updated. - name: baseUri | type: string | description: Action base URI. Wix calls your action at this base address. Learn more about the [Action Provider service plugin](https://dev.wix.com/docs/api-reference/business-management/automations/actions/action-provider-service-plugin/introduction.md). | validation: maxLength 256 Possible Errors: HTTP Code: 403 | Status Code: PERMISSION_DENIED | Application Code: UNAUTHORIZED_APP | Description: The caller is not authorized to manage actions for the requested app. HTTP Code: 409 | Status Code: ALREADY_EXISTS | Application Code: ACTION_ALREADY_EXISTS | Description: An action already exists for the requested app and action key. ``` ### Examples ### Create action Creates a new action for an app with an input schema. ```javascript import { actionCatalog } from "@wix/automations"; const inputSchema = { $schema: "http://json-schema.org/draft-07/schema", type: "object", required: ["contactId", "amount"], properties: { contactId: { type: "string", format: "uuid", title: "Contact ID", identityType: "contact", }, amount: { type: "number", title: "Gift card amount", }, message: { type: "string", title: "Personal message", }, }, }; async function createAction() { const response = await actionCatalog.createAction({ action: { appId: "e4c3e640-0b63-4bd9-8574-53f8c14e0236", actionKey: "send-gift-card", displayName: "Send a gift card", description: "Send a gift card to a contact via email.", inputSchema, interfaceConfiguration: { type: "GENERIC" }, }, }); return response; } /* Promise resolves to: * { * "action": { * "_id": "a3d2f8e1-7c4b-4a9e-b6d5-1e8f3c2a9b7d", * "appId": "e4c3e640-0b63-4bd9-8574-53f8c14e0236", * "actionKey": "send-gift-card", * "displayName": "Send a gift card", * "description": "Send a gift card to a contact via email.", * "inputSchema": { ... }, * "implementedMethods": { "validateConfiguration": false, "getQuotaInfo": false }, * "interfaceConfiguration": { "type": "GENERIC" }, * "_createdDate": "2024-11-15T10:30:00.000Z", * "_updatedDate": "2024-11-15T10:30:00.000Z" * } * } */ ``` ### createAction (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 { actionCatalog } from '@wix/automations'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { actionCatalog }, // Include the auth strategy and host as relevant }); async function createAction(options) { const response = await myWixClient.actionCatalog.createAction(options); }; ``` ---