Delete users
Remove users permanently with delete() or deleteUser().
delete()- call on aUserobject (no ID needed)deleteUser()- call on aChatobject (requires user ID)
Requires App Context
Enable App Context in the Admin Portal to store user data.
Method signature
These methods take the following parameters:
-
delete()1user.delete(): Promise<true> -
deleteUser()1chat.deleteUser(id: string): Promise<true>
Input
| Parameter | Required in delete() | Required in deleteUser() | Description |
|---|---|---|---|
idType: stringDefault: n/a | No | Yes | Unique user identifier (up to 92 UTF-8 characters). |
Output
| Type | Description |
|---|---|
Promise<true> | For delete(), a confirmation that the user metadata was permanently deleted. |
Promise<true> | For deleteUser(), a confirmation that the user metadata was permanently deleted. |
Errors
Whenever the user ID is obligatory, and you try to delete a user without providing their ID, you will receive the ID is required error.
Sample code
Permanently delete user support_agent_15.
-
delete()1// reference the "user" object
2const user = await chat.getUser("support_agent_15")
3// permanently delete the user
4await user.delete() -
deleteUser()1// reference the "chat" object and invoke the "deleteUser()" method
2const user = await chat.deleteUser("support_agent_15")