Wix Automations: Using Custom Code in an Automation

3 min read
In this article
  • Creating an automation with the Run Velo Code action
  • FAQs
We recommend only using Run Velo Code if you have prior technical knowledge and experience working with coding.
Enhance your automation using your own code using the Run Velo Code action. With this automation action and the Velo APIs, you can customize your site or business in any way you like, for example, by updating your CMS, formatting data, or connecting to third-party applications. Write your code, test it, and then activate the automation.
Before you begin:
  • In order to use the Run Velo Code action, you must first enable coding on your site.
  • The custom extensions feature currently can’t be added to a site when using Git integration and Wix CLI. You need to have permission to publish the site and the site must be published.

Creating an automation with the Run Velo Code action

  1. Go to Automations in your site's dashboard.
  2. Click + New Automation in the top right corner.
  3. Click + Start from Scratch.
  4. Click the title to give your automation a name.
  5. Select a trigger for your automation.
  6. Click to add a step.
  7. Click Action.
  8. Click Run Velo code on the left.
  9. Click Start Coding
  10. Give a name to the JS file and click Create & Start Coding
  11. Write your code in the window that opens.
    Notes: Lines 2 - 6 in the default code support the autocompletion system. Make sure you keep them in your code file. Additionally, use the "Invoke" function to implement your action logic.
  12. Click Save for your code to integrate your custom logic in this automation.
  13. (Optional) Before activating your automation, run your code to test it and make sure it gives the results you expect. Before you start your test:
    • Define the sample data that will run in the test.
    • Open the site logs to monitor the result.
  14. When ready, click Activate at the top right.
Important:
Running your code to test it means it's running live, so it might make changes within your site and/or dashboard.
screenshot of an automation flow with Run Velo Code action and side panel open to configure it.

FAQs