Event for new / updated / closed tickets

Respondida

14 Comentarios

  • Erica Girges
    Zendesk Developer Advocacy
    Hey Ronald! 
     
    Thank you so much for posting your question to the community! Have you looked into using Webhooks instead? Their functionality is exactly what it is you're trying to achieve and they're fairly easy to setup. A Webhook will send an HTTP request/alert to your destination of choice when specific actions take place, in your case: when a ticket is created or ticket status has changed. Once integrated with your destination, you'll utilize triggers to define the actions you're looking to get alerted by. You can check out Webhooks [here](https://developer.zendesk.com/api-reference/event-connectors/webhooks/webhooks/) as well as some getting started info.
     
    Hope this helps!
     
    Best,
     
    Erica - Dev Support
    0
  • Ronald Czachara

    Thanks Erica,

    Yes, that looks like a feasible approach. However, I am looking for something that can get listed in your marketplace. Is this possible with the webhooks as well? If not, would something like webhooks also work with the app like I have mentioned in my first post or is there a better way?

    To give you some background about the use case:

    First, I would like to send ticket information via webhook (Zendesk to us) to trigger an alert.

    Second, we would like to publish an app on our side that sends ticket updates back to Zendesk.

    Thanks again

    Ron 

     

    0
  • Erica Girges
    Zendesk Developer Advocacy
    Hey Ronald,
     
    Thanks for clarifying. In that case we probably don't want to use that specific Webhooks feature as those need to be predefined by the user. 
    What app location are you building the app for? Will it be a background app?
     
    Erica - Dev Support
    2
  • Ronald Czachara

    Hi Erica,

    Thanks a lot and sorry for my late reply.

    In fact your question was already the answer for me. I added the background location and now it works just fine.

    Thanks again

    Ron

     

    0
  • Erica Girges
    Zendesk Developer Advocacy
    That's awesome Ronald! I'm so glad it's working for you now.
    Please don't hesitate to let us know if you need help with anything else.
     
    Best,
     
    Erica - Dev Support
    0
  • Ronald Czachara

    Hello,

    I have another question ....

    When I use the following:

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

    the variable "data" contains the ticket information but the comments seem to be empty.

    Is there a way to access the comments for "ticket.save"?

    Also, for "ticket.save" I get the event each time the ticket is saved or when a comment has been added. This is as it should be of course. But, is there a way to get an event only if a new ticket has been created? I wan to distinguish between a newly created alert and an existing saved one. 

    Thanks again

    Ron

     

    0
  • Erica Girges
    Zendesk Developer Advocacy
    Hi Ron!
     
    That does seem off. When I tested the event with the returned ticket data, I also saw the comments value was empty. However, when I hit our direct API for [List Comments](https://developer.zendesk.com/api-reference/ticketing/tickets/ticket_comments/#list-comments) I am able to return all of the comments. I'm still double checking with our team to dig more into what's happening there. 
     
    In the meantime, to be able to capture the ticket status (specifically for new tickets) I recommend using the ticket.saved event instead (which is a background app specific event). This just helps prevent race conditions when trying to capture the ticket status. Then I would just use something like an if/else statement to check if the data.ticket.status === "new". If so, you can send an alert uniquely for that else, send your regular update alert. There is also the isNew property that is returned with the ticket data. You can look for whether that is true and use it to help distinguish between New and just updated tickets.
     
    Hope that helps!
     
    Erica - Dev Support
    1
  • Ronald Czachara

    Thanks Erica,

    I tried that but it seems I always get the following when using ticket.saved ....

    "isNew":false
    "status":"open"

    No matter whether I create a new ticket or add a comment to an existing one. So I cannot distinguish between new and updated existing tickets.

    It seems the two issues I experience (not getting the comments and not being able to distinguish new from existing tickets) are related to the background apps.

    Not sure if I am missing something.

    Thanks again

    Ron

     

     

    0
  • Erica Girges
    Zendesk Developer Advocacy
    Hi Ronald,
     
    Would you mind sharing a bit larger of a code snippet so I can see where exactly the client.on is happening? Please feel free block out any sensitive info if it has any. 
     
    Thanks,
     
    Erica - Dev Support
    0
  • Ronald Czachara

    Hi Erica,

    Sure, you can find the complete code here ....

    https://github.com/rons4/signl4-integration-zendesk/blob/main/assets/iframe.html

    Thanks again

    Ron

     

    0
  • Erica Girges
    Zendesk Developer Advocacy
    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
    0
  • Ronald Czachara

    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

     

    0
  • Erica Girges
    Zendesk Developer Advocacy
    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
    0
  • Ronald Czachara

    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

     

    0

Iniciar sesión para dejar un comentario.

Tecnología de Zendesk