For the Gmail node to reply to a message, is there any way to make the attachments variable and conditional? For example, the data being passed in sometimes has binary data in field attachment_0 , and sometimes there’s binary data in field attachment_0 and attachment_1 , while most of the time there’s no binary data. Right now it seems like it needs to be hardcoded in and it complains if there’s no data in those fields
Welcome to the community @axs! First would be great if you could change your username. If people come for help, the least we (or at least I) expect is that people use their name, or at least make one up instead of using ours.
To answer your question.
Currently it is not possible to say to sometimes send attachments and sometimes not. So you would have to have an IF-Node in front of it with an expression like this:
{{ Object.keys($input.item.binary).length }}
It will return the number of attachments. So you can then route the ones without attachments to a Gmail node without attachments and anything that has a number that is higher than 0 to one that has attachments defined under “Options”.
On the node that has attachments you can then use the following expression:
{{ Object.keys($input.item.binary).join(',') }}
It will then automatically fill the field with a comma-separated list of all the binary properties.