PDF report downloadable link / File Name question

Is there a away to create a PDF report and keep it on Tago platform (or an external cloud location) so user can access it directly instead of emailing the report?

Additionally, what does the file name parameter do on the send email options? Should we use a random name here?

filename: “exportedfile.pdf”,

Hi @sanimesa,

Check this other post on our community about How to generate a beautiful PDF using TagoIO .

Here is an example to upload a file on TagoIO:

async function uploadFileToTago(account: Account, csvstring: string) {

const file_id = Date.now();
const csvbase64 = Buffer.from(csvstring).toString(“base64”);
const acc_info = await account.info();
const filename = reports/${file_id}_${moment().tz("America/New_York").format("DD_MM_YYYY_HH_mm_ss")}.csv;
// @ts-ignore: Unreachable code error
await account.files.uploadBase64([{ filename, file: csvbase64, public: true }]);
const file_url = https://api.tago.io/file/${acc_info.id}/${filename};
return file_url;
}

Here is an example, showing how to send email with an attachment:

const services = new Services({ token: context.token }); // analysis token
await services.email
.send({
to: email,
subject: “your subject”,
message: “your message”,
attachment: {
filename: “report.csv”, // you can insert any name e.g: file.pdf | example.doc
archive: csv, // csv need to be a base64 data
},
})
.then(context.log)
.catch(context.log);