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 HTTP  target to update the ticket.

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

 

Step 1

To create the target in Zendesk, click on the cog in the left bar, then on Extensions and then on add target like this: 

SweetHawk__-_Agent.png

Then click to create an HTTP target like this:

SweetHawk__-_Agent.png

 

Give the HTTP target a name and in the URL section add the following...

https://yourhelpdesk.zendesk.com/api/v2/tickets/{{ticket.id}}.json

...Where yourhelpdesk is the URL name used for your helpdesk. 

Then, set the Method to PUT, the content type to JSON, put in your Zendesk user credentials and click to create like this: 

SweetHawk__-_Agent.png

Note: If you're using SSO on your desk, you will not be able to use your regular username and password. Instead, you will need to enter your username with /token at the end like this: peter@sweethawk.co/token and for the password, you will need to generate an API token - see here for more

 

Step 2

To create a trigger to add the CCs to the ticket and send an email notification click on the cog on the left, go to Triggers and click add trigger like this:

SweetHawk__-_Agent.png

 

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

Notification_Center.png

Note: If your conditions are set for a ticket update, make sure you check for a tag of your choice that you can then remove in the actions to ensure your trigger does not loop. It is very important to do this to ensure that your trigger does not loop (more on nullifying conditions here).  If your condition is set for when a ticket is created, you can ignore the tag rule since a ticket is only created once. 

 

Under the Actions section, set a rule to Notify target and select the target 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", "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:

Notification_Center.png

IMPORTANT NOTE: Adding CCs will not work if you do not add the comment part of the JSON above. It will also not work if you set "public" to false. 

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


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

Comments

0 comments

Please sign in to leave a comment.