This guide sets up a Bosbec workflow that finds and deletes Freshdesk tickets in bulk. It is useful when test emails, spam, or another mistake has created more tickets than is practical to remove through the Freshdesk interface.
The workflow selects tickets by sender and subject, stores each match as a Bosbec unit, and then deletes the selected tickets through the Freshdesk API. You can use it directly with Freshdesk or adapt the same pattern to another ticketing system.
Because deletion is destructive, start with narrow search criteria and inspect the resulting units before running the delete process.
What you will build
The Freshdesk: Delete Tickets workflow contains two triggers:
| Trigger | Purpose |
|---|---|
| Find tickets | Finds Freshdesk tickets that match the configured sender and subject, then stores each result as a unit. |
| Delete tickets | Finds marked ticket units, deletes the corresponding tickets from Freshdesk, and clears their deletion flag. |
Before you start
- A Freshdesk account with access to the Freshdesk API.
- Your Freshdesk API key. In Freshdesk, open your profile to find it.
- A Bosbec group in which the workflow can store ticket units.
- The Freshdesk group ID and your Freshdesk domain name.
For example, if your Freshdesk URL is:
https://YOUR_DOMAIN.freshdesk.com
use YOUR_DOMAIN as the domain value.
Import the workflow
Open Workflow Builder and navigate to View > Workflow Library.
Find and import the template named Freshdesk: Delete Tickets.
If you created your account using the button on this page, you may already have selected this template when launching Workflow Builder and can skip this step.
Add the Freshdesk configuration
In Workflow Builder, open Edit > Workflow Settings and select Custom Settings & Secrets.
Add the following secret:
| Key | Value |
|---|---|
freshdesk_api_key |
The API key from your Freshdesk profile |
The workflow uses this secret to create Basic Authentication for its Freshdesk API requests. Keep the API key in secrets instead of entering it directly in an HTTP request job.
Add these custom settings:
| Key | Value |
|---|---|
freshdesk_ticket_group_id |
The ID of the Bosbec group where ticket units will be stored |
freshdesk_domain |
Your Freshdesk domain name, without .freshdesk.com |
In Workflow Settings, also increase the number of jobs the workflow is allowed to run. Finding and deleting tickets can start many jobs, especially when the workflow processes several pages of results.
Configure which tickets to find
Open the Find tickets route and update both of its selection conditions:
- In job_1, replace the sender address with the email address whose tickets you want to remove.
- In job_7, replace the subject with the ticket subject you want to remove.
The default route requires both values to match. If your cleanup needs different conditions, modify the route before running it. For example, you could select tickets by creation date, ticket content, status, or another field returned by the Freshdesk API.
Keep the first test as specific as possible. A unique sender and subject make it easier to verify that the workflow has selected only the intended tickets.
Find and inspect the tickets
Run the Find tickets trigger.
The workflow retrieves up to 100 tickets per page. The imported template checks five pages, for a maximum of 500 tickets. Increase the configured number of pages if the tickets you need to remove may appear later in the result set.
Each matching Freshdesk ticket is represented by a unit in the group configured by freshdesk_ticket_group_id. The unit contains the ticket ID, creation date, and these metadata keys:
| Metadata key | Value | Purpose |
|---|---|---|
to_be_deleted |
true |
Marks the ticket for the delete process. |
freshdesk_ticket_unit |
true |
Identifies the unit as a Freshdesk ticket record. |
Before continuing, inspect the created units and confirm that their ticket IDs, sender, subject, and creation dates match the tickets you intend to remove.
Delete the selected tickets
Run the Delete tickets trigger only after you have inspected the selected units.
The trigger searches your Bosbec account for units where both of these conditions are true:
to_be_deleted = true
freshdesk_ticket_unit = true
It processes up to 100 matching units at a time and calls the Freshdesk API to delete each corresponding ticket. After a ticket has been handled, the workflow updates its unit with:
to_be_deleted = false
Clearing the flag prevents the same unit from being included in the next deletion run. Run Delete tickets again if more than 100 units are still marked for deletion.
Test it
- Configure a sender and subject that match a small set of disposable test tickets.
- Run Find tickets.
- Inspect the units created in the configured group.
- Confirm in Freshdesk that the ticket IDs belong to the intended test tickets.
- Run Delete tickets.
- Confirm that the tickets were deleted in Freshdesk and that
to_be_deletedis nowfalseon the corresponding units.
If no units are created, check the sender and subject values, the freshdesk_domain setting, and the API key. If only some tickets are found, increase the number of pages checked by the Find tickets route. If jobs stop before processing all results, increase the workflow's job limit.
Extend the solution
Because the cleanup is implemented as a Bosbec workflow, you can modify the selection and deletion process to fit another incident or system.
- Add a creation-date range so only tickets from a specific test run are selected.
- Match ticket content, status, priority, or another Freshdesk field.
- Add a manual approval flag before units become eligible for deletion.
- Schedule repeated deletion runs when more than 100 ticket units are marked.
- Replace the Freshdesk requests with another ticketing system's API while keeping the same find, inspect, and delete pattern.