I’m hitting a wall with the Genesys Cloud .NET SDK (v113.0.0) when trying to automate user offboarding. The business requirement is strict: remove the user’s login capability but keep all their historical calls and chats attached to their name for reporting.
The docs for DeleteUser say this:
“Deleting a user will also delete all data associated with the user, including their interactions.”
That sounds like a hard delete. But I found a workaround using the DeleteUserWithMask endpoint which allows masking. However, the .NET SDK doesn’t expose a direct DeleteUserWithMaskAsync method. I have to use the ApiClient directly.
Here is what I’ve tried:
var request = new HttpRequestMessage(HttpMethod.Delete, $"/api/v2/users/{userId}");
request.Headers.Add("X-Genesys-User-Mask", "true");
var response = await _genesysApiClient.HttpClient.SendAsync(request);
if (!response.IsSuccessStatusCode)
{
var errorContent = await response.Content.ReadAsStringAsync();
throw new Exception($"Failed to mask user: {response.StatusCode} - {errorContent}");
}
This returns a 204 No Content. The user shows up as “masked” in the admin UI. They can’t log in.
The problem is the downstream data. I ran a query against the /api/v2/analytics/users/summary endpoint for the last 30 days. The masked user’s data is gone. The interaction history is still there in the call logs, but the user object seems to be decoupled or nullified in the analytics tables.
I need the user object to persist for historical joins. Is there a different API flow? Should I be using the PATCH /api/v2/users/{userId} endpoint to set enabled to false instead?
I tried that, but the user still appears in active agent lists for WFM if they have a schedule. The docs are vague on the difference between “masked”, “disabled”, and “deleted” regarding data retention.
Anyone have a code snippet that actually preserves the user entity for analytics while stopping access? I’m using Azure Functions for this integration, so I need it to be deterministic.