How can I remove the WhatsApp phone number of an end-user profile?

Question

How do I delete a WhatsApp number from a user's profile? From the context panel of your ticket, the phone number appears in the WhatsApp field:

Answer

You can't remove WhatsApp numbers like other phone numbers from the UI. WhatsApp users are identified after they contact Zendesk for the first time, and their WhatsApp numbers are stored as an identity in the backend. No phone number appears from the end-user profile, but the WhatsApp number is still linked to that user.

To remove that number, developers can use the API and the User Identities endpoint.

To remove a WhatsApp number identity:

Locate the user_id from your browser after opening the profile of the user you want to edit. It is the long number in the URL:

Follow User Identities and build the path below. Replace yoursubdomain with your actual subdomain and user_id with the value you found:
https://yoursubdomain.zendesk.com/api/v2/users/user_id/identities

The existing identities for that user appear:

Delete the messaging type using Postman or any other tool with a DELETE request using this path. Gather the id to replace entity_id from the previous step, and replace yoursubdomain with your subdomain:

https://yoursubdomain.zendesk.com/api/v2/users/{user_id}/identities/entity_id.json

After running the API call, Postman displays this response:

After you delete that identity, the user profile no longer displays the number:

Disclaimer: This article is provided for instructional purposes only. Zendesk does not support or guarantee the code, which might become obsolete over time. Zendesk can't provide support for third-party technologies such as JavaScript, jQuery, or CSS. Post any issues you have in the comments section or try searching for a solution online.

For more information, see:

Why are some users not correctly identified when they message in through WhatsApp?

User Identities

Adding WhatsApp channels to the Agent Workspace