this post was submitted on 25 Oct 2024
6 points (80.0% liked)

Lemmy

2172 readers
93 users here now

Everything about Lemmy; bugs, gripes, praises, and advocacy.

For discussion about the lemmy.ml instance, go to [email protected].

founded 4 years ago
MODERATORS
 

Hello.

I was developing a system/tutorial on how to build a self-hosted, collaborative content circulation no-code setup, using nocodb and n8n.

n8n does not yet support lemmy, not even through community nodes.

I can try to go through the API using the HTTP node, but I wanted to ask if there's some tutorial with examples that I can use, because so far most of the documentation I've found is focused on building alternative clients and that's a lot of overhead, especially in how I'm supposed to handle the credentials.

That said, I'm opening this postly mostly to see if there would be interest in developing a community node. This should be a quite easy project for anybody familiar with Lemmy and Lemmy's REST API. Here's a community node for mastodon, that looks quite close to what Lemmy's community node could look like.

https://github.com/n8n-community-node/n8n-nodes-mastodon/tree/master/nodes/Mastodon

It's mostly a matter of specifying a bunch of metadata about the fields of the node, and implement a few calls to the API. I know some TS and JS but they are not my strongest language. If somebody is willing to lead this effort though, I could contribute some code and some design documents.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 2 points 1 month ago (1 children)

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.

[โ€“] [email protected] 2 points 3 weeks ago

I made it! It wasn't that hard, the API was quite straightforward.