wix-crm-backend: Is this api active?

I have tried to make use of this api to effect a triggered Guest email exchange.
Despite following the api guide I am constantly getting the following error:
server responded with 400 - {“message”:“Bad Request”}
The back end code I am using is:
import wixData from ‘wix-crm-backend’;
export function backendCrmCreate(first, last, email, phone, a_label, newDate) {
let contactRecord = {
‘firstName’:first,
‘lastname’:last,
‘labels’:[‘a_label’],
‘emails’:[email],
‘phones’:[phone],
‘newDateField’: newDate
};
console.log(contactRecord);
// Inorder to send emails to this customer we need to have a crm record.
// We will create one for this purpose
return wixCRM.createContact(contactRecord)
.then((contactId) => {
do stuff
return Promise.resolve(result);
})
.catch((error) => {
console.log(error);
});
}
Apart from anything else, this is not very helpful and doesn’t help me figure out what is broken.
The crm and crm-backend api’s I expected to behave in a similar way to wix-data. i.e. user authentication is required to use crm api calls on front end code and admin privileges are automatic for backend code (or authentication is supressed).
In addition because of the lack of a Single Sign On/ unique record capability (e.g. only one record can contain a given email), the crm can contain duplicate records for contacts. This (I am sure) would make it difficult for the existing crm api to work effectively without either generating new records or getting confused about which record to return (unless it defaults to Member records).
Any feedback would be helpful

1 Like

Believe it or not, I’m still having a very similar error message. Did you ever figure it out?

Are you using live or preview?

Wix CRM cannot be used for logged in members so if you are in preview it will fire that error :slight_smile:

Ha! Exactly that Scott. I had figured it out the hard way later that day through trial and error, and now it’s working.

Thanks!