This is almost the exact sample wix-crm doc provide
I am running this code when http endpoint is trigger using wix-http module
so, when a zapier hit the http-function URL in http-function.js
it will run insContact function in contact.jsw file
all the data are been send to contact.jsw file
but still there is the error.
Error => “Bad Request: please check the user inputs.”
Logs
code
// contact.js
import wixCrm from 'wix-crm-backend';
export async function insContact(user) {
try {
console.log("ins Contact : " , user);
let {firstName, lastName, email} = user;
let contact = {
"firstName": firstName,
"lastName": lastName,
"emails": [email]
}
console.log("Contact : " , contact);
let contacted = await wixCrm.createContact(contact);
console.log("contacted : ", contacted)
return contacted;
} catch (err) {
console.log("Error : " , err.message);
}
}