This article explains the different approaches for creating and activating functions using the Functions APIs. For an overview of function components and architecture, see Function Architecture.
Once you've chosen your function type or template, you need to define the function's logic. For some function types, you also need to define its service plugin configuration. Once you've defined these things, you can create your function. After creating a function, activate it to make it live.
Wix provides 2 streamlined approaches for creating functions that combine function creation, logic attachment, and service plugin configuration:
These methods eliminate the need to call multiple APIs separately, making function creation more efficient for developers.
Note: Each function template is compatible with either the basic flow or the builderless flow, but not both. Function templates that you can use in the builderless flow are those that contain a formTemplateExtensionId.
Create a function that's ready to use by calling Create Function Production. This combines creating a function, attaching a function method (and the logic defined in the automation) to it, and configuring the function's service plugin configuration.
Depending on the function type, you may still need to edit its logic or service plugin configuration before you can activate it.
Create a function that's ready to use by calling Create Function Builderless Production. This combines creating a function, attaching a function method (and the logic defined in the automation) to it, and configuring the function's service plugin configuration.
Builderless creation is often more efficient than basic creation, but it's only possible if the template you want to use contains a formTemplateExtensionId.
Notes:
namespace: wix.function_template.formformIds: An array that contains the function template's formTemplateExtensionIdkind: EXTENSIONYou can activate functions created this way immediately.
Activating a function means that it will run when triggered by the business solution.
Activate a function by calling Upsert Function Activation. This creates a function activation that you can delete to deactivate the function. Any changes to the function will only take effect if you call Upsert Function Activation again.