Search.../

deleteContact( )

Developer Preview

Deletes a contact who is not a site member or contributor.

Description

The deleteContact() function returns a Promise that resolves when the specified contact is deleted.

Deleting a contact permanently removes them from your Contact List.

If the contact is also a site member, the member must be deleted first, and then the contact can be deleted.

Admin Method

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

Syntax

function deleteContact(contactId: string): Promise<void>

deleteContact Parameters

NAME
TYPE
DESCRIPTION
contactId
string

ID of the contact to delete.

Returns

Return Type:

Promise<
void
>

Was this helpful?

deleteContact example

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