Introduction

When a new visitor first shares some of their contact information with your site, they're added to your Contact List. Once that happens, their details are available through the Contacts API.

Some examples of how a person can become a contact are:

Learn more about how you can manage your contact list.

With the Contacts APIs, you can:

  • Manage site contacts.
  • Manage contact labels.
  • Manage extended field definitions.

To use the Contacts API, import { contacts } from wix-crm-backend:

Copy
import { contacts } from "wix-crm-backend";

Before you begin

It's important to note this point before coding:

If a contact is also a site member or site contributor, the contact cannot be deleted. The related site member or site contributor must first be deleted, and then the contact can also be deleted.

Terminology

  • Extended fields: Additional properties that store additional contact information. A contact's extended field data is available in the contact object under info.extendedFields. Extended field definitions can be created and managed with the extended field functions such as findOrCreateExtendedField().

    There are 2 types of extended fields:

    • System fields: Extended fields added by Wix apps. System fields often enrich contacts with data from Wix apps, such as Wix Stores or Wix Members. System fields cannot be renamed and are typically read-only.
    • Custom fields: Extended fields added by site collaborators or 3rd-party apps. Custom fields can be renamed, and their data can be written by any site collaborators or 3rd-party app.
  • Labels: Tags that help site contributors categorize and organize their contacts. Labels can be system-defined or user-defined. You can manage a site's labels with the label functions such as findOrCreateLabel(). A contact's assigned labels are available in the contact object under info.labelKeys.

Did this help?

About Extended Fields

Basic contact information is stored in the contact's default properties. This includes information such as contact name, company, phone numbers, addresses, and email addresses. Additional properties are stored in extended fields.

There are 2 types of extended fields:

  • System fields are added by Wix apps. They often enrich your contacts with data from Wix products, such as Wix Bookings or Wix Stores. System fields cannot be renamed.
  • Custom fields can be added by site contributors or 3rd-party apps. Custom fields can be renamed, and their data can be written by site contributors and 3rd-party apps.

When you create, update, or retrieve contacts, you'll find extended field data in the contact object under info.extendedFields. Most system fields are read-only, while all custom fields can be written to.

Did this help?

About Labels

Labels allow site collaborators to segment contacts in their Contact List. Contact labels are useful for targeting specific audiences for email campaigns or bulk actions.

For more information on how labels are used, see Creating Contact Labels.

Did this help?

Last Activity Types

When a contact interacts with your site, the interaction is captured in lastActivity in the contact object. The table below shows the possible activityType values and describes the interactions each activity type represents:

Activity TypeDescription
GENERALVisited the site.
CONTACT_CREATEDBecame a new contact.
MEMBER_LOGINLogged in.
MEMBER_REGISTERRequested site membership.
MEMBER_STATUS_CHANGEDWas approved, blocked, or unblocked.
FORM_SUBMITTEDSubmitted a form.
INBOX_FORM_SUBMITTEDStarted a chat.
INBOX_PAYMENT_REQUEST_PAIDPaid a payment request.
INBOX_MESSAGE_TO_CUSTOMERReceived a message from a site contributor.
INBOX_MESSAGE_FROM_CUSTOMERSent a new message to the site.
NEWSLETTER_SUBSCRIPTION_FORM_SUBMITTEDSubscribed to a site newsletter.
NEWSLETTER_SUBSCRIPTION_UNSUBSCRIBEUnsubscribed from a site newsletter.
ECOM_PURCHASEMade a Wix Stores purchase.
ECOM_CART_ABANDONAbandoned their shopping cart.
ECOM_CHECKOUT_BUYERChecked out shopping cart and submitted buyer info (but didn’t complete purchase yet).
BOOKINGS_APPOINTMENTBooked an appointment.
HOTELS_RESERVATIONMade a Wix Hotels reservation.
HOTELS_PURCHASEPaid for a Wix Hotels reservation.
HOTELS_CONFIRMATIONConfirmed a Wix Hotels reservation.
HOTELS_CANCELCanceled a Wix Hotels reservation.
VIDEO_PURCHASEPurchased a video.
VIDEO_RENTRented a video.
CASHIER_BUTTON_PURCHASEMade a purchase with a pay button.
ARENA_NEW_LEADBecame a new Wix Marketplace lead.
EVENTS_RSVPResponded that they're attending an event.
INVOICE_PAYPaid an invoice.
INVOICE_OVERDUEContact's invoice is now overdue.
PRICE_QUOTE_ACCEPTAccepted a price quote.
PRICE_QUOTE_EXPIREContact’s price quote has expired.
RESTAURANTS_ORDEROrdered food with Wix Restaurants.
RESTAURANTS_RESERVATIONMade a Wix Restaurants reservation.
SHOUTOUT_OPENOpened an email from the site.
SHOUTOUT_CLICKClicked a link in an email from the site.
CONTACT_MERGEDMerged with another contact.
Did this help?

