Sign in
agent:

List Tickets resolved by a User in Zendesk

There was a problem that the LLM was not able to address. Please rephrase your prompt and try again.

This task involves generating a summary of all tickets that a specific user or agent has successfully resolved, providing a clear record of their contributions and performance in handling customer issues.

import zenpy from zenpy.lib.exception import ZenpyException # Credentials for Zendesk API creds = _get_creds(cred_label)['creds'] ZENDESK_EMAIL = creds['username'] ZENDESK_TOKEN = creds['password'] #ZENDESK_SUBDOMAIN = 'your-subdomain' # Initialize Zenpy client client = zenpy.Zenpy(email=ZENDESK_EMAIL, token=ZENDESK_TOKEN, subdomain=ZENDESK_SUBDOMAIN) def list_tickets_resolved_by_user(user_id): """ List tickets resolved by a specified user in Zendesk. Args: user_id (int): The ID of the user. Returns: List of ticket IDs resolved by the user. """ resolved_tickets = [] try: # Search for tickets that are resolved and were assigned to the given user for ticket in client.search(type='ticket', status='solved', assignee_id=user_id): resolved_tickets.append(ticket.id) if resolved_tickets: print(f"Resolved tickets by user {user_id}: {resolved_tickets}") else: print(f"No resolved tickets found for user {user_id}.") except ZenpyException as e: print(f"An error occurred while retrieving tickets: {e}") return resolved_tickets # Replace with a valid user ID #user_id = 16645863103762 list_tickets_resolved_by_user(user_id)
copied