The Zapier Integration package lets you trigger a Zap from your Wix site.
Before using this package, set up the following:
Set up a Zapier account.
Create a Zap that is triggered by a webhook.
Choose the Zap’s trigger event from the dropdown menu. Select Catch Raw Hook
to receive a raw JS object, or Catch Hook
to let Zapier format the object.
Retrieve the Zap’s URL address. For example: https://hooks.zapier.com/hooks/catch/10257786/bbojhnh/
.
Note: The URL must start with https://hooks.zapier.com/hooks/catch/
.
Define the desired actions of your Zap.
The following backend file is included in the package. Note that only the exported function that you can use in your site is listed here.
The code in this file contains a function for triggering a Zap from your site.
To use the function in your backend code, import it with the following syntax:
postToZapier()
This function retrieves the relevant URL from the Wix Secrets Manager. Then it validates it and checks that the payload is not an empty object. If the checks succeed, it sends a POST request to the URL, passing the payload in the request’s body.
urlSecretName
: Name of the secret that securely stores the relevant URL in the Wix Secrets Manager.
payload
: Data that is sent to your Zap in the request’s body.
Note: The payload must be a non-empty JS object.
A promise that if successful resolves to an object containing the HTTP response, or if rejected resolves to a string describing the error.
1.0 Initial version.
zapier, automation, trigger, webhook, http