1. Help Center
  2. Enhanced Integrations & APIs
  3. Centercode Guides to Endpoint Specific Systems

How to delete user accounts through API integrations

Adhere to company user privacy guidelines, GDPR compliance, offboarding employees, etc.

Centercode offers External Listeners to allow your API-capable third-party system to programmatically trigger automation within Centercode. In this example, we’ll cover how your third-party system can send a HTTP POST webhook to trigger a Centercode Macro to delete specific user accounts within your Centercode implementation in order to adhere to user account deletion requests, as well as strict privacy or GDPR compliance. 

In this guide, you will:

  1. Create (or identify) an API Key in Centercode
  2. Create a User Macro in Centercode
  3. Create a User External Listener in Centercode
  4. Create a Webhook to trigger from your third-party system

In order to configure both sides of this integration, you will need:

  • Access to an existing API Key or Community Manager access to create a new one
  • An administrator account or assistance from your third-party system

1.   Creating an API Key

From the Centercode side, the first step in any API integration is to ensure that you have an API Key available within your Centercode Community. API Keys are used to track and control how API endpoints are accessed and can be leveraged by multiple simultaneous API integrations. If one is already created and available for use, you may continue past this step.

If necessary, create a Community API Key by following steps outlined here.

-

2.   Creating a User Macro to delete user accounts

User Macros allow you to create a single instruction that includes a set of actions to complete a desired task. In this example, we’ll select user accounts that will be deleted from your Centercode implementation.

From your Community Homepage:

  1. Click your company logo located at the top-left of your homepage
  2. Hover over Community Administration and click Users
  3. Click the User Resources button
  4. Click the Create a Macro button
  5. Create a descriptive (internally facing) name for your Macro
  6. Under Macro Options, select Remove User Completely and follow the prompt
    • “Include Removed User on Dashboard” is optional and refers to adding removed user metrics to your Opt-Out Dashboard
    • “Show in User Management Actions” refers to the option to use this Macro manually in User Management’s Actions menu
    • “Only Run Once Per User” refers to the Macro only executing once ever on the user. In this example, if a user is removed using this macro and rejoins your Community, this Macro will not execute on them again.
    • “Suppress Confirmation” refers to skipping the confirmation message when running Macros manually
  7. Click Submit 

You’ve just created your User Macro that deletes user accounts. Your next step is to create the External Listener that will listen for your third-party’s POST webhooks to tell Centercode to trigger this macro on specific users.

-

3.   Creating an External Listener

Now that you’ve created the Macro telling Centercode what to do, you’ll need to set up how it’s triggered. An External Listener is effectively an API endpoint created by Centercode that your third-party system reaches out to. This provides a path for that system to interact with your Centercode site for a predetermined purpose - in this case, to trigger the above User Macro and delete users.

After creating the Macro above (from User Resources):

  1. Click User Automation
  2. Click Create an External Listener
  3. Create an (internally-facing) name
  4. Add a simple key to help identify this External Listener (ex: “deleteuser”)
  5. (Optional, but important) Add a Filter
    • This refers to limiting users in which the User Macro executes on; the External Listener will only trigger if the user is within the filter results
      • For example, you can filter for the Customers team if you want only that team to have users deleted from your Centercode implementation. This protects other teams (like your administrative team) from being deleted by mistake if your third-party system sends an administrator email address to be deleted. 
  6. Under Listener Type dropdown, select Macro Execution
  7. Select the User Macro you’ve just created
  8. Copy / Save the provided API Endpoint URL (needed in Section 4 below)
  9. Click Submit 

You’ve just created your External Listener!

-

4.   Configure a Webhook in your Third-Party System:

You’ll now need to add a Webhook in your third-party system to connect to the External Listener’s API endpoint to perform its associated macro to delete targeted users. In order to do that, you’ll need to verify Webhooks are capable and enabled within that system. 

Here’s an example of how to enable Webhooks in Atlassian Jira (Atlassian Support Documentation). Please note: enabling Webhooks requires global administrator access in Jira.

From your Jira instance:

  1. Click on Settings (screenshot)
  2. Click on System (screenshot)
  3. Scroll down to Advanced and click Webhooks (screenshot)
  4. Click Create a Webhook (screenshot)
  5. Add your API Endpoint URL from your Centercode External Listener
  6. Replace the placeholder of VALUE with the email address of the user you would like to delete from your Centercode implementation

Example:

https://example.centercode.com/api/v1/userMacroListeners/demo?find=jim@centercode.com&apiKey=example807d5ea237a4e0bbd7fe216893adef2

-

Notes

  • The values included in the API Endpoint URL in Section 4.6 are critical to the success of your integration and correspond to the following:
  • listener_key - the value that targets your External Listener in order to trigger the desired action within Centercode (“deleteuser” in Section 3)
  • find= - targets the user account within Centercode. Your third-party system that is sending webhooks to your Centercode External Listener will need to dynamically insert the appropriate email address.
  • prefix-community_API_key - refers to the Community API Key from Section 1 above
  • Filters in External Listeners refer to limiting users in which the User Macro executes on. In other words, the External Listener will only trigger if the user is within the filter results
    • For example, you can filter for the Customers team if you want only that team to have users deleted from your Centercode implementation. This protects other teams (like your administrative team) from being deleted by mistake if your third-party system sends an administrator email address to be deleted.