Recent searches
No recent searches
Tip: Use Webhooks and triggers to add CCs to a ticket
Posted May 10, 2022
We figured out a way to add CCs to a ticket based on conditions defined in a trigger. First, you need to set up a webhook with the endpoint
https://<company-name>.zendesk.com/api/v2/tickets/{{ticket.id}}.json
as JSON/PUT request.
Then, you can define a trigger with your conditions that calls the webhook ("Update active webhook") and sends the following JSON data:
{
"ticket": {
"email_ccs": [
{ "user_id": "123456789", "action": "put" },
{ "user_id": "987654321", "action": "put" }
]
}
}
You can use the Zendesk API to query the appropriate user IDs.
You may also configure another webhook to put a comment into the ticket notifying your agents about the change:
{
"ticket": {
"comment": {
"body": "new CCs added",
"public": false
}
}
}
Please note that the trigger should probably not act on "Ticket is updated" because that might cause an infinite loop with the new comment that also updates the ticket.
Cheers,
Matthias
1
7
7 comments
Dave Dyson
-2
Matthias Miltenberger
Thanks, Dave!
Please, feel free to suggest a better solution to update CCs on a ticket based on some condition. I don't exactly like my solution - it just appeared to be the only feasible way to implement this because CCs do not appear in the trigger options. I am happy to use a different approach.
Cheers,
Matthias
4
Christopher Kenrick
Matthias,
Many thanks for sharing this - this has been an absolute lifesaver for me and one of our biggest clients!
Thanks,
Chris
1
DEREK BRUCE
Is there a way to utilize JSON if/then to dynamically add cc email addresses? I have a drop down field that specifies the location the ticket belongs to, and previously used dynamic content to pair it with the appropriate emails for that location. Can the location be extracted in JSON, and then used to validate emails to be cc'd?
0
Jimmy Rufo
Hi Matthias Miltenberger,
I tried this solution in my ZD sandbox, but could not get the CCs to be added to the ticket.
Can I confirm that the user IDs to put in the JSON would be the same ID I can find in the UI for each user like below (in bold)? If so, the trigger ran and incorporated tags I needed, but didn't CC anyone.
https:/<companyname>.zendesk.com/agent/users/123456789/requested_tickets
0
Matthias Miltenberger
Sorry, Jimmy Rufo, you might want to reach out to Zendesk Support for help with that. It works just fine on our side. And yes, the user ID is the one that is also shown in the URL when looking at the user's tickets.
0
Elaine
I'm wondering if this leads to race conditions as mentioned by Dave in this article: Can I use a trigger and a webhook to update tickets?
Feel free to contact our Zendesk Support team for assistance.
0