Use binary data from IMAP trigger in HTTP/GraphQL request

Hey, I’m trying to automate an incoming email. It has attachments, which need to be uploaded to a server (which will be using HTTP with a body request GraphQL). Addiontionally, if it’s possible, I’d like to get the sizes of the attachments and filter them. I’ve been struggling with this all day, is there someone who can help me further?

Here’s a relevant documentation page:
Files (assets) (

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @OpenSourceSimon, from looking at the example request they have linked in their documentation, expects form data:

In n8n you can send such requests using the HTTP Request node, for example:

Perhaps you want to give this approach a go? You would need to adjust the binary property name to match what’s coming from your IMAP trigger node (most likely attachment_0). Let me know if you run into any trouble with this.


Wow, that works great! Thanks so much! Do you have an example code to filter the sizes of the binary, like delete the binary things that are under 900 Bytes? Also if the trigger has multiple binary files, how can I loop over them so they all will be uploaded?

@MutedJam Do you have some time to take a look at my question? Thanks in advance!

Hi @OpenSourceSimon, sorry it took me a while to check back on this.

There’s two aspects here and I’d actually suggest handling the second part first. Things will generally be simpler once you have converted one item with multiple binary objects into multiple items with one binary object each. This can be achieved with a workflow template I’ve created a while back.

Filtering by size can then be done for each item individually like so. Here’s an example workflow bringing the two pieces together:

At the end you’ll have only items with a certain file size left:

Hope this helps!


Awesome, works perfectly! Thank you so much!!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.