How do I update the crm labels through the Corvid API? It appears that I can set the labels through wix-crm-backend via the ContactInfo object. Any help would be appreciated!
You just add it in an array just like the example in the Wix API reference for Wix CRM or through the Wix CRM Backend if you need to do it through backend code…
Create a new contact with custom fields
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
} );
Create a new contact with custom fields
import wixCrm from 'wix-crm-backend';
export function myBackendFunction(firstName, lastName, email, phone) {
return wixCrm.createContact( {
"firstName": firstName,
"lastName": lastName,
"emails": [email],
"phones": [phone]
} );
}
Syntax
type ContactInfo = {
firstName: string
lastName: string
picture: string
emails: Array
loginEmail: string
phones: Array
labels: Array
language: string
customFields: string | number | Date
Labels
Array
List of contact’s labels. Labels are used to organize contacts.
When setting the labels property, you can only list labels that already exist in your site’s Contacts List.
I’ve used similar in code as well as shown here.
$w("#PublicContactUs").onAfterSave(() => {
let name = $w('#publiccontactName').value;
let email = $w("#publiccontactEmail").value;
let subject = $w("#publiccontactSubject").value;
let message = $w("#publiccontactMessage").value;
let label = ["Contacted Us"];
$w("#NewSubscriber").onAfterSave(() => {
let name = $w("#newsubscriberName").value;
let email = $w("#newsubscriberEmail").value;
let privacyPolicy = $w("#newsubscriberPrivacy").value;
let label = ["Subscribed"];
Can wix-crm-backend updateContact function update the “labels”, too?