Question
Can I configure a trigger to auto-comment on a ticket?
Answer
Yes. You can create a trigger that automatically adds a public comment or an internal note to a submitted ticket that meets certain conditions. For more information, see the article: Automatically adding comments and notes to tickets using triggers.
Important: Zendesk doesn't support using webhooks for Zendesk APIs as a workaround to automatically add comments to tickets. Doing so can result in race conditions and other conflicts. For more details, see the article: Can I use a trigger and a webhook to update tickets?
108 comments
Dave Jensen
It is really surprising that this functionality doesn't exist. Just curious, for those who are using a target/trigger combo to have an internal ticket created - are you able to share a step by step guide on how you're doing this? I a looking into whatever ways I can get an internal note added that displays the text used on emails to requester we send out via trigger.
0
Lou
This user tips and tricks explains the comment part farther down in the article:
https://support.zendesk.com/hc/en-us/community/posts/4409515208346-Automated-follow-up-comments-for-Pending-tickets-public-or-internal-
I use it VERY often and it works great.
0
Richard Pixel
It is very disappointing to see, that this functionality not only hasn´t been natively within Zendesk, but to see how many people are requesting it, and no change is being made.
1
Sandro Araujo
there is indeed a method from Zendesk itself to insert public comments in tickets via trigger, they even posted here in the answers 90% of what needs to be done for this comment to be public.
but yes, it is possible to insert public comments in the ticket using triggers.
and has nothing to do with URL, we achieve such action using target notification.
0
Dave Dyson
The issue is that using a trigger to do this is not entirely reliable – it's possible that race conditions could result in the ticket not being updated with the comment, or in the comment trigger preventing a different trigger from completing its operation, and there isn't any way to predict if or when that might happen.
-2
Sandro Araujo
Hi Dave, how´s life?
but on what aspect would it not update? We have triggers working this way, inserting public comments into tickets, without any harm to the flow.
it's a native solution of yours, I don't understand how you still haven't noticed.
often the solution to very complex problems lies in absurdly simple solutions. Have you ever heard about it?
0
Matt Taylor
Is it possible to use standard HTML formatting with notify targeting?
ie. if I wanted the response to contain a hyperlink
0
Tom Rees
Does anyone know of a way to get this working for a Whatsapp ticket that is on messaging to message the customer?
0
Gabriel
This can be achievable, but we do not recommend this! The reason is addressed in the following article with more details (Webhooks use the same concept as HTML/Targets): https://support.zendesk.com/hc/en-us/articles/4408882855578-Can-I-use-a-trigger-and-a-webhook-to-update-tickets-
Thanks for your comprehension!
0
Keiran Rice
This really would be so useful in so many different usecases!
0
Eden Davis
+1 We need this ability. In general, we need more specific features to have mirrored functionality. If it can be done in a macro, it should be be possible to do it in a trigger, or automation, and so on and so forth (without the need to get involved in URL targets, business rules, etc.).
0
Dylan Walker
Lou
Do internal comments from triggers always post as the Zendesk user who created the trigger? Is there a way to change that user? We have a working api call to post an internal comment but I can't seem to find anything tying it to the person it's posting as. That person is no longer with us so we are trying to update. Thanks.
0
Lou
Dylan Walker
The comment will post as whoever's authentication is used for the trigger. All of mine are set up with my credentials, so they always show up as my comments. It's always fun trying to explain to the VP that I didn't do that LOL
0
Dylan Walker
Lou
Forgive me but where do you see the authentication in trigger settings? I see it in targets but it looks like we moved everything over to webhooks. I tried recreating the trigger when signed in to my account but it still ended up posting as that old user. Really appreciate the guidance.
0
Lou
Dylan Walker
The authentication is at the target/webhook level. I use my login credentials for authentication. That's why the various actions show up as having been performed by me.
0
Udo
+1 we need this option!
How we would like to use it:
When we put a ticket to status 'pending' we will use automation to send a reminder to the client. but after X times we would like the automation to 'solve' the ticket AND add the comment that we solved it because we tried to reach out for several times but failed to get their attention.
Now the tickets will be 'solved' without a comment.
0
Fabian
+1 for such a feature
We do use an API target to send messages to customers using triggers - which works pretty fine in general. The main issue is, that this trigger fires not a message but a dynamic content - we have this message in 6 languages. And no matter which language the customer has, it's always send in EN (default language).
Due to ZD support this can't be changed - therefore using an API target does not work :-( Anyone having an idea how to solve that? I'm not a fan of using "email user" action as I can't see this mail in the ticket and for the customer it's send as seperate mail and not in the ticket thread.
Any input would be appreciated - and of course especially if ZD can implement this feature ;)
0
Chris Curlett
Hey all. This is totally doable, though you have to do it through API.
First, set up a webhook. Select PUT. There are two URLs you can use.
Option 1:
https://[domain].zendesk.com/api/v2/tickets/update_many.json
or
Option 2:
https://[domain].zendesk.com/api/v2/tickets/{{ticket.id}}
Then, set up your Trigger. Add an Action to "Notify Active Webhook". Then depending on the URL you used, use one of the following JSON Bodies:
Option 1:
{
"tickets": [
{
"id": "{{ticket.id}}",
"status": "open",
"comment": { "body": "[type your comment here]", "public": false }
}
]
}
OR
Option 2:
{
"ticket": {
"comment": { "body": "[type your comment here]", "public": false }
}
}
It's pretty lame Zendesk doesn't have a built in Action for this, but I use the two methods above a bunch and it works great. There are lots of articles that cover how to set up a webhook and your API token, so I won't repeat it here.
Notes: Option 1 is great if you want one ticket to send a comment to one or more other tickets. You can replace "{{ticket.id}}" in the JSON body with a placeholder for a field in your ticket that lists a ticket number (for example, if you are targeting a Parent ticket and you have a parent ticket ID field). If you want to target multiple tickets, the field should list all of the ticket numbers, separated by a comma.
Option 2 is the most straight forward if you want an action to trigger a comment being placed in the same ticket. Using the target "https://[domain].zendesk.com/api/v2/tickets/{{ticket.id}}" is literally just pointing back to the same ticket that tripped the trigger.
Replace "public": false with "public": true if you want this comment to be Public and sent to the Requester.
In your body, you can also use placeholders if you want to grab information from fields in the ticket.
There are lots of formatting options you can reference, such as surrounding text on both sides with ** will make it bold, or using \n will create a new line, etc.
I hope this helps!
2
Marci Abraham
Thanks to Lou and everyone else who has contributed here. Someone (sorry I've lost track now after reading the whole thread) indicated that we need to be very careful to only trigger this ONCE. Well, mine is firing multiple times and I don't know how to change that. Can anyone point me in the right direction?
1
Walter
Marci Abraham
You can add an action in the trigger that adds a specific tag such as {trigger_name}_executed.
And then have a condition in the trigger for tags that contain none of the following: {trigger_name}_executed.
This should prevent the trigger from running more than once.
2
Marci Abraham
Thanks so much Walter!
0
Stephen Unterberg
This is a significant shortcoming for our team.
0
Jupete Manitas
Looking into the scenario, the example way to do this would be through a script that would run a GET on the ticket_fields end-point, which would run a check to see if the ticket field is 1) present on the ticket and if so, 2) return the value of that ticket. Next, you would want to create a POST with this portion of the tickets end-point to add that data to the ticket comment.
If you don't have your own developers, you can consult our Professional Services team or you can contact and get services from one of our partners online here: https://www.zendesk.com/marketplace/partners/ for any custom development or apps that they can build outside the native features. Thank you!
0
Dima Lazarchuk
Hello All,
We finalising the automations for Zendesk inside Proactive Campaigns app.
The new feature will help you setting up follow-upі and other automated emails right from you Zendesk.
Email campaigns + transactional emails in one place - your Zendesk.
Stay tuned!
3
Noelle Cheng
Hi Lou
Would you be able to help me? I tried the suggestions you mentioned in this post but I'm having fails still. I'm trying to insert an internal comment using a URL Target and using a trigger.
I've created the following target:
Chris Curlett, I also tried your write up for option 2 and it's not working either. :( Would you possibly be able to chime in as well? Thanks!
0
Chris Curlett
Hi Lou
I would love to help if I can! I see a couple of issues here:
1. I looks like you're taking a different approach than what I do. It looks to be like you're trying to add a new comment action directly in your URL. I would change your URL to:
https://[domain].zendesk.com/api/v2/tickets/{{ticket.id}}
and nothing else. In order for this to work, you ONLY need the trigger to have the ticket point back to itself.
Your action will be in the JSON payload. Copy and paste this as your template, and replace [type your comment here] with whatever you want the comment to say.
{
"ticket": {
"comment": { "body": "[type your comment here]", "public": false }
}
}
2. This is the more important point, HTTP Targets are no longer supported by Zendesk. You have to use Webhooks now as of just over a year ago. When this happened, myself and everyone else had to go make webhooks to replace all of the HTTP Targets I was using. The Webhook is simple, here's a screenshot of one of mine as an example:

