I’m not familiar with n8n but it’s fairly straightforward on the API side.
You’ll need a session token, also known as JWT, which you can get from logging in.
You typically don’t want to do a login for every post, so you’ll want to store that as a persistent value.
For authentication, you can pass the header authorization: Bearer {jwt}
, with {jwt}
being the session token.
https://join-lemmy.org/api/classes/LemmyHttp.html contains the API documentation.
You’ll need to figure out the id of the community that you want to post to.
If you need to look it up, you can use getCommunity to fetch its details. Afterwards you can use createPost to submit it.
The form
links for the methods explain the request body json values that should be provided.
I think most (especially mobile) clients simply don’t have this option and will always copy/share the “fedi link” - the url where the content is canonically hosted. all other URLs are simply cached representations of the original content.