The wix-crm-backend module contains functionality for working with your site's contacts from backend code.

To use the CRM API, import wixCRM from the wix-crm-backend module:

   import wixCRM from 'wix-crm-backend';

Table of Contents


Perform actions on an object.
createContact( )Creates a new contact or updates an existing contact.

createContact( )

Creates a new contact or updates an existing contact.


The createContact() function returns a Promise that resolves to the newly created or updated contact's ID when the contact has been created or updated.

The passed ContactInfo object must contain at least one email address or phone number.

Calling createContact() performs one of the following. (The contact information specified in the contactInfo parameter matches an existing contact if it contains an email address or phone number from an existing contact.) + If there is no matching existing contact, a new contact is created using the information specified using the contactInfo parameter. + If there is a matching existing contact, it is updated with the information specified using the contactInfo parameter. Any existing contact information that is not explicity overriden in the contactInfo parameter retains its existing value.


function createContact(contactInfo: ContactInfo): Promise<string>
The kind of data the property stores.
The information for the contact being created or updated.
Value that a function evaluates to when it is finished running.

Fulfilled - The ID of the new or updated contact. Rejected - Error message.


Create a new contact

This example contains a backend function that creates a new contact and returns the new contact's ID to the code that called the function.

import wixCRM from 'wix-crm-backend';

export function myBackendFunction(firstName, lastName, email, phone) {
  return wixCRM.createContact( {
    "firstName": firstName,
    "lastName": lastName,
    "emails": [email],
    "phones": [phone]
  } );