facetoe / zenpy

Python wrapper for the Zendesk API
GNU General Public License v3.0
340 stars 162 forks source link

Redact comment from closed tickets #640

Closed nerg4l closed 3 weeks ago

nerg4l commented 1 month ago

There are two ways to redact comments.

One of them, "Redact String in Comment" is already implemented, but that functionality cannot redact information from closed tickets.

Redaction is permanent. You can't undo the redaction or see what was removed. Once a ticket is closed, you can no longer redact strings from its comments.

However, "Redact Ticket Comment In Agent Workspace" does not have this limitation.

I'm willing to create a PR with this functionality but I would like to know how this should be exposed. zenpy_client.tickets.comment_redact is already in use for redacting strings. Should it be added as zenpy_client.comment_redact?

cryptomail commented 1 month ago

Sorry it took so long to get back to you! I will do some investigation and partner with you on this. I feel it's a miss on the part of the API if Agent Workspace can do it, yet it's not exposed here. Very interesting :) Furthermore, I wonder if the Ruby SDK also has this "miss" as you lay it out. If it does, we should probably add it there as well. Comment redaction is very important and allows our customers to shore up any PII/Confidentiality misses. Thanks for pointing it out, again, I'll do a bit of research today.

cryptomail commented 1 month ago

OK, after confirming your findings, I feel that

zenpy_client.comment_redact

Should be added. If you make a PR, I'll contribute and ensure there's a test. Would love to work with you on this.

nerg4l commented 1 month ago

I can work on this next week.

nerg4l commented 1 month ago

I started to work on it, but so far, I couldn't get a successful response from Zendesk. I keep receiving 400 Bad Request.

cryptomail commented 3 weeks ago

https://github.com/facetoe/zenpy/blob/dc007f7222e2acc4a6051df0e08c5a4d20c332a4/zenpy/lib/api.py#L1487 already exists

nerg4l commented 3 weeks ago

Oh, I missed this. Regardless, it seems the current implementation can only redact text and not attachments.

nerg4l commented 3 weeks ago

@cryptomail Okay, now I remember why I had to add #646. The current implementation calls a different endpoint which behaves differently and cannot redact from closed tickets.

Current Redact String in Comment PUT /api/v2/tickets/{ticket_id}/comments/{ticket_comment_id}/redact

[...] Once a ticket is closed, you can no longer redact strings from its comments. [...]

Proposed Redact Ticket Comment In Agent Workspace PUT /api/v2/comment_redactions/{ticket_comment_id}

This endpoint provides all the same functionality that the Redact String in Comment endpoint provides, plus:

  • Redaction of comments in closed tickets
  • Redaction of comments in archived tickets
  • Redaction of formatted text (bold, italics, hyperlinks)
nerg4l commented 6 days ago

@cryptomail is there any chance to reopen this based on my previous comment?