# Sweep stale Zoho Desk tickets into Slack every weekday

> Every weekday morning, find the Zoho Desk tickets nobody has touched in three days, post them to Slack grouped by owner, and log each one to a spreadsheet.

- Workflow type: code
- Services: Zoho Desk, Slack Bot, Google Sheets
- Categories: Customer Support, Operations
- Published: 2026-08-10

## What it does

- Checks your Zoho Desk helpdesk every weekday morning for open tickets that have had no activity in three or more days.
- Posts a single Slack message that opens with the total number of stale tickets, then breaks them down by the agent who owns them, with each ticket's age in days and a direct link.
- Puts unassigned stale tickets at the top of the message, because tickets with nobody's name on them are the ones most likely to be forgotten.
- Adds a row to a Google Sheets tracker for every stale ticket, so you build up a history and can see which people and queues go quiet most often.

## What you'll need

- A Zoho Desk account with permission to view tickets and the list of support agents.
- A Slack workspace and the channel where you want the morning sweep posted.
- A Google account and a spreadsheet to use as the tracker, ideally with a header row for run date, ticket number, subject, assignee, days since last update, and status.

## Prompt

Every weekday at 8am, sweep my Zoho Desk helpdesk for tickets that have gone stale and report them in one place so nothing sits forgotten. Run this on a cron schedule, Monday through Friday at 8am in my timezone.

Start by fetching open tickets from Zoho Desk using List Tickets. Two things about this API to handle properly. First, every Zoho Desk endpoint except the organizations lookup requires the orgId header, so resolve the organization id once at the start and send it on every call. Second, the list endpoints are offset paginated with a from parameter and a limit parameter, the limit maxes out at 50 on most list endpoints, and an empty result comes back as HTTP 204 with no body rather than an empty array. So page through with from and limit and keep going until a page returns fewer records than the limit or returns a 204. Do not assume one page is the whole queue.

Filter those tickets down to the stale ones: keep only tickets whose most recent modified time is three or more days before the moment the sweep runs. For each survivor, compute the age as a whole number of days since that last update, because I want that number shown in both outputs.

Resolve the owners. Call List Agents once, page it the same way, and build a lookup from agent id to agent name. Then map each stale ticket's assignee id to a readable agent name through that lookup. Do not make a separate agent call per ticket. Any ticket with no assignee id is treated as unassigned.

Group the stale tickets by assigned agent and send one Slack message with Send a Message to the support channel. The message leads with the total count of stale tickets across the whole sweep. Then the unassigned tickets come first under their own clear heading, since tickets with no owner are usually the worst offenders, followed by one section per agent under that agent's name. Under each heading, list that group's tickets with the ticket number, the subject, the age in days since the last update, and a link to the ticket using the ticket's web URL from the Zoho Desk record. Slack uses mrkdwn rather than standard Markdown, so links are formatted as <url|text> and bold is single asterisks. Keep it one message, not one per agent. If no tickets are stale, send a short all clear message instead so the team knows the sweep ran.

Then append the same findings to a Google Sheets tracker using Append Values, one row per stale ticket, capturing the run date, the ticket number, the subject, the assignee name or Unassigned, the days since last update, and the ticket status. Append rather than overwrite so the sheet accumulates a running history the team can look back over to spot patterns in what goes stale. On an all clear day, skip the append entirely rather than writing an empty row.

Two things I will want to tune, so make them obvious named constants near the top of the code rather than values buried in the logic: the three day staleness threshold, and the 8am weekday schedule.

## How to customize

- Change what counts as stale. Three days is the default, but a fast-moving team might drop it to one day and a low-volume queue might stretch it to a week.
- Change the timing. It runs at 8am on weekdays, and you can move the hour, switch to a weekly sweep, or include weekends.
- Narrow the sweep to a single department, queue, or set of ticket statuses if you only want to watch one part of the helpdesk.
- Point the Slack message at a different channel, or split high-volume teams into their own channels.

## FAQ

### What counts as a stale ticket?

Any open ticket that has gone three or more days without an update at the moment the sweep runs. Three days is just the default starting point, and you can raise or lower it to match how fast your team is expected to respond.

### Does this close or reply to any tickets?

No. The sweep only reads from Zoho Desk. Nothing gets closed, reassigned, or answered automatically, so it is safe to switch on without worrying about it touching a live customer conversation.

### What happens on a day when nothing is stale?

You get a short all clear message in Slack so you know the check actually ran, and no rows are added to the spreadsheet that day.

### Why send to Slack and a spreadsheet?

Slack tells you what needs attention today. The spreadsheet accumulates a history, so after a few weeks you can see whether the same person, queue, or type of request keeps going quiet.

### Will it work if some tickets have no owner?

Yes, and those are handled deliberately. Unassigned stale tickets get their own heading at the very top of the Slack message rather than being mixed in or dropped.

Use this prompt in General Input: https://www.generalinput.com/prompts/sweep-stale-zoho-desk-tickets-into-slack-every-weekday