type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Redact String in Comment
* Permanently removes words or strings from a ticket comment.
*/
export async function main(
auth: Zendesk,
ticket_id: string,
ticket_comment_id: string
) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/tickets/${ticket_id}/comments/${ticket_comment_id}/redact`
);
const response = await fetch(url, {
method: "PUT",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 58 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Redact String in Comment
* Permanently removes words or strings from a ticket comment.
*/
export async function main(
auth: Zendesk,
ticket_id: string,
ticket_comment_id: string
) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/tickets/${ticket_id}/comments/${ticket_comment_id}/redact`
);
const response = await fetch(url, {
method: "PUT",
headers: {
Authorization: "Basic " + btoa(`${auth.username}:${auth.password}`),
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 605 days ago