Automatically assign the appropriate task custom object to tickets previously marked as common‑tasks by updating the dedicated custom field.
- Retrieve tickets – Use
Invoke-ZendeskApiCall.ps1with a search query that returns tickets of typetaskand the custom field indicating they are common‑tasks. - Load task definitions – Parse
custom-objects.jsonto obtain the list of task objects (id, name, optional keywords). - Extract candidate phrases – For each ticket, combine
subjectanddescription, tokenize, remove stop‑words, and generate n‑grams. - Match to task objects – Compare ticket phrase set with each task’s keyword set (or with the task name/description) using a simple similarity metric (e.g., Jaccard). Choose the highest‑scoring task above a configurable threshold.
- Update ticket – Call
Invoke-ZendeskApiCall.ps1withPUT /api/v2/tickets/{id}.jsonto set the custom field that references the matched task object. - Logging – Write a CSV (
TaskAssignmentLog.csv) containing TicketId, MatchedTaskId, Score, and Timestamp for audit and later review.
- The script queries the ticket schema at runtime, so changes to field names or custom‑field IDs do not require code changes.
- Adding a new task only requires updating
custom-objects.jsonwith its keywords; the next run will automatically consider it. - The similarity threshold can be tuned based on manual review of the generated log.
- Implement
Get-CommonTaskTickets.ps1(fetch tickets). - Implement
Get-TaskPhrases.ps1(phrase extraction). - Implement
Update-TaskCustomField.ps1(matching + custom‑field update). - Run the end‑to‑end flow on a test set and review
TaskAssignmentLog.csv.
All scripts follow the existing PowerShell style (parameter validation, Test-ZendeskEnvironment, verbose progress).