type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Create Unassociated Macro Attachment
* Allows an attachment to be uploaded that can be associated with a macro at a later time.
**Note:** To ensure an uploaded attachment is not lost, associate it with a macro as soon as possible. From time to time, old attachments that are not not associated with any macro are purged.
#### Allowed For
* Agents
*/
export async function main(auth: Zendesk) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/macros/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 377 days ago
type Zendesk = {
username: string;
password: string;
subdomain: string;
};
/**
* Create Unassociated Macro Attachment
* Allows an attachment to be uploaded that can be associated with a macro at a later time.
**Note:** To ensure an uploaded attachment is not lost, associate it with a macro as soon as possible. From time to time, old attachments that are not not associated with any macro are purged.
#### Allowed For
* Agents
*/
export async function main(auth: Zendesk) {
const url = new URL(
`https://${auth.subdomain}.zendesk.com/api/v2/macros/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 923 days ago