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 totrue
.
Syntax
function deleteContact(contactId: string, [options: AuthOptions]): Promise<void>
deleteContact Parameters
NAME
TYPE
DESCRIPTION
ID of the contact to delete.
Authorization options.
Returns
Return Type:
Was this helpful?
Delete a contact
1import { Permissions, webMethod } from 'wix-web-module';2import { contacts } from 'wix-crm-backend';34export const myDeleteContactFunction = webMethod(Permissions.Anyone, () => {5 const contactId = "43fd5f9e-d7d4-4a31-8bfc-3bdc180cc40a";6 const options = {7 suppressAuth: false8 };910 return contacts.deleteContact(contactId, options)11 .then(() => {12 console.log("Contact deleted");13 })14 .catch((error) => {15 console.error(error);16 });17});