Event for new / updated / closed tickets | The place for Zendesk users to come together and share
Skip to main content
December 16, 2021
Question

Event for new / updated / closed tickets

  • December 16, 2021
  • 14 replies
  • 43 views

Hello,

I was searching around but could not find a good start.

My intention is to create an app that sends an HTTP request to our alerting service when a ticket is created (or updated, or closed).

I tries this one:

var client = ZAFClient.init();

client.on('ticket.save', function(data) {
sendAlert(data);
return true;
});

However, this never gets called.

When I use this instead, it works.

client.on('*.changed', function(data) {
sendAlert(data);
});

But it is only called when I change certain fields and not when I create a new ticket for example.

Is there some sample code for achieving the above? Or, can you point me in the right direction. 

Thanks a lot

Ron

 

14 replies

Erica
Employee
January 13, 2022
Taking a look at the code, everything looks great I don't see any reason why it wouldn't be able to pick up on new tickets when plugged into the statement where you're checking.  How are you creating new tickets? Also, are they actually coming in as "New" to your queue?
 
Best,
 
Erica - Dev Support
Ronald12Author
January 13, 2022

Hi Erica,

I create a ticket by clicking "Submit as New". However, right after that the ticket is marked as Open.

In "ticked.saved" I only get one event where isNew is false. Also the comments are not present in the data object.

Am I missing something?

Thanks again and Best Regards

Ron

 

Erica
Employee
January 13, 2022
When you say you only get one event where isNew is false, do you mean it normally does return as true when new tickets are created? Also, are tickets being auto-assigned to any particular person or group at the time of creation?
 
Truly appreciate all of your patience while we try to sort this out!
 
Best,
 
Erica - Dev Support
Ronald12Author
January 14, 2022

Hi Erica,

Thanks again ....

The ticket creation is quite straightforward. I did not configure any auto-assignments. However, I can see that all the tickets I have created are assigned to myself. I create the ticket by clicking "Submit as New". When I go into the ticket again I see the status is "Open". In my code I always get "isNew": false. I never see true here. And I never see the comments. I remember (more or less) I saw the comments, when I did not use a background app but a side bar app.

I just submitted an app update where I use a workaround. I compare the timestamps createdAt and updatedAt. When the difference is greater than half a second I assume it is an update and not the initial creation of the ticket.

Thanks and Best Regards

Ron