Sample Flows

This article shares a possible use case your app could support, along with sample flows that could support that use case. This can be a helpful jumping-off point as you plan your app's implementation.

Allow a restaurant owner to manage their site's fulfillment methods through an external app

A restaurant owner wants to manage its fulfillment method availability through an external app. Any changes made on the app must be synced to their Wix site and vice versa.

Prerequisites

The site owner must do the following:

  • Install the Wix Restaurants Orders (New) app.
  • Configure the fulfillment methods for the 3rd-party delivery providers.

Flows

The following flows require a mapping from the fulfillment methods on Wix to the fulfillment methods in the external app. Create this mapping and store it on your app's server. According to this mapping, you can sync the data between the app and the site using webhooks and API calls.

>Note: Make sure to ignore webhooks resulting from calls you have triggered so that you don't create an endless loop of updates.

After creating the mapping, you can follow these two flows to create the two-way sync:

Flow 1: Synchronizing to the external system

  1. Sign up to the following fulfillment method webhooks to receive notifications about any changes to fulfillment methods on the Wix site. The webhooks are:
  2. When one of the webhooks is triggered, update the corresponding fulfillment method in the external app according to the mapping.
  3. Update the mapping to reflect any new or deleted fulfillment methods.

Flow 2: Synchronizing to Wix

  1. When a change is made to any of the fulfillment methods in the external app, find the id of the corresponding fulfillment method in Wix according to the mapping.
  2. If the change is an update, use the id from step 1 to get the current revision of the corresponding fulfillment method object using Get Fulfillment Method. This is required when calling the Update fulfillment method endpoint on Wix.
  3. Using the id from step 1, call the appropriate endpoint in the Fulfillment Methods API to update the information in Wix. The endpoints are:
  4. Update the mapping to reflect any new or deleted fulfillment methods.
Did this help?