CC Customer On All Organisation Requests
We are going to create a trigger to automatically CC a customer on all tickets created for an organisation. The CC address is held in a custom organisation field. You can use one trigger to notify multiple organisations.
The steps to follow are:
- Create a custom organisation field to hold the CC email address
- Create dynamic content to extract any CC user already on the ticket
- Find your API password
- Create an extension to action our CC user
- Create a trigger to pull it all together
This article comes from the original post from Andrey. Within Andrey's article, you will find other options for managing CCs in Zendesk.
Create a custom organisation field
Under Admin>Manage>Organisation Fields, create a new text field.
The naming of the field is important. Here it is called:
- CC User on All Organisation Requests
Zendesk will default the key field value:
- cc_user_on_all_organisation_requests
This will be used to identify the field later.
Create dynamic
Under Admin>Manage>Dynamic Content, we shall create some code to extract any users already CC'ed on a ticket.
Again, naming is important. The dynamic content is named:
- Extract_CC_Mails
The content should hold:
{% if ticket.cc_names != empty %}{% capture ccedusers %}{% for cc in ticket.ccs %}{% unless forloop.last %}{{ cc.email | append: ', ' }}{% else %}{{ cc.email }}{% endunless %}{% endfor %}{% endcapture %}{{ ccedusers | strip_newlines }}{% else %}{% endif %}
Find your API password
Under Admin>Channels>API, enable Token Access.
Add a new token and take note of the long token reference generated. You will use this to authenticate access in your extension.
Create an extension
Extensions are available as trigger actions. This extension will add our organisation's designated user as a CC.
Go to Admin>Settings>Extensions.
Add a new target and select 'URL target' as the type.
There are few settings required here:
Title: This is the name of the extension that will appear in our trigger actions.
Method: PUT
URL: These are the instructions to be processed in our trigger action. Paste the following code:
https://YOURDOMAIN.zendesk.com/api/v2/tickets/{{ticket.id}}.json+?ticket[collaborators]={{dc.extract_cc_mails+|+prepend:','+|+prepend:ticket.organization.custom_fields.cc_user_on_all_organisation_requests}}
Replace the text YOURDOMAIN with the domain of you own help desk.
You will also recognise that our dynamic content name, Extract_CC_Mails, and the key field of our organisation field, cc_user_on_all_organisation_requests
Attribute Name: value
The remaining fields are to authenticate the instructions sent to your Zendesk.
For the username, enter your email address, immediately followed by '/token'.
In the password field, paste the long token reference that you created in the API section.
Create your target or update your target to save any changes.
Create trigger
A trigger will call your extension. Because an organisation field holds the email address of your contact, you only need one trigger to cover all organisations. For example, your conditions may be:
And, the action is to call our extension.
Ensure you include the text in the message box.
You may want to position the trigger near the top of your list to ensure it fires early.
Using the CC field
For each organisation, enter the CC addresses in the custom field. Separate multiple addresses with commas.
When viewing a ticket, click 'Show all events' to see the trigger firing.
-
Hi All
Many Thanks for all the help on this article, I personally have no idea what some of the code is doing but it works perfectly in terms of adding the CC users to out tickets which is critical functionality for us as we need to set default contacts for customer accounts especially when alarms come from monitoring emails rather than the customer directly.
I just have two problems that im hoping someone could help with.
1. On new ticket creation the CC user doesnt receive the email, the trigger is top of the list but the CC doesnt get added until after the notify requester of new ticket trigger so they dont recieve it, I assume due to the PUT request not reaching zendesk for a few seconds
2. Ideally, I would like to check the requester field to ensure none of the CC's being added are also the requester if they are drop them from the CC list
All this should be default in zendesk as customer default contacts are a very common feature.
Many Thanks
-
Hi- thanks for this! Was able to get it working in my instance here. Too bad there's no solution for the initial "email has been created" email, but something is better than nothing!
-
Hey Stephen - glad to hear you got things working better for you.
-
Hi Everyone,
I want to forward the ticket to another Zendesk instance, so I am using an http target to forward the ticket info:
JSON:
{
"ticket": {
"subject":"{{ticket.title}}",
"description":"{{ticket.description}}",
"type":"{{ticket.ticket_type}}",
"priority": "{{ticket.priority}}",
"tags":"{{ticket.tags}}",
"status": "{{ticket.status}}",
"comment":"{{ticket.comments_formatted}}",
"requester": { "name": "{{ticket.requester.name}}", "email": "{{ticket.requester.email}}" },
"collaborators":["{% for cc in ticket.ccs %}{{cc.email}},{% endfor %}}"]
}
}
However, only the first CC can be transferred to the new ticket...How can I get all CCs to the new ticket? -
Hi Jennifer!
I'm checking with the Community Moderators to see if anyone has an answer on this for you.
-
Hi Jessie,
Thanks! I have already solved this issue:) I will post a tutorial in the tips section.
Jennifer.
-
Looking forward to it. :) Thanks for doing that, Jennifer!
-
Fantastic! You're the best. :D
-
Hi,
Does anyone have an idea how i am getting a user notified for all tickets under an organization without any setup on my behalf or that user was also not cc in any ticket?
Currently, my client is complaining about this but i cannot find why a user is being notified for all tickets without any setup. Does anyone have a clue?
Thanks,
Yami
-
Yamile
It is likely the user has clicked to follow organisation requests under my activities in the Help Centre. You can assume the user’s identity to check that and either unfollow the requests on their behalf or talk them through the process so that they are aware of the option.
Following an organisation will automatically CC the user into all organisation tickets.
-
Hi Graeme,
OMG!!! yes that was it; i was breaking my head trying to figure this out but thank you. Our client placed a bug against this and was upset that i had not resolved the issue yet.
Thank you once again.
Regards,
Yami
-
Does anyone know if the "CC Customer on All Organisation Requests" field can also be used to map to a Salesforce account field, via the Zendesk-Salesforce integration? I would like to confirm it can be used to sync email addresses from the related Salesforce account, but at the same time, not break the functionality that is allowing the emails to be CCed to begin with. Thanks.
-
Hello everyone, can you advise in my case? I want to create a similar setting as it is, but we do not use organization field for that. Instead I have custom field that is "Client name". I want to send notification to client users (hardocoded, two emails) whenever I choose this client name in this field. Is that possible?
Please sign in to leave a comment.
43 Comments