> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Add a Custom Action

## Article: Add a Custom Action

## Article Link: https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/automations/add-a-custom-action.md

## Article Content:

# Add a Custom Action

The Automations Action service plugin lets you develop [custom actions](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/automations/about-custom-actions.md) directly in your site dashboard. To use a custom action as part of an automation, start by creating a new automation in your site dashboard:

1. Go to the [Automations](https://www.wix.com/my-account/site-selector/?buttonText=Select%20Site&title=Select%20a%20Site&autoSelectOnSingleSite=true&actionUrl=https:%2F%2Fwww.wix.com%2Fdashboard%2F%7B%7BmetaSiteId%7D%7D%2Ftriggers) page in your dashboard.
2. Click **New Automation**, then **Start from Scratch** to open the automation builder.
3. Select and configure a [trigger](https://support.wix.com/en/article/wix-automations-creating-an-automation-with-the-new-builder#step-2-choose-a-trigger).
4. Click the **+** to add a step and choose **Action**. In the menu on the left, select **Run Velo code**.

   ![Run velo code action](https://wixmp-833713b177cebf373f611808.wixmp.com/images/34472349eca2250ac5c157eaf040f2c5.png)

5. Click **Start Coding** to add your code. You'll be prompted to create a new code file.

   ![Start coding](https://wixmp-833713b177cebf373f611808.wixmp.com/images/ebb182e0763598c9a44bfb79d20a5e04.png)

6. Give the file a name and click **Create & Start Coding**.

   ![Name file and start coding](https://wixmp-833713b177cebf373f611808.wixmp.com/images/05a191f115d4928877886b5c531708e0.png)

   You should now see something like this:

   ![Write velo action code](https://static.wixstatic.com/media/d4dde1_636f1a1ad55c4c0399410db29c86912b~mv2.png)

   The **Write Velo Code** modal contains two tabs. The first is the .js file where you write your code. The second tab, which appears under **Payload view**, lets you view the expected structure of the trigger payload.

7. When you finish writing your code, click **Save**.

   Now that you have set up and coded your custom action, you can activate the automation immediately. However, we recommend
   testing the action code first.

8. To test your code, follow the instructions under **Run your code to test this action**, then click **Run Code**.

   ![Test your action code](https://wixmp-833713b177cebf373f611808.wixmp.com/images/e0961f5637cd9a5047dfc671fc8021b0.png)

   Wix provides sample data that matches the structure of your trigger payload. You can edit any of the fields in the sample payload to test your action.

   Be aware that testing the action runs the code live on your site, and may change cause changes in the site or dashboard.

   Once you test your code and are sure your action works, activate your automation.

## Edit your custom action

To edit your action code, [edit your automation](https://support.wix.com/en/article/the-new-automation-builder-managing-your-automations#editing-duplicating-or-renaming-an-automation) and select the **Run Velo code** action, then click on **Edit Code**. Make the changes you want, save the code, and test.

## See also

- [About Custom Actions](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/automations/about-custom-actions.md)
- [Automations Actions service plugin](https://dev.wix.com/docs/velo/events-service-plugins/automations/service-plugins/automations-actions/introduction.md)