Automatically suspend users


1 Comentários

  • Thomas Verschoren
    Community Moderator

    There are two approaches for this:

    1. Use a GDPR app from the Marketplace. 

    2. Use the Developer API

    With a GDPR app you can delete all data older than x years for compliance, accomplishing basically what you want, but they only often look at just users older than X, not users not active for more than X years.

    The other way to do this is by using the API.

    If you know anyone (or look at the Zendesk Partner page for local sources) that can do some coding they can do the following:

    GET /api/v2/users.json

    This returns all users, and for each user the last_login_at key shows you how old they are:

      "id":                    35436,
      "url":                   "",
      "name":                  "Johnny End User",
      "created_at":            "2009-07-20T22:55:29Z",
      "updated_at": "2009-07-20T22:55:29Z", 
    "last_login_at": "2011-05-05T10:38:52Z",
    .... } }

    You can then check if this value is more than 5 years and if so, use the ID of that user and do a 

    GET /api/v2/users/{user_id}/tickets/requested.json

    This will get all tickets for that specific user. If you check the key created_at for the last item in the array, you get the date of the oldest ticket they created.

      "id":               35436,
      "url":              "",
      "external_id":      "ahg35h3jh",
      "created_at":       "2009-07-20T22:55:29Z",
      "updated_at":       "2011-05-05T10:38:52Z",

    If that is more than 5 years old you can use the same user ID to do a

    DELETE /api/v2/users/{id}.json



    Mind, this is a quick and dirty way to accomplish what you need to do.


Por favor, entrar para comentar.

Powered by Zendesk