type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Show Changes to Ticket
* Returns the changes the macro would make to a ticket. It doesn't actually
change a ticket. You can use the response data in a subsequent API call
to the Tickets endpoint to update the ticket.
The response includes only the ticket fields that would be changed by the
macro. To get the full ticket object after the macro is applied,
see [Show Ticket After Changes](#show-ticket-after-changes).
#### Allowed For
* Agents
*/
export async function main(auth: Zendesk, macro_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/macros/${macro_id}/apply`
);
const response = await fetch(url, {
method: "GET",
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 377 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Show Changes to Ticket
* Returns the changes the macro would make to a ticket. It doesn't actually
change a ticket. You can use the response data in a subsequent API call
to the Tickets endpoint to update the ticket.
The response includes only the ticket fields that would be changed by the
macro. To get the full ticket object after the macro is applied,
see [Show Ticket After Changes](#show-ticket-after-changes).
#### Allowed For
* Agents
*/
export async function main(auth: Zendesk, macro_id: string) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/macros/${macro_id}/apply`
);
const response = await fetch(url, {
method: "GET",
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 923 days ago