App Management: Sample Use Cases and Flows

This article shares some possible use cases your app 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 app's implementation.

Reach out to new users

When a new user installs your app, you can get their email and save it for future communications.

To retrieve new users' email:

  1. In the Wix Developers Center, add the Read Site Owner Email permission scope to your app. You need this permission to see a site owner's email when you request the app instance information from their site.
  2. Listen to the App Instance Installed webhook to be notified when a new user installs your app. Save the data.instanceId value from the webhook payload.
  3. Create an access token using the OAuth 2 API. Pass the method your APP_ID and APP_SECRET_KEY from the Dev Center, as well as the instance ID you collected in Step 1. This will generate an access token you can use to communicate with the user's site.
  4. Call Get App Instance. 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. Save this email for future communications.

Notes:

  • If the ownerInfo object returns empty, check to make sure you've added the correct permission scope to your app in the Dev Center.
  • You'll need to check on your end whether the user has opted in to communications from your app or not.

Identify a site's installed Wix business solutions

Your app may require that the site owners have also installed a specific Wix business solution. In this case, you can use the App Management API to verify that the relevant app is installed on their site.

During your app's setup process in the Dev Center, you can mark one or more apps built by Wix as requirements. However, if your app supports different use cases depending on which Wix business solution 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 uses Wix Bookings. Therefore, you need to identify which one is installed on the site with your app.

To identify a site's installed business solutions:

  1. Listen to the App Instance Installed webhook to be notified when a new user installs your app. Save the data.instanceId value from the webhook payload.
  2. Create an access token using the OAuth 2 API. Pass the method your APP_ID and APP_SECRET_KEY from the Dev Center, as well as the instance ID you collected in Step 1. This will generate an access token you can use to communicate with the user's site.
  3. Call Get App Instance to retrieve a list of the site's installed apps built by Wix. You can find this list in the site.installedWixApps array.
  4. Perform the logic on your end to adjust your app's flows to the installed business solutions. If the user has installed multiple apps built by Wix for which you support different flows, present them with a modal that lets them choose their preference.
  5. You can call Get App Instance repeatedly to stay up to date on a site's installed apps. If a user no longer has a required Wix app installed, you may want to adjust your flow to ask them to reinstall it. This is important to prevent getting errors when calling APIs that rely on a Wix app being installed.
Was this helpful?
Yes
No