Search.../

deleteContact( )

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.

Note: This function replaces the deprecated wixCrmBackend.deleteContact(). The deprecated function will continue to work, but it will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.

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.

Note: Only visitors with Manage Contacts permissions can delete contacts. You can override the permissions by setting the suppressAuth option to true.

Syntax

function deleteContact(contactId: string, [options: AuthOptions]): Promise<void>

deleteContact Parameters

NAME
TYPE
DESCRIPTION
contactId
string

ID of the contact to delete.

options
Optional
AuthOptions

Authorization options.

Returns

Return Type:

Promise<void>

Was this helpful?

Delete a contact

Copy Code
1import { contacts } from 'wix-crm-backend';
2
3export function myDeleteContactFunction() {
4 const contactId = "43fd5f9e-d7d4-4a31-8bfc-3bdc180cc40a";
5 const options = {
6 suppressAuth: false
7 };
8
9 return contacts.deleteContact(contactId, options)
10 .then(() => {
11 console.log("Contact deleted");
12 })
13 .catch((error) => {
14 console.error(error);
15 });
16}