Contacts: Supported Filters, Sorting, and Search

This article covers field support for filtering, sorting, and searching in the Contacts API, the Labels API, and the Extended Fields API.

The available options when calling queryContacts() have been divided into these 3 sections:

  • Contact properties: Covers querying the base set of contact properties, such as contact ID, name, emails, and labels.
  • System fields: Covers querying system fields inside the info.extendedFields object.
  • Custom fields: Covers querying custom fields inside the info.extendedFields object.

For information on the difference between system fields and custom fields, see Terminology.

The table below shows field support for filters, sorting, and free-text searching for the base set of contact properties. It doesn't include extended fields (those are covered in the sections below).

For a full description of the Contact object, see ContactsQueryResult > items.

PropertySupported Filters & Sorting
_ideq(), ne(), hasSome()
_createdDateeq(), ne(), gt(), lt(), ge(), le(), between(), ascending(), descending()
_updatedDateeq(), ne(), gt(), lt(), ge(), le(), between()
lastActivity.activityDateeq(), ne(), gt(), lt(), ge(), le(), between(), ascending(), descending()
primaryInfo.emaileq(), ne(), hasSome(), startsWith(), ascending(), descending()
primaryInfo.phoneeq(), ne(), hasSome(), startsWith()
info.name.firsteq(), ne(), hasSome(), startsWith(), ascending(), descending()
info.name.lasteq(), ne(), hasSome(), startsWith(), ascending(), descending()
info.emails.emaileq(), ne(), hasSome(), startsWith()
info.phones.phoneeq(), ne(), hasSome(), startsWith()
info.addresses.streeteq(), ne(), hasSome(), startsWith()
info.addresses.cityeq(), ne(), hasSome(), startsWith()
info.addresses.subdivisioneq(), ne(), hasSome(),
info.addresses.countryeq(), ne(), hasSome(),
info.companyeq(), ne(), hasSome(), startsWith(), ascending(), descending()
info.jobTitleeq(), ne(), hasSome(), startsWith(), ascending(), descending()
info.birthdateeq(), ne(), gt(), lt(), ge(), le(), between(), ascending(), descending()
info.localeeq(), ne(), hasSome(),
info.labelKeyshasSome(), hasAll()

The table below shows field support for filters, sorting, and free-text searching for the Wix-defined extended fields (also known as system fields).

Note: When working directly with the Contact object in your code, data in extended fields must be accessed using bracket notation, like this: info.extendedFields['{key}']. However, when querying or sorting, extended field names are flattened with dot notation, like this: ascending('info.extendedFields.{key}').

Extended FieldSupported Filters & SortingSupported Values
info.extendedFields.emailSubscriptions.deliverabilityStatuseq(),ne(),hasSome()"VALID", "BOUNCED", "SPAM_COMPLAINT", "NOT_SET", "INACTIVE".
info.extendedFields.emailSubscriptions.effectiveEmailascending(), descending()
info.extendedFields.emailSubscriptions.subscriptionStatuseq(), ne(), hasSome()"SUBSCRIBED", "UNSUBSCRIBED", "NOT_SET", "PENDING".
info.extendedFields.members.membershipStatuseq(), ne(), hasSome()"APPROVED", "DENIED", "PENDING", "INACTIVE".

Extended fields that are created by 3rd-party apps or site contributors are known as custom fields. You can add, remove, and change custom field names from the Contact List in the Dashboard.

The table below shows field support for filters, sorting, and free-text searching for custom fields.

Note: When querying or sorting, extended field names are flattened to a dot-separated string, like this: 'info.extendedFields.{key}'. For example, to query the custom.new-customer extended field, use this flattened field name: 'info.extendedFields.custom.new-customer'.

Data Type/FormatSupported Filters & Sorting
Stringeq(), ne(), hasSome(), startsWith(), ascending(), descending()
Numbereq(), ne(), gt(), lt(), ge(), le(), between(), ascending(), descending()
Date string in YYYY-MM-DD formateq(), ne(), gt(), lt(), ge(), le(), between(), ascending(), descending()

