Pull attachments from Gmail trigger and merge with revised content for LinkedIn

I am trying to extract the attachments, which may be as many as 5 images, and merge them with content from the gmail trigger that has been revised.

the merge node wont take the “content” variable. and i’m not sure i am doing this correct honestly. i have been working for ten hours on this so far. i want to end up with content and images ready to post into LinkedIn on monday mornings.

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

Hey @baldguydesign

You can’t upload multiple images on LinkedIn using n8n LinkedIn node.

For upload multiple images on LinkedIn you want to use HTTP node to call LinkedIn API.

Official API Documentation: Share on LinkedIn - LinkedIn | Microsoft Learn

@bhavyshekhaliya Thank you for that, good to know.

i will change that in the workflow. do you know why the “Prepare LinkedIn Post” node is saying that the postContent field is undefined when there is clearly data there?

Can you share updated workflow so I can debug the issue

sure! thank you!!

here it is:

Just Update you Merge node and problem solved :grinning_face:

@bhavyshekhaliya i made the change to the merge node however the content is still not populating. the output node is still showing undefined:

thank you so much!

@baldguydesign It’s working brother in your given workflow

1 Like

@bhavyshekhaliya man, i am lost suddenly. on my end i am seeing it as undefined.

i have it being sent to an email to check the content and the pics are missing. now i dont know if i am doing this the best way. ugg

i appreciate the help for sure!!

Try to remove the expression {{$json.output}} , and either drag&drop directly into that field, or start typing yourself the expression (sometimes copy/paste expression do NOT work).

Cheers!

1 Like

@bhavyshekhaliya and @Parintele_Damaskin

an update to my n8n version fixed the issue! thank you both so much for your help.

i hope you dont mind helping me with the last piece? now when i send an email to myself to check the content i get an error: The item has no binary field ‘nc_25-02-06_love-sale_digAd_125x125.jpg’ [item 0] (item 0)

In the Gmail node’s attachments configuration, use the binary property name (e.g., attachment_0, data, etc.), not the actual file name. You used {{ $json.attachment2.fileName }} but in the previous node you used attachment_0 etc…

Beside that, you can use a single expression to join the files :

{{ Object.keys($binary).join(‘,’) }}

like in this post here

P.S Visually in UI, if you want to put each attachment as you did, be sure to use in the field the orange text.

Cheers!

1 Like

so i added the expression and didnt get it to resolve.

i tried another version and i got the files pulled but it still showed no data.

any help is greatly appreciated. i really dont even need the gmail other than as a check before it is posted to LinkedIn.

Hey @baldguydesign !
If you copy the an expression that contains ’ character it may be turned into curly braces, that’s where your send message3 gmail has in your last workflow shared and said invalid syntax, and this is correct syntax:

Then in your send message 1 you pointed to the filename instead binary this should be correct:

2 Likes

Your binary should ALWAYS be available in your pipeline in the node right before the one you want to attach it to as @Parintele_Damaskin pointed out, the field is looking for the Name and not the content. So just make sure the binary is flowing through all nodes.

PS, not all nodes pass through previous variables and binary data, so you need to make sure it is available at the point you want to reference it.

2 Likes

@bhavyshekhaliya, @Parintele_Damaskin, and @Wouter_Nigrini,

Thank you so much! Everything seems to be working correctly.
You have all been amazing!!

d-_-b

1 Like

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