Hi Harrison,
I have a few notes on your app.
First, let's talk about saving the ticket. In order to save a ticket from an App, you can prompt the app to “save the ticket via the REST API, including the new tag.” The agent will get a standard notification that the app has been updated.
When I used this feature, it was to change the layout using a tag-based Contextual Workspace, so I prompted the app to send a ZAF notification including the HTML link to the ticket to force a refresh. That may not be your need, but you could add that to your prompt if needed.
I'd start with a prompt like this and then iterate:
We are making a countdown app. Make an app with a ‘timer’ button. The button will add the tag `pending_tagging` to the ticket and save the ticket (using the REST API) and any changes to it,including that tag. Start and dispay a countdown timer for 60 minutes. When the timer reaches zero, add the tag `my_action_tag` and remove the `pending_tagging` tags and save the ticket via API. When the app opens, if the ticket has a `pending_tagging` tag, do not show the button, but get the ticket audit history via the API and see when the tag was added. calculate the remaining time in the 60 minute period and restart the counter from there.
That's rough, and still requires a solution for bullet item #3. See below for advice on that.
Second, the requirement to set a tag after a delay. Apps built with App Builder run strictly in the context of an agent's Agent Workspace session and if you close a ticket, they stop running.
There are multiple solutions I would consider, depending on how granular you need your workflow to be.
-
Automations can fire once per hour on tickets and implement rules.
You'd use an automation like "If ticket created time > 1 hour and ticket status is not solved and ticket tags include `pending_tagging`", then add the tag `my_action_tag` and remove the tag `pending_tagging`. You'd want to immediately set the first tag and set the second by automation.
- Zendesk has a new feature in Early Access called Action Builder. It does not fully meet this need, but can be triggered to act after Agent Workspace is complete. It is designed for fully automated workflows while App Builder is designed for Agent-involved workflows. Future versions may provide additional steps to meet your needs.
- If Zendesk Automation is not granular enough for your need, there are third party marketplace apps that have their own backends with minute-scale timers. Zendesk partner Sweethawk.com, provides an app called Timers that may be a good fit, and there may be additional marketplace apps that meet similar needs.
- Third party automation tools could also create similar workflows, which would be a matter of determining which one has the features you need to resolve this issue.