This article shares some possible use cases you could support, as well as a sample flow that could support each use case. This can be a helpful jumping off point as you plan your implementation.
When a Wix user installs your app, you can collect their email address and send them a welcome email.
To retrieve new users' email:
data.instanceId
value from the payload.instanceId
collected above. This returns an object containing data about a specific app instance. Inside the object, you'll find the site owner's email in site.ownerInfo.email
.Notes:
ownerInfo
object returns empty, check to make sure you've added the correct permission scope to your app.Your app may be dependant on a specific app made by Wix. In this case, you can use the App Management API to verify that the relevant app is installed on a site. If so, Wix recommends marking one or more apps made by Wix as requirements. This will block the installation of your app and prompt the Wix user to install the required app.
However, if your app supports different use cases depending on which app is installed, we recommend following the steps below. For example, your app may offer one flow for a site that includes Wix Stores, and a different flow for a site that includes Wix Bookings.
To identify a site's installed apps made by Wix:
data.instanceId
value from the payload.site.installedWixApps
array.With this data, your app can now perform any logic on your end to adjust your app's flows to the installed Wix apps. If the user has installed multiple apps made by Wix for which you support different flows, you can present them with a modal that lets them choose their preference.
You can call Get App Instance regularly to stay up to date on a site's installed apps. If a Wix user no longer has a required Wix app installed, you may want to adjust your flow, or ask them to reinstall it. This is important to prevent getting errors when calling APIs that rely on an app made by Wix being installed.