This article shares some possible use cases your app could support, as well as an example flow that could support each use case. You're certainly not limited to these use cases, but they can be a helpful jumping off point as you plan your app's implementation.
If a site owner manages their contacts in an external CRM, you can export new leads to their CRM.
To do this, your app can periodically bulk load new contacts:
For the first load after the app is installed, use
List Contacts to get all contacts.
Set paging.limit
to 1000
.
If you receive 1,000 contacts, there may be more contacts to retrieve.
Run the request again, and increase paging.offset
to 1000
.
Keep running the request, each time increasing the offset,
until all contacts are retrieved.
Upload the returned contacts to the external CRM.
Save the current datetime, and use it in the next request. Each subsequent request will need to use the datetime of the request that came before it.
For all subsequent loads, use Query Contacts, and filter for new contacts created since the last load:
Repeat steps 2 to 4 for each subsequent load. You can allow the site admin to configure the time interval in your app to fit their needs.
Site owners can use your app to keep their external CRM or email marketing platform up to date with their Wix contact list with a two-way sync. To synchronize Wix and an external system, think about how your app will handle these flows:
To ensure a 1:1 relationship with the external CRM contacts, create a custom field to hold the contact's external ID. You can do this with Find or Create Extended Field:
The first time a contact is synchronized, populate the new field with the external ID. Craft your code so this ID won’t be overwritten by future updates from your app.
Create a mapping from the Wix fields to the external CRM fields, to be used whenever Wix and the external CRM are synchronized. Store this mapping on your app's server.
Prompt the site owner to choose a system of record (either Wix or the external CRM), and delete all the contacts from the other system. Be careful with this flow, however. Always warn your users when they're about to delete data.
Note: If a contact in Wix is also a site member, the contact can't be deleted.
Listen for any changes to Wix contacts with these webhooks:
When one of the above webhooks is triggered, you'll receive the contact in the payload. You can bring those changes to the external CRM with a flow like this one:
Get the slug
(which tells you what the event was),
entityId
(which is the contact ID),
and any other relevant information from the payload data.
Use the mapping (from the initial setup) to send the relevant information to the external CRM.
Ignore the resulting event from the external CRM so you don’t create an endless loop of updates.
Listen for contact events from the external CRM. When your app receives a change it needs to synchronize, follow this basic flow:
Use the mapping (from the initial setup) to send the updated contact to the relevant endpoint (Create Contact, Update Contact, or Delete Contact).
Ignore the resulting event from Wix so you don’t create an endless loop of updates.
To create contacts using a form hosted in an external app, capture the relevant form values, and follow this basic flow:
Some site owners communicate with their users through an external email delivery service. To comply with privacy regulations, site owners need to ensure that only contacts who have opted in to marketing emails will receive those emails.
Email subscription status is conveyed in the
emailSubscriptions.subscriptionStatus
extended field.
To allow site owners to email opted-in contacts,
query contacts where emailSubscriptions.subscriptionStatus
is SUBSCRIBED
with this basic flow:
Retrieve the filtered list of contacts with Query Contacts.
Filter for contacts whose subscriptionStatus
is SUBSCRIBED
,
and return only the fields you need:
Create a mapping from the Wix fields to the email delivery service fields. Store this mapping on your app's server.