type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Create Macro Attachment
* Allows an attachment to be uploaded and associated with a macro at the same time.
**Note:** A macro can be associated with up to five attachments.
#### 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}/attachments`
);
const response = await fetch(url, {
method: "POST",
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 3 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Create Macro Attachment
* Allows an attachment to be uploaded and associated with a macro at the same time.
**Note:** A macro can be associated with up to five attachments.
#### 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}/attachments`
);
const response = await fetch(url, {
method: "POST",
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 550 days ago