type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Mark Ticket as Spam and Suspend Requester
* #### Allowed For
* Agents
*/
export async function main(auth: Zendesk, ticket_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/tickets/${ticket_id}/mark_as_spam`
);
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.text();
}
Submitted by hugo697 223 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Mark Ticket as Spam and Suspend Requester
* #### Allowed For
* Agents
*/
export async function main(auth: Zendesk, ticket_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/tickets/${ticket_id}/mark_as_spam`
);
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.text();
}
Submitted by hugo697 770 days ago