intercom / intercom-go

Go Bindings For Intercom
https://developers.intercom.io/reference
Other
70 stars 78 forks source link

Deleting users by User ID rather than ID #44

Closed kujenga closed 5 years ago

kujenga commented 7 years ago

Version info

I would like to be able to delete a user through the user of a user_id query parameter, as described in the API documentation here: https://developers.intercom.io/reference#delete-a-user

Actual behavior

I have to retrieve the user entity first using client.Users.FindByUserID(intercomID), then delete it using the ID retrieved in the returned entity with client.Users.Delete(user.ID), adding an unnecessary step to the process.

choran commented 7 years ago

Hi @kujenga, Would you not have to retrieve the user_id in a similar way? I do get your point that you should have the option of getting a user via user_id as well as ID but I am not clear on how this would change the process that exists at the moment. i.e. you would still have to retrieve the user_id and then delete it? I could be missing something here so just wanted to double check with you

kujenga commented 7 years ago

Hey @choran, thanks for the reply!

I ran into this issue when adding code to handle deleting users from Intercom when they delete their account from our system. Perhaps I'm misunderstanding what you're suggesting, but the value of the user_id already matches what's in our internal database (we set it up this way when we create the user in Intercom), so there's no need to retrieve it from your API in the case we're dealing with as we already have it on hand.

choran commented 7 years ago

ah, ok, so when you create the users you have a unique ID that you use for the user_id and you store this on your own DB. As a result you dont need to query users to get this user_id so you could delete the user in one step. makes sense. I will look into this, unfortunately I cant provide a timeline here but let me check it out.

kujenga commented 7 years ago

That's correct! Since user deletion is a relatively infrequent event, an extra call isn't the worst thing in the world, but since it's in the underlying API already I figured I'd ask. Thanks!

choran commented 7 years ago

cool. Thanks for the clarification

choran commented 5 years ago

Just tidying up some older issues. As noted there is a work around here and hopefully it is an infrequent event so it is not causing too much of an extra step to call the user first. Will close this as a result