Calling createContact() Returns Error 500

I added a simple Contact form to my page. The Submit button by default adds the user’s email address to the Wix Contacts list. I added the following click event to add some functionality. I want to send the user an email and then redirect the page to a different url.

I copied example code directly from the Wix Code pages to use createContact() to get a ContactID, and then try to call emailContact(). However, my code shown below fails on the call to createContact() .

The uninformative error message is also shown below. Any help is appreciated!


Error calling createContact(): internal_error, details: {} (500)

export function sendEmailButton_click(event, $w) {
    console.log('sendEmailButton clicked');
    const emailStr = $w("#email").value;
    console.log('email address entered = ' + emailStr);

    // 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 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.
   wixCRM.createContact( {
     "emails": [$w("#email").value]
   } )
   .then ( (contactId) => {
        console.log('createContact() successful');
        console.log('contactID: '+contactId);

        wixCRM.emailContact("assesstrigger", contactId) 
            .then( () => {
                console.log("Triggered email sent");
            } )
            .catch( (err) => {
            } );
    } )
    .catch( (err) => {
        console.log('Error calling createContact(): ' + err);
    } );


I am getting error 500 too when calling createContact. Here is the message:

Failed to load resource: the server responded with a status of 500 (Server Error).

I am getting it too.

server responded with 500 - {“message”:“internal_error, details: {}”,“details”:{“error”:“internal_error”,“category”:“internal_error”}}

Wix any thoughts?

New information:

createContact works in preview mode and delivers the desired results (except that the email is not sent - I am guessing this is because the email only works in published site?).
However once the site is published this is when the 500 status Server errors show up. This is using the exact same data after removing the new entry in the Contact List from the preview test.

Hi, everyone.
Sorry for delay. We are checking the issue and will inform you as soon as possible.
Thank you for feedback!

Hi everyone,

We’ll improve our error reporting on server-side ASAP so you could better understand what’s going on. Note that some APIs (namely wix-users and wix-crm) are inherently more sensitive for both your sites and the platform, thus some usage limitations might apply. We’ll try to clarify these limitations in docs as well.

Finally, it could be help to get your website’s url as well as page uri where problematic code resides, so we can better understand the issue.


Thank you! Eagerly awaiting a solution.

Thanks Tom and Ihor. The url of a simple form created to test contact adding is It also adds the contact in preview but not on the published web site.

Thanks Tom. Here’s the URL for my code…

It works in preview mode but fails when published.

Also Tom , Ihor you might want to check out my other post regarding Users.register(). It has a similar problem but in this case the exception had a stack trace which I included in the post. I suspect there imay be some interaction between the crm-backend and users-backend apis.

HI Wix team. Any news?

Same problem here. Super simple page and code, getting failure error 500.

Wix team this was originally reported 14 days ago - it’s not great that the Wix CRM module is so unstable with a trivial matter like sending an email.

Can you please update or escalate this as a P2?

I have added this as a ticket in wix support to see if they can escalate.

Hi all,

First, we apologize for the late response - this issue seemed to bounce between several people.
I’ve created a contact in several of the sites above and it seemed to work. In order to better understand the problem, please open your site in incognito mode and try to submit/createContact.
if it works, please look at known limitation #1 below. If it doesn’t - please share your site and page where your form/code is.

Here are two potential causes for createContact returning 500:

  1. multiple contact-creation per session (a known limitation) . currently, same browser session can only create contact once due to security reasons (a session is based on some cookies). we’re working on a proper solution to support multiple contacts creating per session (though it’s not the common use-case).
  2. invalid input . we’ve no ticed cases w here contact was created with ContactInfo JSON containing
"emails": [ null ]

which is invalid. therefore, please review your code to make sure invalid filters are being applied.


we should have a fix to the above in the following days. that is:

  1. your client code will able to create different different contacts per same session.
  2. a detailed, explicit and 400 error code will be thrown in case of invalid input.

Tom, hi! I’ve seen your user session yesterday. You couldn’t reproduce it on as I changed the code to save it directly in a collection - I couldn’t risk having the basic function of saving a user’s registration fail.
Thanks for the update re the upcoming fix. I will look to re-use Wix CRM once it’s done. Thanks!

Hi Tom:

What the client code can do with CRM information should be dependent upon authentication and role privileges.

For example: If I am authenticated as an admin then I should be able (as with backend wix-data) to suppress authentication of database updates. Hopefully this is in the planned ‘multiple’ contact creation capability.

It is also important to be able to read from the CRM (again if suitably authenticated).

Tom, thank you! So you know, currently I have to clear cookies in Chrome for Windows and Edge just to be able to successfully add a contact on the published site. Merely initiating a new browser session does not help.

invalid invocations to createContact/register (e.g. with invalid ContactInfo values) are now responded with 400 error code (part of the error message). We’re still working on explicit cause of error along with multiple contacts creation limitation.

Steve - notes taken. we will address authentication/authroization issues in docs.
Antony - yes, cookies deletion is required to initialize wix’s session.

Hi Tom: I have tested and it does appear to work. Two observations - I can still potentially create duplicates using this interface because I don’t have any way to grab a pre-existing record is to inform the API that I am performing an update. So unless I keep my own id copy (essentially duplicating data from the CRM) then I will probably continue to create duplicates unless the API guarantees to return the applicable record id when it finds a matching loginEmail address. Additionally I need to keep my own copy to validate that I am not overwriting critical information that might be in the CRM record.

I notice that if I create a new record using ‘loginEmail’ then the loginEmail is not added to the email list (arguably these should all be unique unless they are service email addresses like info@…) and the loginEmail address is not accessible in the Dashboard CRM UI :-(. Presumably I have to ensure that the email address is duplicated into the email list?

Additionally it would be great to have a Custom Field Name => record key translation algorithm (or a way to get the record schema). If I create a Custom Field called “Data ToBe Tested” what record key would I write to in the contactData object? “dataToBeTested”? “Data ToBe Tested”? “dataTobeTested”? I am using trial and error to figure this out :wink:

Tom, incase you haven’t noticed I posted a more detailed note on the Custom Field issue here: