zendesk/zendesk_api_client_rb

Remove duplicate user phone numbers / disconnect between application and API

Closed this issue · 1 comments

Hello! My company has a lot of phone records that lack a +1 at the front, and we need to delete them. I was about to write a script that updates their records in zendesk but I noticed that the api (or at least the ruby client) returns a single string for the phone number. I am seeing however for the same user, multiple phone numbers like so:
Screenshot from 2022-02-16 17-11-05
However the API only returns a string from client.users.find(id: 12345).phone

How might I remove the old phone numbers that don't have to +1 in them so that each record has no more than one phone number?

In case anyone finds this, the proper place to update a user's phone number is through the user.identities association. The user endpoint returns a single phone number and updating it through the user api will add an identity. to actually change or delete a phone number you need to hit the api/v2/users/:id/identities endpoints