I would like to generate an ics file then transform it in blob to finally send it through an Zendesk API POST call
The code
const blob = new Blob([icsContent], { type: "application/json" });
const uploadICSFile = await uploadZendeskFile('appointment.ics', blob);
axios POST
export async function uploadZendeskFile(filename: string, fileBlob: Blob): Promise<Upload> {
return await axios.post(
`https://${config.subdomain}.zendesk.com/api/v2/uploads.json?filename=${filename}`,
fileBlob,
{
auth: {
username: '*****',
password: '*****'
},
headers: {
'Content-Type': 'text/calendar',
}
}
);
}