Query labels: Supported filters and sorting

This section covers the available options when calling queryLabels().

The table below shows field support for filters and sorting for the label object.

For a full description of the Label object, see LabelsQueryResult > items.

PropertySupported Sorting                                                            
_createdDateascending(), descending()
_updatedDateascending(), descending()
displayNameascending(), descending()

Query extended fields: Supported filters and sorting

This section covers the available options when calling queryExtendedFields().

The table below shows field support for filters and sorting for the extended field object.

For a full description of the ExtendedField object, see ExtendedFieldsQueryResult > items.

PropertySupported Sorting                                                            
_createdDateascending(), descending()
_updatedDateascending(), descending()
displayNameascending(), descending()
Did this help?

appendOrCreateContact( )


Appends contactInfo to an existing contact or creates a new contact if it doesn't already exist.

The appendOrCreateContact() function returns a Promise that resolves to a contact ID and identity type when a contact is found or created.

When called, appendOrCreateContact() accepts an object with contact information and follows the steps below. When one of the conditions is met, this process ends and the specified data is handled:

  1. If the current visitor is a logged-in member: appendOrCreateContact() reconciles with the member's associated contact.
  2. If the current visitor is not a logged-in member: appendOrCreateContact() tries to reconcile any specified email addresses and/or phone numbers with an existing contact.
  3. If an email address, phone number, and/or name has been provided, but the contact can't be reconciled: A new contact is created and appendOrCreateContact() reconciles with the new contact.
  4. If a contact can't be reconciled by email or phone and a new contact isn't created: appendOrCreateContact() tries to reconcile the visitor's session identity with an existing contact.
  5. If no contact can be created: The Promise is rejected.

appendOrCreateContact() does not require member authentication, so it does not return the entire contact object. The contact's data can be retrieved with getContact().

How the Data is Handled

If an existing contact is found:

  • The current visitor's session identity is associated with the contact.
  • If a specified property is empty in the existing contact, the property is updated with the specified information.
  • For arrays, any specified information is added as new array items. This includes emails, addresses, phones, and labelKeys.
  • No existing data is overwritten or deleted.

Note: If the reconciled contact belongs to a member who isn't currently logged in to the site, identityType is returned as "NOT_AUTHENTICATED_MEMBER". In that case, no contact properties are modified.

If a new contact is created:

  • The new contact's data is populated with the specified contact object.
  • The current visitor's session identity is associated with the contact.
Method Declaration
Copy
function appendOrCreateContact(
  contactInfo: ContactInfo,
): Promise<ContactIdentification>;
Method Parameters
contactInfoContactInfoRequired

Contact's information. To reconcile with an existing contact, a phone or email must be provided, or the current session identity must be attached to a contact or member.

If no existing contact can be found, a new contact is created with the specified information.

Returns
Return Type:Promise<ContactIdentification>
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myAppendOrCreateContactFunction = webMethod( Permissions.Anyone, () => { const contactInfo = { name: { first: "Ari", last: "Thereyet", }, }; return contacts .appendOrCreateContact(contactInfo) .then((resolvedContact) => { return resolvedContact; }) .catch((error) => { console.error(error); }); }, ); /* Promise resolves to: * { * "contactId": "a52852d7-e0d6-484b-93fe-bffdb670f08f", * "identityType": "CONTACT" * } */
Did this help?

createContact( )


Creates a new contact.

The createContact() function returns a Promise that resolves to the new contact when it is created.

Note: This function replaces the deprecated wixCrmBackend.createContact(). The deprecated function will continue to work, but it will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.

The contactInfo parameter object must include a name, phone number, or email address. If all 3 of these parameters are missing, the contact won't be created.

By default, if the call contains an email already in use by another contact, the new contact won't be created. To override this behavior, set allowDuplicates in the options object to true.

Note: Only visitors with Manage Contacts permissions can create contacts. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function createContact(
  contactInfo: ContactInfo,
  options: Options,
): Promise<Contact>;
Method Parameters
contactInfoContactInfoRequired

Contact info.


optionsOptions

Contact creation options.

