How to extract end_user comments on a ticket distinct from agent comments

2 Comments

  • Greg Katechis
    Zendesk Developer Advocacy

    Hi there! Since Zenpy is a third-party library, we don't have a lot of insight into it. I was taking a look at the documentation and didn't see anything super helpful, but figured I'd link it here just in case. Hopefully someone in the community has some experience with Zenpy and can help out!

    0
  • Ahmed Zaid
    User Group Leader Community Moderator

    Hi Reservations,

    This Zenpy snippet prints ticket comments from end users:

        ticket_id = 123
      comments = zenpy_client.tickets.comments(ticket=ticket_id)
      for comment in comments:
          author = zenpy_client.users(id=comment.author_id)
          if author.role == "end-user":
                print(comment.to_json())

    You can probably optimise it by using incremental ticket export where I believe both comments and users can be sideloaded, hence, saving on the api calls, but at least this should get you started.

    0

Please sign in to leave a comment.

Powered by Zendesk