App builder Recipe: Ticket Offer Audit | The place for Zendesk users to come together and share
Skip to main content
jhoan zabala
Nov 4, 2026 8:43 PM UTC

App builder Recipe: Ticket Offer Audit

A routing offer tells you who received the ticket, but what happened next?
This App Builder recipe creates Ticket Offer Audit, a read-only app for reviewing a ticket’s offer history.
For each offer, it checks whether that agent commented or updated the ticket before the next offer.


Use the prompt below to build and test it in your Zendesk instance:

 

**Mission:**

Build a Zendesk Nav Bar app named **“Ticket Offer Audit”** that allows an authorized user to enter a ticket ID and audit how Omnichannel Routing offered that ticket to agents.

The app must identify every `OfferedToEvent` recorded in the ticket audits and determine whether the offered agent subsequently interacted with the ticket.

Use Zendesk Garden components for styling, ZAF for the app framework, and Zendesk REST APIs for data. The app must be read-only.

**Action:**

- Display an input where the user can enter a Zendesk ticket ID.
- Add an **“Audit Ticket”** button.
- Validate that the ticket ID is a positive integer.
- Request all ticket audits using:

`GET /api/v2/tickets/{ticket_id}/audits.json`

- Handle pagination until all audit records have been retrieved.
- Preserve the exact chronological sequence using the order returned by the API, audit timestamps, and event order.
- Find every audit event where:

`type = "OfferedToEvent"`

- Read the offered agent ID from the event’s `assignee` property.
- Resolve agent IDs to agent names using the Zendesk Users API. Batch user requests whenever possible.
- Use the audit’s `created_at` value as the date and time of the offer.

**Correlation Rules:**

For each `OfferedToEvent`, create an evaluation window that:

- Starts immediately after that offer.
- Ends immediately before the next `OfferedToEvent`.
- If there is no subsequent offer, ends at the last available ticket audit.
- Only counts actions where the audit `author_id` matches the agent ID from the offer’s `assignee` property.
- Does not count actions performed by another agent, an end user, a trigger, an automation, an API integration, or the Zendesk system.

Set **“Comment”** to:

- **Yes** if the offered agent created at least one public or private ticket comment during the evaluation window.
- **No** if the offered agent did not create a comment during that window.
- Public and private comments both count. Do not display or expose the comment body.

Set **“Updated the ticket”** to:

- **Yes** if the offered agent performed any ticket update during the evaluation window.
- A comment counts as a ticket update.
- Field changes also count, including status, assignee, group, priority, type, tags, custom fields, followers, collaborators, and other persistent ticket changes.
- **No** if the offered agent made no ticket update during the evaluation window.
- Ignore notification, webhook, routing metadata, and other system-generated events that do not represent a direct ticket update by that agent.

This means that when **“Comment”** is Yes, **“Updated the ticket”** must also be Yes.

**Parts:**

- App header with the title **“Ticket Offer Audit.”**
- Ticket ID input.
- Primary **“Audit Ticket”** button.
- Secondary **“Clear”** button.
- Compact ticket summary showing:

- Ticket ID
- Subject
- Current status
- Total number of offers found

- A simple responsive Garden table with exactly these columns:

1. **Offered to**
2. **Offered at**
3. **Comment**
4. **Updated the ticket**

- Display agent name and agent ID in the **“Offered to”** column.
- Display **“Yes”** and **“No”** as accessible Garden tags:

- Yes: green success tag
- No: neutral gray tag

- Sort results chronologically from oldest to newest by default.
- Add a compact toggle to switch between oldest-first and newest-first.
- Localize dates and times using the current user’s Zendesk locale and timezone.
- Include loading skeletons while audits are being retrieved.
- Include an empty state when the ticket has no `OfferedToEvent` records.
- Include a small **“Refresh”** button to run the audit again.

**Important Behavior:**

- Create one table row for every `OfferedToEvent`, even when the same ticket was offered to the same agent multiple times.
- Treat every offer as an independent evaluation window.
- Do not merge or deduplicate offers.
- If multiple offer events have the same timestamp, preserve their original audit and event sequence.
- If an agent updates the ticket only after it has already been offered to another agent, do not attribute that action to the previous offer.
- If an agent comments, both **“Comment”** and **“Updated the ticket”** must display **“Yes.”**
- If an agent changes a field without commenting, display:

- Comment: No
- Updated the ticket: Yes

- If no matching action is found from the offered agent, display:

- Comment: No
- Updated the ticket: No

**Scope:**

- Location: Zendesk Nav Bar.
- Read-only.
- Audit one ticket at a time by ticket ID.
- Do not modify tickets, users, routing settings, or audit data.
- Do not expose comment content or other sensitive ticket content.
- Only users with permission to view the requested ticket and its audits may access the results.
- Do not build cross-ticket reporting, scheduled audits, bulk searches, or external data storage.

**Errors and Limitations:**

- Show clear inline messages for:

- Invalid ticket ID
- Ticket not found
- User does not have permission to access the ticket
- Audit API unavailable
- Rate limit reached
- Partial pagination failure

- Handle HTTP `401`, `403`, `404`, `429`, and `503` responses.
- If one page fails after previous pages were loaded, display the partial results with a warning and a **“Retry remaining”** action.
- Include a **“Copy error details”** button for troubleshooting.
- Show an informational note explaining that Zendesk does not record `OfferedToEvent` audit events for voice-channel tickets, so voice offers may not appear in this report.

**Tech and Conventions:**

- Use ZAF Client for all Zendesk API requests.
- Use Zendesk Garden components and automatically support light and dark modes.
- Keep the implementation modular with components such as:

- `TicketSearch`
- `TicketSummary`
- `OfferAuditTable`
- `OfferAuditRow`
- `LoadingState`
- `EmptyState`
- `ErrorState`

- Create utility functions for:

- Audit pagination
- Agent lookup
- Offer extraction
- Evaluation-window construction
- Comment detection
- Ticket-update detection
- Localized date formatting
- Stable chronological sorting

- Cache agent names for the duration of the session to avoid repeated API requests.
- Add minimal console logging in development or test mode only.
- Add clear comments around the correlation algorithm.

**Plan and Tests:**

Generate the app and verify it in Test mode using tickets with these scenarios:

- The ticket was offered once and the agent added a public comment.
- The ticket was offered once and the agent added a private comment.
- The agent changed a ticket field without commenting.
- The agent made no update after the offer.
- Another agent updated the ticket after the offer.
- The same agent received multiple offers.
- The ticket was offered to several different agents.
- An agent acted only after the ticket had been offered to someone else.
- The ticket contains enough audits to require pagination.
- The ticket has no `OfferedToEvent` records.
- The ticket does not exist or the current user cannot access it.

Confirm that each offer produces exactly one row and that the two Boolean columns follow the correlation rules defined above.

**Name and Icon:**

- App name: **Ticket Offer Audit**
- Use a neutral Garden icon related to search, routing, or audit history.