Retrieving the Zendesk user id of a call-center agent
You can associate each agent in the call center with a corresponding user profile in Zendesk Support. This enables the telephony system to retrieve the Zendesk user id of any call-center agent to link the agent to tickets in Support. It also allows the system to use any Zendesk API that requires user ids.
You have two options for storing mappings of call-center agents to Support agents:
- Storing the mappings in the telephony system
- Storing the mappings in Zendesk Support
Storing the mappings in the telephony system
If the telephony system supports it, you can store the Zendesk user id of an agent in the agent's user record in the system. When the system makes an API request involving a call-center agent, it can look up the agent's corresponding Zendesk user id.
Storing the mappings in Zendesk Support
With this option, you store a unique agent identifier from the telephony system in the agent's user profile in Support. When the telephony system makes an API request involving the call-center agent, it can make a preliminary API request to get the agent's Zendesk user id by searching for the user who has the unique identifier.
The unique identifier can be any type of data stored in the telephony system, as long as it's unique per call-center agent. For example, the identifier could be the agent's phone extension or call center software login ID.
Storing the mappings
-
Before you start, make sure each call-center agent has a user profile in Support. See Adding agents and administrators in Zendesk help.
-
In Support, create a custom user field for the unique identifier. For instructions, see Adding custom fields to users in Zendesk help. You can also use the User Fields API to create the custom field.
The custom user field is used to store the unique identifiers of call-center agents in their Zendesk user profiles.
-
After creating the custom user field, use the admin interface or the Users API to populate the field with the unique identifier of each call-center agent. This creates the mappings.
Retrieving the Zendesk user id of a call-center agent
After creating the mappings, use the Search API to search for a user with the agent's unique identifier from the telephony system to get their corresponding Zendesk user id.
Use the following query format to search for the user with the unique identifier:
query=type:user+{custom_field_name}:{unique_identifier}
Example
curl https://example.zendesk.com/api/v2/search.json?query=type:user+CallCenterAgentID:1234 \
-v -u {email_address}/token:{api_token}
The response returns a JSON object that includes the Zendesk user id. See JSON Format in the Search API docs.