Recent searches


No recent searches

Notify webhook for new ticket comments

Answered


Posted Oct 01, 2021

I'm trying to setup a webhook to get notified on all new comments for a Ticket. I'd like to have the id, comment, and comment author to be sent via JSON to my webhook. Right now I have it somewhat working with the following body:

{
"id": "{{ticket.id}}",
"comment": "{{ticket.comments[0]}}",
}


But unfortunately something like this doesn't work:

{
"id": "{{ticket.id}}",
"comment": "{{ticket.comments[0].body}}",
"author": "{{ticket.comments[0].author_id}}",
}


1

7

7 comments

image avatar

Zach Anthony

Zendesk Product Manager

Hey Kyle,

I believe the reason this isn't working for you is that ticket.comment.body and ticket.comment.author_id are not available placeholder properties.

If you would like the ID, Comment and Comment Author for the most recent comment I would recommend trying this in your trigger:

{
"id": "{{ticket.id}}",
"comment": "{{ticket.latest_comment}}",
"author": "{{ticket.latest_comment.author.name}}"
}

This article has a full list of placeholder properties available for future reference

Hope this helps!

2


Hey Zach,

I don't suppose when the webhook triggers, there's a way to see which fields on my Ticket have changed?

0


image avatar

Zach Anthony

Zendesk Product Manager

Hey Kyle,

At this stage this is not something that can be easily supported out of the box, however we are exploring being able invoke webhooks based on events occurring in your Zendesk account (such as a ticket field being updated). The only thing that I can suggest is that you include the fields you are interested in, in your payload and do the comparison on your server side with the values from previous ticket updates.

0


I have a related problem.

Based on the context of this ticket, I assume it's possible to set up a webhook to get notified of every comment of every ticket.

However, I don't see anything in the documentation for how to do that. Can anyone link to the appropriate resource please? I'm really stuck here.

0


Hi Stefano, thanks for your question.
 
To be notified for every comment of every ticket, the best option is to: 
  • Create a webhook with data you want to collect/send (you can use the placeholders reference for that)
  • Create a trigger to fire your new webhook.
 

 
If you need more information about how to connect webhooks to triggers, I recommend this article section: Connecting to triggers or automations
Hope it helps a bit :-) 

0


Hello, is there a way to notify active webhook ONLY when new comment is added? Your provided solution is not fully correct as we will be notified every time when ticket is updated, not only when new comment is added. Also latest comment is sent avery time ticket is updated. I need a solution to trigger webhook only when new public comment is added. Is that achievable?

0


Hi Sebastian Olszewski, You can notify the active webhook only when a new comment is added in a ticket using the “Ticket > comment” “is” “Present (public or private)” condition in the respective trigger: 

0


Please sign in to leave a comment.

Didn't find what you're looking for?

New post