Returns
Return Type:Promise<Contact>
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myCreateContactFunction = webMethod(Permissions.Anyone, () => { const contactInfo = { name: { first: "Ari", last: "Thereyet", }, }; const options = { allowDuplicates: false, suppressAuth: false, }; return contacts .createContact(contactInfo, options) .then((contact) => { return contact; }) .catch((error) => { console.error(error); }); }); /* Promise resolves to: * { * "_id": "bbc44e99-4439-4a51-ac8c-77d6a9bb6243", * "_createdDate": "2021-07-26T06:32:46.466Z", * "_updatedDate": "2021-07-26T06:32:46.467Z", * "revision": 0, * "info": { * "name": { * "first": "Ari", * "last": "Thereyet" * }, * "extendedFields": { * "contacts.displayByFirstName": "Ari Thereyet", * "contacts.displayByLastName": "Thereyet Ari" * } * }, * "lastActivity": { * "activityDate": "2021-07-26T06:32:46.466Z", * "activityType": "CONTACT_CREATED" * }, * "source": { * "appId": "v4.createContact", * "sourceType": "OTHER" * } * } */
Did this help?

deleteContact( )


Deletes a contact who is not a site member or contributor.

The deleteContact() function returns a Promise that resolves when the specified contact is deleted.

Note: This function replaces the deprecated wixCrmBackend.deleteContact(). The deprecated function will continue to work, but it will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.

Deleting a contact permanently removes them from your Contact List.

If the contact is also a site member, the member must be deleted first, and then the contact can be deleted.

Note: Only visitors with Manage Contacts permissions can delete contacts. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function deleteContact(contactId: string, options: AuthOptions): Promise<void>;
Method Parameters
contactIdstringRequired

ID of the contact to delete.


optionsAuthOptions

Authorization options.

Delete a contact
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myDeleteContactFunction = webMethod(Permissions.Anyone, () => { const contactId = "43fd5f9e-d7d4-4a31-8bfc-3bdc180cc40a"; const options = { suppressAuth: false, }; return contacts .deleteContact(contactId, options) .then(() => { console.log("Contact deleted"); }) .catch((error) => { console.error(error); }); });
Did this help?

deleteExtendedField( )


Deletes an extended field.

The deleteExtendedField() function returns a Promise that resolves when the specified extended field is deleted.

When an extended field is deleted, any contact data stored in the field is permanently deleted as well.

Note: Only visitors with Manage Contacts permissions can delete extended fields. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function deleteExtendedField(key: string, options: AuthOptions): Promise<void>;
Method Parameters
keystringRequired

Extended field ID.


optionsAuthOptions

Authorization options.

Delete an extended field
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myDeleteExtendedFieldFunction = webMethod( Permissions.Anyone, () => { const fieldKey = "custom.event-name"; const options = { suppressAuth: false, }; return contacts .deleteExtendedField(fieldKey, options) .then(() => { console.log("Extended field deleted"); }) .catch((error) => { console.error(error); }); }, );
Did this help?

deleteLabel( )


Deletes a label from the site and removes it from contacts it applies to.

The deleteLabel() function returns a Promise that resolves when the specified label is deleted.

Note: Only visitors with Manage Contacts permissions can delete labels. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function deleteLabel(key: string, options: AuthOptions): Promise<void>;
Method Parameters
keystringRequired

Label key to delete.


optionsAuthOptions

Authorization options.

Delete a label
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myDeleteLabelFunction = webMethod(Permissions.Anyone, () => { const labelKey = "custom.new-lead"; const options = { suppressAuth: false, }; return contacts .deleteLabel(labelKey, options) .then(() => { console.log("Label deleted"); }) .catch((error) => { console.error(error); }); });
Did this help?

findOrCreateExtendedField( )


Retrieves a custom field with a given name, or creates one if it doesn't exist.

The findOrCreateExtendedField() function returns a Promise that resolves when the specified custom field is found or created.

Successful calls to findOrCreateExtendedField() always return an extended field, which can be passed to subsequent function calls.

To find an existing extended field without potentially creating a new one, use getExtendedField() or queryExtendedFields().

Note: Only visitors with Manage Contacts permissions can find or create extended fields. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function findOrCreateExtendedField(
  extendedFieldInfo: ExtendedFieldInfo,
  options: AuthOptions,
): Promise<FoundOrCreatedExtendedField>;
Method Parameters
extendedFieldInfoExtendedFieldInfoRequired

Custom field to find or create.


optionsAuthOptions

Authorization options.

