PowerBuilder / Support API / Redact Chat Comment
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
integer li_Sunt_4
integer li_Laborum4
integer li_Tempor_2
integer li_Laboris__b0
string ls_Esse_6
integer li_Veniam_1
integer li_In_0b
string ls_Exercitation164
string ls_Id
string ls_V_Type
string ls_Chat_id
string ls_Visitor_id
integer i
integer li_Count_i
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_Http.BasicAuth = 1
loo_Http.Login = "login"
loo_Http.Password = "password"
loo_Http.SetRequestHeader("Accept","application/json")
loo_Resp = loo_Http.QuickRequest("PUT","https://example.zendesk.com/api/v2/chat_redactions/:ticket_id")
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
return
end if
loo_SbResponseBody = create oleobject
// Use "Chilkat_9_5_0.StringBuilder" for versions of Chilkat < 10.0.0
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat.StringBuilder")
loo_Resp.GetBodySb(loo_SbResponseBody)
loo_JResp = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_JResp.ConnectToNewObject("Chilkat.JsonObject")
loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0
Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()
li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
Write-Debug "Response Header:"
Write-Debug loo_Resp.Header
Write-Debug "Failed."
destroy loo_Resp
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
return
end if
destroy loo_Resp
// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)
// {
// "chat_event": {
// "id": "<integer>",
// "type": "<string>",
// "value": {
// "chat_id": "<string>",
// "history": [
// {
// "sunt_4": false,
// "laborum4": false,
// "tempor_2": true
// },
// {
// "laboris__b0": 51519808,
// "esse_6": "labore elit",
// "veniam_1": 65652007,
// "in_0b": 13721436,
// "exercitation164": 83149154.88991535
// }
// ],
// "visitor_id": "<string>"
// }
// }
// }
// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code
ls_Id = loo_JResp.StringOf("chat_event.id")
ls_V_Type = loo_JResp.StringOf("chat_event.type")
ls_Chat_id = loo_JResp.StringOf("chat_event.value.chat_id")
ls_Visitor_id = loo_JResp.StringOf("chat_event.value.visitor_id")
i = 0
li_Count_i = loo_JResp.SizeOfArray("chat_event.value.history")
do while i < li_Count_i
loo_JResp.I = i
li_Sunt_4 = loo_JResp.BoolOf("chat_event.value.history[i].sunt_4")
li_Laborum4 = loo_JResp.BoolOf("chat_event.value.history[i].laborum4")
li_Tempor_2 = loo_JResp.BoolOf("chat_event.value.history[i].tempor_2")
li_Laboris__b0 = loo_JResp.IntOf("chat_event.value.history[i].laboris__b0")
ls_Esse_6 = loo_JResp.StringOf("chat_event.value.history[i].esse_6")
li_Veniam_1 = loo_JResp.IntOf("chat_event.value.history[i].veniam_1")
li_In_0b = loo_JResp.IntOf("chat_event.value.history[i].in_0b")
ls_Exercitation164 = loo_JResp.StringOf("chat_event.value.history[i].exercitation164")
i = i + 1
loop
destroy loo_Http
destroy loo_SbResponseBody
destroy loo_JResp
Curl Command
curl -u login:password -X PUT
-H "Accept: application/json"
https://example.zendesk.com/api/v2/chat_redactions/:ticket_id
Postman Collection Item JSON
{
"name": "Redact Chat Comment",
"request": {
"method": "PUT",
"header": [
{
"key": "Accept",
"value": "application/json"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/chat_redactions/:ticket_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"chat_redactions",
":ticket_id"
],
"variable": [
{
"key": "ticket_id",
"value": "<integer>"
}
]
},
"description": "Permanently removes words or strings from a chat ticket's comment. \n\nWrap `<redact>` tags around the content in the chat comment you want redacted. Example: \n\n```json\n{\n \"text\": \"My ID number is <redact>847564</redact>!\"\n}\n```\n\nThe characters contained in the tag will be replaced by the ▇ symbol.\n\n**Note**: This does not work on active chats. For chat tickets that predate March 2020, consider using [Redact Ticket Comment In Agent Workspace](#redact-ticket-comment-in-agent-workspace).\n\n#### Allowed For\n\n- Agents\n\n[Agent Workspace](https://support.zendesk.com/hc/en-us/articles/360024218473) must enabled for the account. Deleting tickets must be enabled for agents.\n\n#### Request Body Properties\n\n| Name | Type | Required | Description |\n| ------------------------ | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| chat_id | string | true | The `chat_id` in the `ChatStartedEvent` event in the ticket audit. See [Ticket Audits](/api-reference/ticketing/tickets/ticket_audits) |\n| chat_index | integer | true | The `chat_index` in the `ChatMessage` event in the ticket audit. See [Ticket Audits](/api-reference/ticketing/tickets/ticket_audits) |\n| text | string | true | The `message` in the `ChatMessage` event in the ticket audit. See [Ticket Audits](/api-reference/ticketing/tickets/ticket_audits). Wrap `message` with `<redact>` tags |\n\nTo get the required body properties, make a request to the [Ticket Audit](/api-reference/ticketing/tickets/ticket_audits) endpoint. Example response:\n\n```http\nStatus 200 OK\n{\n \"audits\": [\n \"events\": [\n {\n \"id\": 1932802680168,\n \"type\": \"ChatStartedEvent\",\n \"value\": {\n \"visitor_id\": \"10502823-16EkM3T6VNq7KMd\",\n \"chat_id\": \"2109.10502823.Sjuj2YrBpXwei\",\n \"history\": [\n {\n \"chat_index\": 0,\n \"type\": \"ChatMessage\",\n \"message\": \"My ID number is 847564!\"\n }\n ]\n }\n }\n ]\n ]\n}\n```\n"
},
"response": [
{
"name": "Success response",
"originalRequest": {
"method": "PUT",
"header": [
{
"description": "Added as a part of security scheme: basic",
"key": "Authorization",
"value": "Basic <credentials>"
}
],
"url": {
"raw": "{{baseUrl}}/api/v2/chat_redactions/:ticket_id",
"host": [
"{{baseUrl}}"
],
"path": [
"api",
"v2",
"chat_redactions",
":ticket_id"
],
"variable": [
{
"key": "ticket_id"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [
],
"body": "{\n \"chat_event\": {\n \"id\": \"<integer>\",\n \"type\": \"<string>\",\n \"value\": {\n \"chat_id\": \"<string>\",\n \"history\": [\n {\n \"sunt_4\": false,\n \"laborum4\": false,\n \"tempor_2\": true\n },\n {\n \"laboris__b0\": 51519808,\n \"esse_6\": \"labore elit\",\n \"veniam_1\": 65652007,\n \"in_0b\": 13721436,\n \"exercitation164\": 83149154.88991535\n }\n ],\n \"visitor_id\": \"<string>\"\n }\n }\n}"
}
]
}