Recent searches


No recent searches

Can I configure a trigger to add a comment to a ticket?



image avatar

Ricardo Pinto

Zendesk Digital Resources Team

Edited Feb 19, 2025


-48

108

108 comments

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


image avatar

Lou

The Product Manager Whisperer - 2022Community Moderator

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


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


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


HI Sandro,
 
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


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


Is it possible to use standard HTML formatting with notify targeting?

ie. if I wanted the response to contain a hyperlink

 

0


Does anyone know of a way to get this working for a Whatsapp ticket that is on messaging to message the customer?

0


image avatar

Gabriel

Zendesk Customer Care

Hi Matthew,

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


This really would be so useful in so many different usecases!

0


+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


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


image avatar

Lou

The Product Manager Whisperer - 2022Community Moderator

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


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


image avatar

Lou

The Product Manager Whisperer - 2022Community Moderator

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


+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


+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


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


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


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


Thanks so much Walter!

0


This is a significant shortcoming for our team.  

We need to post the contents of filled out fields into the comment section.
For example, when a customer fills out a form and updates all the fields the agent needs to see the results in the fields of the ticket.   We want the field updates in the comment section. Having to look at all the fields is very cumbersome.
 
Please advise.

0


image avatar

Jupete Manitas

Zendesk Customer Care

Hi Stephen, thanks for writing in! We understand that you would like to pull the data from your ticket fields and put them into the ticket comment section. With that use case, currently, there is no native functionality to achieve but technically possible through custom scripts/API with a combination of targets and triggers.
 
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


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


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:

URL: https://SUBDOMAIN.zendesk.com/api/v2/tickets/{{ticket.id}}.json?ticket[comment][public]=false+
Method: PUT
Attribute name: ticket[comment][body] 
Basic Authentication: Entered my credentials here.
 
When I try to test the target i get the following error:
Error during transmission: HTTP client call failed
 
I'm getting the following failure when I look at Admin Center> Apps & Integration>Zendesk API>Target Failures. Can someone please tell me what I'm doing wrong here? :(
{
  "error": {
    "title": "Invalid attribute",
    "message": "You passed an invalid value for the ticket.comment.body attribute. Invalid parameter: ticket.comment.body must be a string from api/v2/tickets/update"
  }
}

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


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


image avatar

Nicole Saunders

Zendesk Community Manager

Thanks for jumping in, Chris!

0


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:

  1. Create an API Key in the admin centre under 'Apps and Integrations', then 'Zendesk API'. Name it want you like and be sure to take a copy of the key.
  2. Create a webhook in the admin centre under 'Apps and Integrations', then 'Webhooks'
  3. Create a new trigger in the admin centre under 'Objects and rule' then 'Triggers' and in the actions of the trigger, select 'Notify active webhook, and select your newly created webhookNotes:
  • By stating "public": true, this will add your comment to a ticket as a public reply and your requester WILL get the email.
  • Changing it to "public": false, will add your comment to the ticket as an internal note
  • I would recommend using Dynamic Content placeholders in the the text. This is because i couldn't format spacing and text formats. That said, this feature does not support HMTL. It only supports plain text and markdown
  • This feature works in automations too!
  • Make sure you add the correct submitter ID. This will be whatever you want the message to appear from. You can use the assignee placeholder or in our case, we used a generic user we created specifically for these actions. In this case we used the user ID
  • Be sure to add an exclusion tag to stop this trigger / automation from looping.
  • If your trigger sets the ticket to closed, you will need to isolate this action from the trigger and create a secondary trigger to close the ticket. (I learnt this the hard way)

Anyway, hope this helps and good luck! This was a gamechanger for us so I hope this helps anyone else reading it :) 

0


image avatar

Rafael Santos

User Group Leader

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:

{
{% capture htmlBody %}<p>Your<b>HTML</b>goes here.</p>{% endcapture %} "ticket": {
"comment": {
"html_body": "{{htmlBody}}",
"public"
}
}
}

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:

  • Note that Zendesk doesn't recommend nor provides support for your Webhook payloads.
  • If available, test these first in a sandbox/test environment.
  • Updating tickets via the API can easily break your workflows and may lead to frustration. Please double-check with an expert if you're not sure of what you're doing.

1


Andy Seaman, good stuff. :)

The comments can support HTML if you use html_body instead of body.

{
"ticket": {
"comment": {
"html_body": "HTML HERE BUT REMEMBER TO ESCAPE THE DOUBLE-QUOTES",
"public": true,
"author_id": 1234567890
}
}
}

 

1


Please sign in to leave a comment.