Recent searches
No recent searches

Support team
Joined Oct 16, 2021
·
Last activity Oct 10, 2023
Following
1
Follower
1
Total activity
55
Votes
25
Subscriptions
14
ACTIVITY OVERVIEW
BADGES
ARTICLES
POSTS
COMMUNITY COMMENTS
ARTICLE COMMENTS
ACTIVITY OVERVIEW
Latest activity by Support team
Support team commented,
+1
When will this be available?
View comment · Posted Mar 27, 2023 · Support team
0
Followers
0
Votes
0
Comments
Support team commented,
+1
When will this be available?
View comment · Posted Mar 27, 2023 · Support team
0
Followers
0
Votes
0
Comments
Support team commented,
Is there any update on this limitation ?
View comment · Posted Mar 10, 2023 · Support team
0
Followers
0
Votes
0
Comments
Support team created a post,
Deleting a lot of tickets from your Zendesk instance can be a daunting task, especially if you have thousands of tickets that need to be removed. Fortunately, using Python and the Zendesk API, you can automate this process and save yourself a lot of time and effort.
Here are some tips and tricks to help you delete a lot of tickets from your Zendesk instance using Python and the Zendesk API:
-
Use the Zendesk API to retrieve the list of tickets that you want to delete. You can use filters to narrow down the list of tickets based on certain criteria, such as their status, tags, or creation date.
-
Once you have retrieved the list of tickets, loop through it and delete each ticket using the Zendesk API. Make sure to use the bulk delete endpoint to delete multiple tickets at once, as this will save you a lot of time.
-
Keep track of the progress of the deletion process by printing out the number of tickets that have been deleted and the number of tickets that are still left to delete. This will help you monitor the process and ensure that everything is going smoothly.
-
If you encounter any errors or issues during the deletion process, use the error handling mechanisms in Python to handle them gracefully. For example, you could log the error messages to a file or send them to an email address for further analysis.
-
Finally, test your Python script on a small subset of tickets before running it on your entire Zendesk instance. This will help you identify any issues or unexpected behavior before you start deleting a large number of tickets.
In conclusion, using Python and the Zendesk API to delete a lot of tickets from your Zendesk instance can be a powerful way to automate a tedious and time-consuming task. By following these tips and tricks, you can ensure that the process goes smoothly and that your Zendesk instance stays clean and organized.
Here is the code I used:
import requests import time import base64 # Replace with your Zendesk subdomain and API credentials SUBDOMAIN = 'HERE' #add subdomain here EMAIL = 'user@domain.com' #add email here api key here API_KEY = '' #add api key here # Read the ticket IDs from a text file, one ID per line with open('ticket_ids.txt', 'r') as f: ticket_ids = f.read().splitlines() # Set the maximum number of tickets to delete per API request MAX_TICKETS_PER_REQUEST = 99 # Split the ticket IDs into batches of maximum size MAX_TICKETS_PER_REQUEST ticket_id_batches = [ticket_ids[i:i+MAX_TICKETS_PER_REQUEST] for i in range(0, len(ticket_ids), MAX_TICKETS_PER_REQUEST)] # Set up the API request headers with Basic authentication headers = { 'Content-Type': 'application/json', 'Authorization': f'Basic {base64.b64encode(f"{EMAIL}/token:{API_KEY}".encode("utf-8")).decode("ascii")}', } total_deleted_tickets = 0 last_successful_ticket_id = None # Loop over each ticket ID batch and delete the tickets for ticket_ids_batch in ticket_id_batches: # Construct the URL to delete the tickets url = f'https://{SUBDOMAIN}.zendesk.com/api/v2/tickets/destroy_many.json?ids={",".join(ticket_ids_batch)}' # Send the API request to delete the tickets with timeout of 60 seconds response = requests.delete(url, headers=headers, timeout=60) # Check if the request was successful if response.status_code == 200: num_deleted_tickets = len(ticket_ids_batch) total_deleted_tickets += num_deleted_tickets last_successful_ticket_id = ticket_ids_batch[-1] print(f'{num_deleted_tickets} tickets deleted successfully. Total deleted: {total_deleted_tickets}.') else: error_ticket_id = None if len(ticket_ids_batch) == 1: error_ticket_id = ticket_ids_batch[0] else: # Find the first ticket ID in the batch that was not deleted successfully response_json = response.json() for ticket_id in ticket_ids_batch: if str(ticket_id) not in response_json['results']: error_ticket_id = ticket_id break print(f'Error deleting tickets. Last successful ticket ID: {last_successful_ticket_id}. Error ticket ID: {error_ticket_id}. Response: {response.text}') break # Print a loader to indicate that the code is still running for i in range(5): print('.', end='', flush=True) time.sleep(1) print() # Wait for 10 seconds before sending the next request time.sleep(10)
I added a new variable last_successful_ticket_id to keep track of the ID of the last ticket that was deleted successfully. If an error occurs during the deletion of a batch of tickets, the code will print the ID of the last successful ticket and the ID of the ticket where the error occurred.
Note that if a batch contains only one ticket and an error occurs, the code will assume that the error occurred with that ticket. Otherwise, it will check the API response to determine which ticket in the batch was not deleted successfully. If an error occurs, the code will break out of the loop and stop deleting tickets, so you will need to manually modify the list of ticket IDs to start from the last successful ticket ID and run the code again.
You can use it as is for our own purposes.
Posted Mar 10, 2023 · Support team
5
Followers
4
Votes
1
Comment
Support team commented,
hi Jan Urban! What ticketing system you are using now for support?
View comment · Posted Oct 07, 2022 · Support team
0
Followers
0
Votes
0
Comments
Support team created a post,
Hello Zendesk Team!
Most of our agents work simultaneously with several chats, over time this number can reach up to 8. But in the agent workspace interface, after opening more than 4-5 chats, they are minimized and you can see them all only by clicking on the "More" button. This is not very convenient.
Are you considering flexible layout for chats?
Thank you!
Posted Mar 21, 2022 · Support team
4
Followers
4
Votes
2
Comments
Support team created a post,
Hello, Zendesk Team!
Our team leads in the old version of chats (not in the agent workspace) had the rights to ban a user in the chat - directly from the chat window. When switching to agent workspace , this feature was lost, leaving only the ability to ban a user by IP address. But this is very inconvenient and does not always work correctly.
In ticket #10087547 we got the final answer about ban users: "In the agent workspace, we can not ban users, only through the IP address."
Do you plan to add the ability to quickly ban users directly in chats/messaging in agent workspace?
Posted Mar 17, 2022 · Support team
19
Followers
23
Votes
13
Comments
Support team created a post,
Hello, Zendesk Team!
In our agents workflow - we need to create follow up ticket after the ticket was solved in Agent
Workspace. (Btw this article is already read)
In old version of chats, we can create tickets directly and assign ignt them to another agent.
In Agent workspace, we only can create follow-up after the ticket is solved.
Do you plan to add the ability to quickly create a follow up ticket (with ticket history) to assign it to another agent?
Posted Mar 17, 2022 · Support team
4
Followers
4
Votes
1
Comment
Support team commented,
Hello! any updates of this feature? Perhaps we can see a lot of views this year?
View comment · Posted Feb 09, 2022 · Support team
0
Followers
0
Votes
0
Comments
Support team commented,
Hi Dan Nolan !
Thank you for reply. "Five Most Recent" app work normally with customers without emails (I think no)?
I'm looking to zendesk external_id , but Zendesk doesn't give to me any cases about using external_in. "Just go to read manuals"
View comment · Posted Jan 28, 2022 · Support team
0
Followers
0
Votes
0
Comments