Take a look at my first posts here and you will see that I am getting all the info from an API. Again, the problem is not getting the file, saving the file or re-naming the file. The problem is that when the end user will try to download the file (in my case is a PDF) the file name (stored in S3) will contain all the rubbish. Of course if end user is smart enough to separate the rubbish, there is no issue. The file will be saved locally as a normal PDF. But this is not what you want to do (think about on mobile).
Yes, you get an error from the external URL. That’s what the rubbish does … controls if you have authorization and if URL is not already expired (30 sec.)
OK that “rubbish” is an amazon pre-signed URL I think it expires in an hour (3600 sec in the signature parameters). the signature contains details of the request so you can’t manipulate that in any useful way. If you want to be able to download this file, from S3, with the bucket security in place, then the only way to obtain a file is with a URL in that format.
We have our own amazon bucket and I am currently working on the uploads and downloads to and from our own bucket. In our bucket we have a folder that has global read only access. In the same situation I would:
Get the file using the simple API call I showed above from the amazon presigned URL
hold in memory in a step in bubble
use an amazon post into our own bucket, where I can set the file name however I want and where there are no credentials to download it later
And then set up some housekeeping api actions for later to delete it when it expires
BUt this is genuinely not trivial
One of the other cloud storage providers might have a much simpler API than amazon for writing your data to a folder there and no URL parameters when downloading. Either way the filoe is in the bubble bucket in S3 and you can only get stuff out if it with those parameters, as far as I’m aware.
When using the file option on the API Connector all files retrieved are saved in S3 with the name “content”. This name is unsuitable for our customers and users for several reasons.
We have the actual filename for each file id, but we can’t figure out how to tell Bubble the name to use when saving the file to S3.
@lottemint.md It sounds like your recommendation is:
Expose a new public endpoint
Have the app send it to itself over the network encoding and decoding to base64 as necessary (using a Bearer token to make sure the app knows that the requests are coming from itself)
While I can imagine that this might work, it’s rather hard for me to imagine this would be the recommended way for choosing a file name or for renaming an existing file for that matter. I’m hopeful there’s a more pragmatic solution that I’ve overlooked in the manual or reference or that can be found here in these forums.
I would be very grateful for any alternative suggestions!
I was just checking for any progress in the threat, but it seems that there are no substantial news. Maybe @eve can help us. I repeat the question here: how can we change a file name before it is saved to S3 ? The full issue is explained in my first post in this thread. Thanks
yes I am still using PDF Monkey (but now they require a paid plan). After opening you account, you need to build your PDF report using the tools provided by them. Some research is needed, it took me some time but not too difficult to learn.
This is a screen shot of the html section of an expense report I built in PDF Monkey.
Then I have created a backend workflow that it’s triggered every time a user clicks on a PRINT button. In this WF I created and saved in the Bubble DB a filed that contains the JSON with all the data to send to PDF Monkey. Use the “formatted as text” expression to manage nested data.
That’s about it ! The only thing that I was not able to do was to use the PDF Monkey web hooks in order to retrieve the PDF file once created. I used a workaround and schedule another backend workflow to check when the PDF is ready and save it to Bubble database.
The PDF file is now available to be viewed or download by end users.
How do you handle the dynamic data? I´m trying to use it for generation of our user´s invoices and each invoice can have multiple line items such as 5 or 40 line items.
Also, still cannot retrieve the PDF file? That´s odd. Is it because Bubble´s limitations?
@ryanck maybe you should move this discussion in a separate thread. Anyway, dynamic data come with the thing that you are sending to the backend workflow. In your case it will be a single invoice, I guess. Available data largely depends on your data structure. For what concerns the PDF file, as I said, I ended up scheduling calls to PDF Monkey to check when the file is ready and then I grab it and save it.
Hi @stefanof and thanks for all these informations. IM STRUGGLING to save the .PDF to the bubble data base, i tried many many things, but document URL is not passed and cannot get the url to upload it on the data base. I tried front end, back end etc … but nothing … Would you mind sharing the back end workflow you are talking about ? thanks !!!
Hi @Alter345, let’s use an example from one of my app where users can create a commercial offer that is saved as a PDF via PDF Monkey. I will go through each different workflows screenshot since it is not really straightforward to explain.
Step 1) - Create a thing with the data you will use to create your PDF
Step 4) - in the backend create an API workflow that you will use to detect the webhooks from PDF Monkey; as you probably already know, you leave the detect data open while triggering the web hook from PDF Monkey; This is needed since there is some delay between sending the request to create a PDF and the successful creation of the PDF file.
Step 5) - Once you get the Document ID of the PDF successfully created by PDF Monkey, you setup an API Connector call (it’s a GET) that will “ask” PDF Monky more info about that document
Step 6) - Last step is to search for the record that the Document ID belongs to and save the PDF file retrieved via the API Call.
@stefanof Many thanks for your reply
in fact, its clear for me thank you
thing is, i was trying to do this without webhook from pdf monkey (which i use as well), directly from API call and i was struggling to get the download url
right now, with the webhook and your example, it works
thanks !