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.
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.
What does this prompt do?
- 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 do I need to use this?
- 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.
How can I customize it?
- 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.
FAQs
What counts as a stale ticket?
Does this close or reply to any tickets?
What happens on a day when nothing is stale?
Why send to Slack and a spreadsheet?
Will it work if some tickets have no owner?
Related templates
When someone leaves, we check which shared passwords they used in their final months and post a ranked rotation list to your security channel.
Every Monday, check every S3 bucket for public exposure, missing encryption and weak backup settings, then get the risks ranked in Slack.
Twice every weekday, the conversations from your social inbox land on the right HubSpot contact timelines, with a Slack recap for sales.
Every weekday at 7am, sign in to the tender portals you track, filter new notices against your bid criteria, and open a deal for the ones worth chasing.
Every morning, find the addresses that hard bounced or filed a spam complaint, update the matching HubSpot contacts, and post a short Slack recap.
Every weekday at 4pm, spot the threads that went quiet, stage a ready-to-send nudge in your mailbox, and get a ranked Slack recap.
Stop letting support tickets go quiet.
Set the weekday sweep up once and your team starts every morning knowing exactly which tickets have gone cold and who owns them.