Search.../

updateContact( )

Developer Preview

Updates a contact's properties.

Description

The updateContact() function returns a Promise that resolves when the specified contact's information is updated.

Each time the contact is updated, revision increments by 1. The existing revision must be included when updating the contact. This ensures you're working with the latest contact information, and it prevents unintended overwrites.

Admin Method

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

Syntax

function updateContact(contactId: string, info: ContactInfo, options: UpdateContactOptions): Promise<UpdateContactResponse>

updateContact Parameters

NAME
TYPE
DESCRIPTION
contactId
string

ID of the contact to update.

info
ContactInfo

Contact info.

options
Optional
UpdateContactOptions

Contact update options.

Returns

Updated contact.

Return Type:

Promise<
UpdateContactResponse
>
NAME
TYPE
DESCRIPTION
contact
Contact

Updated contact.

Was this helpful?

updateContact example

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