Delete users
Remove users with DeleteUser(). Choose between permanent deletion or soft delete (preserving data in App Context storage).
DeleteUser()onUser- call on aUserobject (no ID needed)DeleteUser()onChat- 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:
-
DeleteUser()(on theUserobject)1user.DeleteUser(bool soft = false) -
DeleteUser()(on theChatobject)1chat.DeleteUser(
2 string userId,
3 bool soft = false
4)
Input
| Parameter | Required in User object | Required in Chat object | Description |
|---|---|---|---|
userIdType: stringDefault: n/a | No | Yes | Unique user identifier (up to 92 UTF-8 characters). |
softType: boolDefault: false | No | No | Define if you want to permanently remove user metadata. The user metadata gets permanently deleted from the App Context storage by default. If you set this parameter to true, the user's IsDeleted property is set to true, and you can still restore/get their metadata. |
Output
| Type | Description |
|---|---|
Task<ChatOperationResult> | Returned Task that you can await to get the result of the delete operation. |
Sample code
Permanently delete user support_agent_15.
-
DeleteUser()(on theUserobject)1 -
DeleteUser()(on theChatobject)1
Other examples
Archive (soft delete) the user with an ID of support_agent_15, keeping their data in the App Context storage.
1