Delete users

Two DeleteUser() methods let you permanently remove an existing user from the App Context storage ("hard delete").

Both of these methods give the same output. The only difference is that you call a given method either on the Chat or the User object. Depending on the object, these methods take a different set of input parameters - you either have to specify the user ID you want to delete or not because it's already known.

Requires App Context

To store data about users, you must enable App Context for your app's keyset in the Admin Portal.

Method signature

These methods take the following parameters:

  • DeleteUser() (on the User object)

    user.DeleteUser()
  • DeleteUser() (on the Chat object)

    chat.DeleteUser(
    string userId
    )

Input

ParameterTypeRequired in the User objectRequired in the Chat objectDefaultDescription
userIdstringNoYesn/aUnique user identifier (up to 92 UTF-8 characters).

Output

These methods don't return any data.

Basic usage

Delete the user with an ID of support_agent_15.

  • DeleteUser()

    if (!chat.TryGetUser("support_agent_15", out var user))
    {
    Console.WriteLine("Couldn't find user!");
    return;
    };
    user.DeleteUser()
  • DeleteUser()

    chat.DeleteUser("support_agent_15")
Last updated on