RedactTicketComment
Permanently removes words, strings, or attachments from a ticket comment. Unlike the older redact endpoint, this also covers closed tickets, archived tickets, and formatted text. Redaction cannot be undone.
Stored Procedure-Specific Information
Redaction is permanent. The redacted content is deleted from Zendesk and cannot be recovered or viewed again.Either HtmlBody or ExternalAttachmentUrls must be specified. A call that supplies neither has nothing to redact and returns an error.
HtmlBody must be the comment's existing HTML body with <redact> tags wrapped around the content to remove. Zendesk matches the value against the stored comment, so the surrounding markup must match exactly. Retrieve the body from the TicketComments view first:
SELECT Id, HtmlBody FROM TicketComments WHERE TicketId = 12345
Then wrap the text to remove and submit the whole body:
EXECUTE RedactTicketComment @CommentId='10000000000001', @TicketId='12345', @HtmlBody='<div class="zd-comment" dir="auto"><redact>Description</redact><br></div>'
Each redacted character is replaced with a block character in the stored comment, so the length of the removed text remains visible.
To redact an HTML element such as an inline image or a link, add the redact attribute to the element in addition to placing <redact> tags around any inner text. The attribute redacts only the element itself; inner text that is not enclosed in <redact> tags is left in place.
To redact attachments instead of text, set ExternalAttachmentUrls to a comma-separated list of the ContentUrl values of the attachments to remove. Retrieve those values from the Attachments view:
SELECT AttachmentId, CommentId, ContentUrl FROM Attachments WHERE TicketId = 12345
Then submit the urls for the comment that holds them:
EXECUTE RedactTicketComment @CommentId='10000000000002', @TicketId='12345', @ExternalAttachmentUrls='https://omniwear.zendesk.com/attachments/token/<token>/?name=example.png'
The redacted attachment is replaced with an empty file named redacted.txt. The driver never requests the urls you supply; they are passed to Zendesk, which matches them against the attachments already on the comment.
This procedure covers cases the Zendesk redact endpoint used by RedactCommentAttachment does not, including comments on closed tickets, comments on archived tickets, and formatted text. Agent Workspace must be enabled on the account. On Professional accounts, agents must be permitted to delete tickets; on Enterprise accounts, agents can instead be assigned a custom role with permission to redact ticket content.
Input
| Name | Type | Required | Description |
| CommentId | String | True | The Id of the comment to redact content from. |
| TicketId | String | True | The Id of the ticket the comment belongs to. |
| HtmlBody | String | False | The HtmlBody of the comment, with the content to be removed wrapped in redact tags. Add the redact attribute to an HTML element to redact the element itself. |
| ExternalAttachmentUrls | String | False | A comma-separated list of the ContentUrl values of the comment attachments to be redacted. Available from the Attachments view. |
Result Set Columns
| Name | Type | Description |
| Success | String | True if the comment is redacted successfully. |