Returns
Return Type:Promise<FoundOrCreatedExtendedField>
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myFindOrCreateExtendedFieldFunction = webMethod( Permissions.Anyone, () => { const extendedFieldInfo = { displayName: "Last Contacted", dataType: "DATE", }; const options = { suppressAuth: false, }; return contacts .findOrCreateExtendedField(extendedFieldInfo, options) .then((extendedField) => { return extendedField; }) .catch((error) => { console.error(error); }); }, ); /* * Promise that resolves to: * * { * "extendedField": { * "_createdDate": "2021-01-19T23:18:16.550Z", * "_updatedDate": "2021-01-19T23:18:16.550Z" * "namespace": "custom", * "key": "custom.last-contacted", * "displayName": "Last Contacted", * "dataType": "DATE", * "fieldType": "USER_DEFINED", * }, * "newExtendedField": true * } */
Did this help?

findOrCreateLabel( )


Retrieves a label with a given name, or creates one if it doesn't exist.

The findOrCreateLabel() function returns a Promise that resolves when the specified label is found or created.

Successful calls to findOrCreateLabel() always return a label, which can be passed to subsequent function calls.

To find an existing label without potentially creating a new one, use getLabel() or queryLabels().

Note: Only visitors with Manage Contacts permissions can find or create labels. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function findOrCreateLabel(
  displayName: string,
  options: AuthOptions,
): Promise<FoundOrCreatedLabel>;
Method Parameters
displayNamestringRequired

Label display name to retrieve or create.

If an existing label is an exact match for the specified display name, the existing label is returned. If not, a new label is created and returned.


optionsAuthOptions

Authorization options.

Returns
Return Type:Promise<FoundOrCreatedLabel>
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myFindOrCreateLabelFunction = webMethod(Permissions.Anyone, () => { const displayName = "Active Customer"; const options = { suppressAuth: false, }; return contacts .findOrCreateLabel(displayName, options) .then((label) => { return label; }) .catch((error) => { console.error(error); }); }); /* * Promise resolves to: * * { * "label": { * "_createdDate": "2021-01-20T00:31:41.452Z", * "_updatedDate": "2021-01-20T00:31:41.452Z" * "namespace": "custom", * "key": "custom.active-customer", * "displayName": "Active Customer", * "labelType": "USER_DEFINED" * }, * "newLabel": true * } */
Did this help?

getContact( )


Retrieves a contact.

The getContact() function returns a Promise that resolves when the contact is found.

Getting Merged Contacts

When a source contact is merged with a target contact, the source contact is deleted. When calling getContact() for a merged contact, you can use the source or target contact ID. In both cases, the target contact is returned.

This is supported only when calling getContact(), and only for merged contacts. Deleted source contact IDs are not supported on any other function.

Notes:

  • This function replaces the deprecated wixCrmBackend.getContactById(). The deprecated function will continue to work, but it will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.
  • Only visitors with Manage Contacts permissions can retrieve contacts. You can override the permissions by setting the suppressAuth option to true.
Method Declaration
Copy
function getContact(contactId: string, options: AuthOptions): Promise<Contact>;
Method Parameters
contactIdstringRequired

ID of the contact to retrieve.


optionsAuthOptions

Authorization options.

