Updating a ticket's subject can be influential to the way your agents work their tickets inside Zendesk. Your agents can already manually update a ticket's subject or run a macro. However, Zendesk falls short of being able to automatically update a ticket subject utilising a pre-built trigger condition. We're going to show you another handy workaround on how you can achieve this with a Trigger & Webhook combo!
In our example today, we're going to show you how to auto-update a ticket subject to include text and data from some specific custom fields.
This article will cover the following topics:
- Creating the webhook
- Creating the trigger
Before you begin:
- Obtain your API token - Follow the steps here to Generate a new API Token in your Zendesk account. We'll use this later for authenticating the webhook.
Creating the webhook:
-
- In Admin Center, click the Apps and Integrations icon () in the sidebar, then select Webhooks > Webhooks.
- Click Actions and select Create webhook.
- Set up your webhook with the below:
- Example of the endpoint URL: https://{SUBDOMAIN}.zendesk.com/api/v2/tickets/{{ticket.id}}.json
- Authentication: You can choose to use the authentication method which suits your security needs best. We are using Basic Authentication with an API token for this example.
- Don't forget to Save the webhook.
Name: Update ticket
Endpoint URL: https://subdomain.zendesk.com/api/v2/tickets/{{ticket.id}}.json
Request method: PUT
Request Format: JSON
Authentication: Basic authentication
Example:
For the authentication, make sure you add the "/token" to the end of your email address in the username field and add the API token as the password.
Creating the trigger
Once you've created your new webhook, you'll next create a trigger to connect it to, so the ticket subject can be automatically updated based on the JSON body conditions set. In this example, when a New Store request is received via the New Store Opening Advice form, we want to automatically update the ticket subject to reflect the following: Subject line = New Store Request – “Organisation + ”New Store Name”
- In Admin Center, click the Objects and Rules icon () in the sidebar, then select Business rules > Triggers.
- Create a new trigger or edit an existing one by hovering over the options icon () and clicking Edit.
- Under the Meet ALL Conditions section add the 3 noted conditions below.
- Under Actions, click Add Action. Select Notify webhook and then select your webhook.
- Click Save after you have filled out all of the trigger settings.
Name: Reset ticket subject for New Store requests = New Store Request – “Organisation + ”New Store Name”
Meet ALL Conditions:
- Ticket is Updated
- Form is New Store Opening Advice
- Tags contains none of the following "subject_updated"
Actions:
- Notify active webhook = Update ticket
- Add tags = "subject_updated"
- JSON body =
{
"ticket": {
"subject": "New Store Request = {{ticket.ticket_field_8449033124121}} + {{ticket.ticket_field_7935714820121}}"
}
}
In case you need it, you can find the Zendesk Support Placeholder Reference Guide here.
From this point, when the ticket is updated and it meets the trigger conditions, the trigger fires off behind the scenes and automatically updates the ticket subject.
IMPORTANT:
- The subject change will be visible on the ticket to the requester in the following ticket updates.
- This trigger is designed to run once on a ticket, after the initial creation of the ticket. This will ensure any ticket fields being populated by other things such as webhooks at time of creation to populate any ticket fields, before this trigger fires and updates the subject. This is to ensure the data is present inside the field before this workflow runs to make the update.