On this page

Delete users

Remove users with DeleteUser(). Choose between permanent deletion or soft delete (preserving data in App Context storage).

  • DeleteUser() on User - call on a User object (no ID needed)
  • DeleteUser() on Chat - call on a Chat object (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 the User object)

    1user.DeleteUser(bool soft = false)
  • DeleteUser() (on the Chat object)

    1chat.DeleteUser(
    2 string userId,
    3 bool soft = false
    4)

Input

ParameterRequired in User objectRequired in Chat objectDescription
userId
Type: string
Default:
n/a
No
Yes
Unique user identifier (up to 92 UTF-8 characters).
soft
Type: bool
Default:
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

TypeDescription
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 the User object)

    1
    
  • DeleteUser() (on the Chat object)

    1
    

Other examples

Archive (soft delete) the user with an ID of support_agent_15, keeping their data in the App Context storage.

1

Last updated on