Download a file from URL in a backend workflow

Am I missing a way of downloading a file from a URL in a backend workflow?

A third-party app generates a PDF, and when generated it sends the notification on a webhook (which is my backend workflow), and I’d like to download that file on the server. Is this possible?

Thanks a lot

I think you would just be saving it to your database…no way to download it to a device via a backend workflow since those are happening server side and can occur when no user is on the app.

The data I’m getting from the webhook is only the ‘download URL’, which is valid for 1 hour. It’s not possible to tell the server to download the file and save it to the database?

You can do it via the API connector.

You can save the file to your database right using that URL? If you add the ‘saved to S3 option’ onto the end of it then the URL that will be saved will be the URL to the file within your bubble storage.
Maybe then you can download it through the client using the File downloader plugin.

I’m sorry, seems like I’m missing something.

If I understood well, the API connector is to make calls. In this case, I have a backend workflow that triggers when called by the third-party app, which it currently does.

I can’t save the file to my database using that URL : that’s what I’m trying to achieve. As the data returned ‘downloadurl’ is a string, Bubble treats it like a string and does not provide the ‘save to S3’ option. What I’m looking for is like a ‘file_put_contents’ from PHP, or something equivalent. I just need to tell my workflow to download the file, and save it in the database.

Ok 2nd sorry, found how to do it.

I detected the incoming data, and changed the type of ‘downloadurl’ from text to file in the workflow. Now, Bubble understand that it needs to download it and save it in the dabatase.

Thanks a lot for your help !

3 Likes

I’m having a similar situation, where I’m trying to download data (from a link that I’m getting from SP-API), but i don’t know where to start :wink:.

Can you please give me the steps on you were able to do it?

OPs solution worked for me as well.

So first I went to the plugins section to where the API call is handled and I re-initialized the API call in order to change the download_url from type “text” to type “file”.

I my case I wanted to attach this file to an email. So I added the email workflow and when I chose the file to attach I took the above mentioned download_url with the addition “:saved to s3”

In addition to this make sure you add the correct file ending. I my case it was “.pdf”

Hope this helps.

3 Likes