Returns
Return Type:Promise<Contact>
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myGetContactFunction = webMethod(Permissions.Anyone, () => { const contactId = "bc0ae72b-3285-485b-b0ad-c32c769a4daf"; const options = { suppressAuth: false, }; return contacts .getContact(contactId, options) .then((contact) => { return contact; }) .catch((error) => { console.error(error); }); }); /* Promise resolves to: * { * "_id": "bc0ae72b-3285-485b-b0ad-c32c769a4daf", * "_createdDate": "2021-03-30T13:12:39.650Z", * "_updatedDate": "2021-03-30T13:12:39.650Z", * "revision": 0, * "info": { * "name": { * "first": "Gene", * "last": "Lopez" * }, * "birthdate": "1981-11-02", * "company": "Borer and Sons, Attorneys at Law", * "jobTitle": "Senior Staff Attorney", * "labelKeys": [ * "custom.white-glove-treatment", * "contacts.contacted-me", * "custom.new-lead" * ], * "locale": "en-us", * "emails": [ * { * "_id": "5bdcce4a-37c2-46ed-b49c-d562c6e3c4ce", * "tag": "HOME", * "email": "gene.lopez.at.home@example.com", * "primary": true * }, * { * "_id": "78e5f398-e148-448d-b490-7c0b7d2ab336", * "tag": "WORK", * "email": "gene.lopez@example.com", * "primary": false * } * ], * "phones": [ * { * "_id": "820e4640-ffe0-4980-a097-62a715e73135", * "tag": "MOBILE", * "countryCode": "US", * "phone": "(722)-138-3099", * "primary": true * }, * { * "_id": "8506549e-e4f8-42f6-b6fc-9db155b582ef", * "tag": "HOME", * "countryCode": "US", * "phone": "(704)-454-1233", * "e164Phone": "+17044541233", * "primary": false * } * ], * "addresses": [ * { * "address": { * "formatted": "9834 Bollinger Rd\nEl Cajon, WY 97766\nUS", * "location": { * "latitude": 84.1048, * "longitude": -116.8836 * }, * "city": "El Cajon", * "subdivision": "US-WY", * "country": "US", * "postalCode": "97766", * "streetAddress": { * "name": "Bollinger Rd", * "number": "9834", * "apt": "" * } * }, * "_id": "8532051f-91f2-42d9-9a97-9f2c39e64f7a", * "tag": "HOME" * } * ], * "profilePicture": "https://randomuser.me/api/portraits/men/0.jpg", * "extendedFields": { * "contacts.displayByLastName": "Lopez Gene", * "emailSubscriptions.deliverabilityStatus": "NOT_SET", * "emailSubscriptions.subscriptionStatus": "NOT_SET", * "custom.event-we-met-at": "LegalBigData", * "emailSubscriptions.effectiveEmail": "gene.lopez.at.home@example.com", * "contacts.displayByFirstName": "Gene Lopez" * } * }, * "lastActivity": { * "activityDate": "2021-03-30T13:12:39.649Z", * "activityType": "CONTACT_CREATED" * }, * "primaryInfo": { * "email": "gene.lopez.at.home@example.com", * "phone": "(722)-138-3099" * }, * "source": { * "sourceType": "OTHER" * } * } */
Did this help?

getExtendedField( )


Retrieves an extended field.

The getExtendedField() function returns a Promise that resolves when the extended field is retrieved.

Note: Only visitors with Manage Contacts permissions can retrieve extended fields. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function getExtendedField(
  key: string,
  options: AuthOptions,
): Promise<ExtendedField>;
Method Parameters
keystringRequired

Extended field ID .

When accessing contact data, extended field values are available at extendedFields[key]. For example, if the key is "custom.notes", the value can be accessed at extendedfields["custom.notes"].

Once set, key cannot be modified, even if displayName changes.


optionsAuthOptions

Authorization options.

Returns
Return Type:Promise<ExtendedField>
Get an extended field
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myGetExtendedFieldFunction = webMethod(Permissions.Anyone, () => { const fieldKey = "custom.event-name"; const options = { suppressAuth: false, }; return contacts .getExtendedField(fieldKey, options) .then((extendedField) => { return extendedField; }) .catch((error) => { console.error(error); }); }); /* * Promise resolves to: * * { * "_createdDate": "2021-01-19T21:41:39Z", * "_updatedDate": "2021-01-19T21:41:39Z" * "namespace": "custom", * "key": "custom.event-name", * "displayName": "Event Name", * "dataType": "TEXT", * "fieldType": "USER_DEFINED", * } */
Did this help?

getLabel( )


Retrieves a label.

The getLabel() function returns a Promise that resolves when the specified label is retrieved.

Note: Only visitors with Manage Contacts permissions can retrieve labels. You can override the permissions by setting the suppressAuth option to true.

Method Declaration
Copy
function getLabel(key: string, options: AuthOptions): Promise<Label>;
Method Parameters
keystringRequired

Label key.

key is generated when the label is created and cannot be modified, even if displayName changes.


optionsAuthOptions

Authorization options.

Returns
Return Type:Promise<Label>
Get a label
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { contacts } from "wix-crm-backend"; export const myGetLabelFunction = webMethod(Permissions.Anyone, () => { const labelKey = "custom.active-customer"; const options = { suppressAuth: false, }; return contacts .getLabel(labelKey, options) .then((label) => { return label; }) .catch((error) => { console.error(error); }); }); /* * Promise resolves to: * * { * "_createdDate": "2021-01-20T00:31:41Z", * "_updatedDate": "2021-01-20T00:31:41Z" * "namespace": "custom", * "key": "custom.active-customer", * "displayName": "Active Customer", * "labelType": "USER_DEFINED" * } */
Did this help?