Please Help; createContact() API error (Wix Staff?)

@fernandust

You are basically just using this code.

import wixCRM from 'wix-crm';

// ...

let firstName = // get first name
let lastName = // get last name
let email = // get email address
let phone = // get phone number

wixCRM.createContact( {
  "firstName": firstName,
  "lastName": lastName,
  "emails": [email],
  "phones": [phone]
} )
.then( (contactId) => {
  // contact created
} );

Try using this code instead.

import wixCRM from 'wix-crm';

// ...

let firstName = // get first name
let lastName = // get last name
let email = // get email address
let phone = // get phone number

let contactInfo = {
  "firstName": firstName,
  "lastName": lastName,
  "emails": [email],
  "phones": [phone],
  //"customField1": "customValue1",
  //"customField2": "customValue2"
};

wixCRM.createContact(contactInfo)
.then( (contactId) => {
  // contact created
} );

// Take out "customField1 and customField2 lines if not using them.