Tip: Use Webhooks and triggers to add CCs to a ticket
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
-
Thanks for sharing this, Matthias – I do have to caution that using a trigger and webhook to update the same ticket that the trigger is operating on can lead to race conditions that could occasionally prevent the ticket from being updated. See Can I use a trigger and a webhook to update tickets?
-
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 -
Matthias,
Many thanks for sharing this - this has been an absolute lifesaver for me and one of our biggest clients!
Thanks,
Chris
Por favor, entrar para comentar.
3 Comentários