Using Zendesk triggers to add CCs to a ticket

You might have noticed that Zendesk triggers do not have the functionality to simply specify a bunch of CCs that you want to see on a ticket 😞. 

But, don't despair because there is still a way to make this happen. It's a little advanced though, so if the sight of code scares you then you should stop here. But if you're ok with a bit of copying, pasting and tweaking, you can get it going in a couple of steps:

 

Step 1: Create a Zendesk Webhook to update the ticket.

Step 2: Create a trigger that uses the webhook to add CCs onto the ticket.

 

Step 1

Follow instructions for step 1, 2 and 3 in this article showing you how to create a Zendesk webhook.

 

Step 2

To create a trigger that adds the CCs to the ticket, go to your Zendesk Admin Center, go to Triggers and click Add trigger like this:

Zendesk_Admin_Centre.jpg

 

Then give your trigger a name and set the conditions for when you want it to fire like this: 

Notification_Center.png

The conditions above contains a rule checking for the existence of the tag add_ccs. This will act as the nullifying condition for this trigger. 

 

 

It is very important that you add a nullifying condition to your trigger for this type of action (webhook). Since the trigger is causing the ticket to update itself, the consequence of it not being nullified means that the ticket will update itself hundreds (if not thousands) of times a minute until the trigger is manually disabled.

 

Next, under the Actions section, set a rule to Notify active webhook and select the webhook you created in step 1. 

Then in the JSON body section, copy and paste in the following code:

{
"ticket": {
"email_ccs": [
{"user_email": "zendeskagent1@gmail.com", "action": "put"},
{"user_email": "zendeskdemonstration@gmail.com", "action": "put"}
],
"comment": {
"body": "This is an email notification regarding ticket {{ticket.id}} regarding {{ticket.subject}}. Here's what it's about - {{ticket.description}} ",
"public": true
}
}
}

You will need to change the user emails to be the emails that you actually want to add as CC's on the ticket. 

You will also need to change the body of the email to what you want to say to the new CCs on the ticket.

If you checked for a tag in the conditions, remember to remove it. 

Finally, click to save the trigger at the bottom.

The Actions section should look something like this:

zendesk-trigger-json-ccs.png

 

 

IMPORTANT NOTE: If the ticket is internal only, adding CCs will not work unless you add the comment part of the JSON above with "public" set to true. This is because Zendesk does not allow CCs to be added/stored until the ticket is public.

After creating the trigger, go to a test ticket and enact the conditions that will cause this trigger to fire.


Was this article helpful?
6 out of 6 found this helpful