Ch00k / zendesk-redactor

A command-line interface for Zendesk Ticket Redaction app
The Unlicense
1 stars 0 forks source link

No snippet found after a few redactions #1

Open evrynet1 opened 2 years ago

evrynet1 commented 2 years ago

I'm not sure if this project is still maintained or not but I'm very happy with the redactor, it's a great thing to have. Unfortunately it seems that in long tickets after a few redactions (like 5-6) the snippets can't be found anymore no matter whether it's long or short or anything. We thought it could be an API limit but 5-6 redactions wouldn't hit the limit and it doesn't work later either (in an hour, two or even the next day).

We have tried this with 3-4-5-6 characters but nothing was found. Interestingly if we set one character only like "a" then it is starting to redact but even after that words redaction doesn't work. Any idea what could be the cause? Here is an example:

[root@aa ~]# zredactor --organization XXXX --email xxxx@xxx.xxx --token XXXXXX --ticket-id 7744 snippets fsif6LDuHIhXmywEkIxgnQ Snippet 'fsif6LDuHIhXmywEkIxgnQ' not found in ticket None of the provided text snippets were found in the ticket [root@aa ~]# zredactor --organization XXXX --email xxxx@xxx.xxx --token XXXXXX --ticket-id 7744 snippets fsif Snippet 'fsif' not found in ticket None of the provided text snippets were found in the ticket [root@aa ~]# zredactor --organization XXXX --email xxxx@xxx.xxx --token XXXXXX --ticket-id 7744 snippets fsi Snippet 'fsi' not found in ticket None of the provided text snippets were found in the ticket [root@aa ~]# zredactor --organization XXXX --email xxxx@xxx.xxx --token XXXXXX --ticket-id 7744 snippets fs Found snippet 'fs' in comment 5644508270620 Redacting snippet Found snippet 'fs' in comment 5646743539612 Redacting snippet ^[[A[root@aa

Thanks

Ch00k commented 2 years ago

Very happy that you found this tool useful! I made it to scratch my own itch a year or so ago, but I currently don't use Zendesk anymore, so I don't maintain this tool anymore. Having said that, I think I know what the root cause it. I think it's because getting a list of ticket's comments from the API does not account for pagination. Here is the request we send, and it reads only the first page. Per the documentation the default page size is 100, so only the first 100 comments will be taken into account.

There is a code snippet in the official Zendesk docs that shows how to implement pagination. Like I said, I don't have access to Zendesk anymore, so I would not be able to test this, but I can make a branch for you to test against your Zendesk instance. Alternatively, feel free to open a PR with this change after you've tested it, and I'll happily approve it.