2
Nicole Saunders
Thanks for jumping in, Chris!
0
Andy Seaman
Hey all,
Not sure if this answers your questions but with some help with a hybrid of this article and a few others, i was able to work out how to add a public and internal note via a trigger/automation.
Use case for auto Public reply:
If like most businesses, you have a SARS request, you may need to present a snapshot of all communications between the business and the requester. The problem with the native 'Email user' features in a trigger and automation, is your email content does not appear in the ticket trail. This can cause no end of trouble...believe me! Not only that, never under estimate how valuable it is for your agents to see what auto emails were sent.
Use case for auto Internal Note:
You may want to notify your agent to action a specific task or read a specific article before responding to a ticket. This could be "Before responding to this complaint email, please check our complaints procedure here"
Here is how:
Anyway, hope this helps and good luck! This was a gamechanger for us so I hope this helps anyone else reading it :)
0
Rafael Santos
Andy Seaman I'd like to check-in to correct on some points you've raised.
It's possible to use HTML by using the html_body property instead of body. More info on comment bodies.
I prefer to use Liquid's Capture tag to assign the comment's HTML text to a variable then use it as a placeholder. Example, naming that variable as htmlBody:
submitter_id is a property of the ticket object that you can use on ticket creation to define who's raised the ticket, not the comment object. Documentation on requesters and submitters.
If you'd like to add a comment on behalf of another, use author_id within the comment object. Note that this should be an integer, not a string. Documentation on ticket comments. Example:
{
"ticket": {
"comment": {
"html_body": "<h3>Foo</h3></br>Bar",
"public": false,
"author_id": 1234567890
}
}
}
If you need to update the ticket status, that can be done via this payload too, passing "status": "closed". However, I wouldn't recommend closing tickets like that unless you know what you're doing.
Zendesk API keys should be used with care. They're omnipotent in your Zendesk instance and shouldn't be created/shared/used carelessly. I'd prefer to use an OAuth token with scope "tickets:write" in this scenario. Documentation on OAuth tokens.
To whomever reads this:
1
Walter
Andy Seaman, good stuff. :)
The comments can support HTML if you use html_body instead of body.
1