Although not officially supported by Zendesk due to potencial race condition issues, it is possible to add comments to tickets using a trigger or an automation. Automated comments can be particularly useful for off-peak hours and/or non-email channels like Facebook or WhatsApp, where Facebook’s 24-hour rule applies. In this article we’ll learn how to create an automated ticket comment.

Use case: notifying customers outside business hours

Suppose our business doesn’t provide customer support between 7pm and 8am, so we’d like to notify customers who write to us during that period.

We want to notify them once, letting them know no one is currently available to handle their request immediately, but that we’ve received it. In this case, we’ll need a trigger, not an automation.

Here are the sub-tasks we’ll need to complete:

Adding a schedule

We’ll create a new schedule, Support Hours:

Zendesk • Create new schedule

Assigning a schedule to the ticket

Now, we’ll ensure office hours are applied to every single ticket.

Zendesk trigger that applies a schedule to tickets

Webhook to update the ticket

Now we’re going to create the Zendesk webhook that will allow us to add public comments and internal notes.

On to your Admin Center, go to Apps and integrations » Webhooks. Create a new webhook and follow these steps:

  • Select a way to connect: Trigger or automation (click Next)
  • Name: let’s name it “Admin • Update ticket”
  • Description (optional): if you’d like, add a description
  • Endpoint URL:{{}}.json (make sure to replace ‘yoursubdomain’ with your Zendesk account’s subdomain)
  • Request method: PUT
  • Request format: JSON

It should look like this:

Zendesk: create a webhook to update tickets

Side-note: this process used to be achieved using Targets (previously under Extensions) but it has been deprecated.

Trigger that adds the automated comment

All you have to do now is to create the Zendesk trigger to add an internal note or a public comment to tickets (it can also be an automation, of course).

Let’s name our trigger ALL :: C :: Social – Private :: Facebook + Twitter :: Notify user during off-hours (pro-tip: establishing naming conventions within Zendesk is essential for proper help desk organization, also facilitating administrative work and interpretations by other Zendesk users).

Here are its conditions (under ALL and ANY):

Zendesk example of trigger conditions to notify users during off-hours

As you can see, we’re ensuring it only executes if/when:

  • The ticket is created
  • Our Support Hours schedule has been applied
  • We’re not within business hours

And here are the trigger actions:

Zendesk example of trigger actions to notify users during off-hours using an automated public comment via webhook

Here’s a blank JSON body in case you’d like to copy it:

{ "ticket": { 
   "comment": { 
      "body": "Your message goes here!",
      "public": true 

This is a simplistic approach because many businesses operate under different time zones and/or working hours. If you choose to notify users with triggers, the latter should be positioned after the trigger(s) setting the ticket Schedule.

Although the example in this article is basic, a trigger’s ‘Within business hours?’ condition will still evaluate a schedule on a per-ticket basis, so assigning the correct schedules to the right tickets is crucial.

Advanced: formatted JSON comments with HTML

Note: a comment can be formatted in HTML. To do that, use ‘html_body‘ instead of ‘body’. Example internal note with a formatted list in HTML:

{   "ticket": {
      "comment": {
         "html_body": "<p>This is the first sentence.</p><p>Here is an example unordered list:<p><ul><li>First item</li><li>Second item</li></ul><p>Isn't JSON awesome?</p>",
         "public": false

See the comment in action

I’ve used a test account to send a Twitter DM out of office hours.

As you can see in ticket Events, the admin user you chose to authenticate the webhook with is the one leaving the automatic reply (and the “By Web Service” note confirms it’s a comment posted via API).

Zendesk example of automated public comment in ticket

Of course, the customer will not see anything related to this admin user. The comment will be sent under the Twitter account you’ve integrated, so everything should look normal for users.

The automated comment as seen by the Twitter end-user

Zendesk example of automated comment in ticket, end-user's perspective

As you can see, the ticket comment is added as if by a support agent. Optionally, you can add a note indicating that it is an automated message, of course!

Important: use with moderation

Do not abuse these features, as they’re not natively supported by Zendesk, mostly because native business rules respect a cycle which updates via API do not, meaning there may be resulting race conditions.

Also, please remember these automated comments do not replace agents. I’d recommend using them for very specific situations only, as opposed to a generalized usage.

I’d recommend refraining from adding automated public comments for any email-based channels. In other words, try using these webhooks for channels where you can’t email the ticket requester using native business rules.

For example:

✔️ You usually receive a few Facebook private messages or WhatsApp messages during off-hours. You trigger a single public comment informing these users of your schedule, that you’ll address their request as soon as possible, etc.

❌ You create an automation that adds an internal note to all tickets without any activity in the last hour.

On the other hand, internal notes can be used to automatically provide guidance to agents. For example, if you’re training agents for very specific cases, new tickets with a specific tag could trigger an internal note that would tell the agent how to proceed in that case.

So please ensure the triggers that notify these webhooks have enough conditions to avoid firing repeatedly, and that what you create makes sense in the long run.

Apart from that, enjoy leveraging the Zendesk API to add relevant comments to tickets!

article Written by

Pedro Rodrigues, Zendesk and CX consultant

Pedro Rodrigues

Senior Zendesk system administrator and customer-centric project manager dedicated to CX who also contributes as a Zendesk Community Moderator. Experienced in content management & SEO, reporting and analysis. Special skill: an eagle-eye for detail.