invoke( )


Runs your custom action when an automation is triggered.

Wix calls this function when an automation is triggered, for example by a form submission or a completed order. Therefore, write any code for your action in invoke(). Use the Velo APIs to create your action in the same way as you use them in your site's page code.

For example, let's say you want to save a site visitor's contact data to a collection when they submit a form. In this case, Wix calls invoke() when the form is submitted. Write the code to save the contact data, using the relevant wix-data methods, in the invoke() function.

invoke() accepts the trigger payload as a parameter. This payload changes depending on what your trigger is. You can access the payload fields and use them in your action code.

Method Declaration
Copy
Method Parameters
optionsOptionsRequired

The payload received from the trigger.

Returns
Return Type:Promise<object>
Was this helpful?
Yes
No