Search.../

createContact( )

Developer Preview

Creates a new contact.

Description

The createContact() function returns a Promise that resolves to the new contact when it is created.

The info parameter object must include a name, phone number, or email address. If all 3 of these parameters are missing, the contact won't be created.

By default, if the call contains an email already in use by another contact, the new contact won't be created. To override this behavior, set allowDuplicates in the options object to true.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function createContact(info: ContactInfo, options: CreateContactOptions): Promise<CreateContactResponse>

createContact Parameters

NAME
TYPE
DESCRIPTION
info
ContactInfo

Contact info.

options
Optional
CreateContactOptions

Create contact options.

Returns

Contact.

Return Type:

Promise<
CreateContactResponse
>
NAME
TYPE
DESCRIPTION
contact
Contact

Contact.

Was this helpful?

createContact example

Copy Code
1import { contacts } from 'wix-crm.v2';
2
3 async function createContact(info, options) {
4 try {
5 const result = await contacts.createContact(info, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13