The createContact() function not working

I was trying to send email to the contact in the (custom) registration process by calling createContact() first and then calling emailContact(). The createContact() didn’t work for me for some reason even with minimum code as:

wixCRM.createContact({
 "name": $w('#name').value,
 "email": $w('#email').value
 }).then((contactId) => {
console.log(contactId);

The JS debugging shows “bad request” no matter what I did.
Bad Request: please check the user inputs.

Hello, that function is deprecated. Rather than debug it further, I first suggest migrating to the new CRM function .

@amandam , the new CRM function works!

Yessss! Glad to hear it