Wix.Contacts

Important:
Wix.Contacts methods are only available from the Dashboard endpoint.

getContactById

Gets a specific Contact that has interacted with the current site by its ID.

SDK Version: SDK 1.32.0+
Display: Dashboard

Syntax:

Copy

Parameters:

NameTypeDescription
id (required)StringThe ID of the contact to look up
onSuccess (required)FunctionCallback function to receive an object with data about the contact
onFailure (required)FunctionCallback function that's triA function called when an error occurs that receives a Wix.Error

Example:

Copy

getContacts

Gets a list of all contacts that have interacted with a given site.

SDK Version: SDK 1.31.0+
Display: Dashboard

Syntax:

Copy

Parameters:

NameTypeDescription
options (required)ObjectOptions for this function
options.labelString or Array[string1, string2,...]Filter the list of contacts to return by specifying one or more labels that were defined by the user.

For example: customers or [customers, colleagues]
options.pageSizeInteger (1-500)Number of contacts to display per page.

Default is 25.
onSuccess (required)FunctionCallback function to receive the WixDataCursor object
onFailure (required)FunctionAn on failure callback

Value passed to onSuccess callback:

A WixDataCursor object, with the results presented in descending order by date. The following methods are supported by the WixDataCursor:

  • getData() → {Contacts[]} – A list of all the Contacts in the current website.
  • getPageSize() → {Number} – The number of the cursor page size.
  • getTotal() → {Number} – The total number of object in the cursor.
  • hasNext() → {boolean} – If WixDataCursor has more data.
  • hasPrevious() → {boolean} – If WixDataCursor has previous data.
  • next(onSuccess, onFailure) → {boolean} – The next WixDataCursor object.
  • previous(onSuccess, onFailure) → {boolean} – The previous WixDataCursor object.

Example:

Copy

reconcileContact

Use this method to share contact information with the WixHive.

SDK Version: SDK 1.46.0+
Display: Dashboard

Syntax:

Copy

Parameters:

NameTypeDescription
contactInfo (required)ObjectContact information collected by your app. Make sure to include at least the email or phone number in your request - we need it to create/update the contact.
contactInfo.NameObjectContact's Name
contactInfo.Name.prefixStringName prefix (limited to 100 characters)
contactInfo.Name.firstStringFirst name (limited to 100 characters)
contactInfo.Name.middleStringMiddle name (limited to 100 characters)
contactInfo.Name.lastStringLast name (limited to 100 characters)
contactInfo.Name.suffixStringName suffix (limited to 100 characters)
contactInfo.pictureStringURL to the Contact's photo
contactInfo.companyObjectContact's company details
contactInfo.company.roleStringContact's position or role (limited to 100 characters)
contactInfo.company.nameStringCompany name (limited to 100 characters)
contactInfo.emailsArray[object]Contact's email addresses
contactInfo.emails.idNumberID of this email within the array
contactInfo.emails.tag (required)String]Tag for this email - home, work, etc (limited to 100 characters)
contactInfo.emails.email (required)StringEmail address (limited to 250 characters)
contactInfo.emails.emailStatus"optOut", "transactional" or "recurring"The subscription status of the current email
contactInfo.emails.deliveryStatus"VALID", "SPAM", "COMPLAINT", "REJECTED",  "DEFERRAL" or "BOUNCE"Email delivery status:
  • VALID: When emails are delivered successfully.
  • SPAM: When emails are marked as spam by the recipient.
  • COMPLAINT: When the recipient of the email has made a complaint to the email provider.
  • REJECTED: When the email is rejected by email provider.
  • DEFERRAL: When your email provider refuses to send emails.
  • BOUNCE: When the mailbox is full, email address doesn't exist, etc.
contactInfo.phonesArray[object]Contact's phone number
contactInfo.phones.idNumberID of this phone number within the array
contactInfo.phones.tag (required)StringTag for this phone number - home, work, etc (limited to 100 characters)
contactInfo.phones.phone (required)StringPhone number (limited to 30 characters)
contactInfo.phones.normalizedPhone (required)StringNormalized phone number
contactInfo.addressesArray[object]Contact's address
contactInfo.addresses.idNumberID of this address within the array
contactInfo.addresses.tag (required)StringTag for this address - home, work, etc (limited to 100 characters)
contactInfo.addresses.addressStringStreet address (limited to 250 characters)
contactInfo.addresses.neighborhoodStringNeighborhood (limited to 100 characters)
contactInfo.addresses.cityStringCity (limited to 100 characters)
contactInfo.addresses.regionStringRegion, such as a U.S. state or Canadian province (limited to 100 characters)
contactInfo.addresses.countryStringCountry (limited to 100 characters)
contactInfo.addresses.postalCodeStringPostal code (limited to 20 characters)
contactInfo.urlsArray[object]URLs associated with the contact, like Facebook or LinkedIn
contactInfo.urls.idNumberID of this URL within the array
contactInfo.urls.tag (required)StringTag for this URL - personal, Facebook, LinkedIn, etc (limited to 100 characters)
contactInfo.urls.url (required)StringThe URL
contactInfo.datesArray[object]Important dates for this Contact, like birthday
contactInfo.dates.idNumberID of this date within the array
contactInfo.dates.tag (required)StringTag for this date - birthday, anniversary, etc (limited to 100 characters)
contactInfo.dates.date (required)dateTimeThe date, as an ISO 8601 timestamp
contactInfo.onSuccess (required)FunctionAn on success callback that returns an object with this information:
{
Contact: the reconciled Contact,
isNew: boolean
details: {
rejectedData: [ DTO1, DTO2,... ]
existingData: [ DTO1, DTO2, ... ]
}
}
contactInfo.onFailureFunctionAn on failure callback

Value passed to callback:

An object containing the contact information and the rejected data:

NameTypeDescription
ContactObjectContains all the information we have for this contact, including the data your app sent. 
isNewBooleanIndicates if the contact was just created
detailsObjectContains more information about this contact, including any data that was rejected
details.rejectedDataArrayLists information sent by your app that was rejected (if any).
details.existingDataArrayLists the data we already had for this contact, before your app sent additional information.

Example:

Copy
Did this help?