Upload image file (not URL) directly to Notion?

Still trying to pull receipt images from my banks API into something but it seems Notion (and Google Sheets FYI) can only work with URLs which isn’t helpful in my case.

Is there some way to have Notion accept a direct upload to the file property of a database entry that I’m missing?

Any info much appreciated

Hi @Tony_McHugh, the situation is pretty much the same with Notion I am afraid. Their API does not allow uploading files:

The same would be true for many other popular services (such as Airtable) I am afraid, so n8n can’t implement a direct upload functionality here either and you would need to first make your file available under a public URL (such as AWS S3 for example).

One service supporting file uploads would be Baserow, so perhaps this could be an alternative for you? n8n doesn’t have native support for their upload_file endpoint at the moment, but this could be achieved with the HTTP Request node.

For a database like this:

image

The below workflow would do the job:

Yeah I suspected as much so just went with Google Drive in the end.
Thanks again for your help @MutedJam

A consideration - not tested; to avoid having to use other services:

Use wait node:

Appreciate the input @BillAlex though I’m not sure I understand your suggestion fully - would you mind elaborating?

Yes Sir :sunglasses:

The prerequisite for everything is, of course, that your n8n webhooks are publicly accessible.

It depends on the service.
If I interpret the API File object correctly, you need a “public” URL. Just means that a server must be able to call this URL. Primarily once via a GET method.

To not make the file available somewhere, you give the API a throwaway url “Wait webhook”. The service should call this URL directly (the wait node should already be waiting) and the workflow will continue: The file is read and returned as a response file.

Step-by-step:

  • Workflow start
  • Generate Wait URL
  • Request URL/API
  • Parallel: Wait node waits for response
  • Foreign API server calls wait node
  • The file is read
  • n8n responds with the file as HTTP response

It might be hard to execute the HTTP Request node PARALLEL to the Wait node. Possibly an additional wait node (timing) must be set. Depending on when the server sends its response. Either it tries to download the file when it is called (in which case the wait may not be running yet) or it downloads the file after the response. If you have bad luck it makes several GET requests.

A safer variant would be, simply create another workflow >> Webhook >> file read >> answer. You can also do this with parameters, if you don’t want to create a webhook for every file. Info: If the URL with parameters bothers you (the node UUID is used) you can copy the node and rewrite the ID to something readable in an editor. Works great. Or much simpler: use a query for path.

I have done some test and … yes … the wait node is not the best option. You can’t execute nodes parallel…

So a webhook is the better option.

For more security, be sure to check the path beforehand.

But I’m just thinking if you can bypass the server with a base64 download url? :thinking:

Haha some effort Bill thanks! I’ll have a think about this though it’s probably over my head honestly