7
submitted 3 weeks ago* (last edited 3 weeks ago) by chobeat@lemmy.ml to c/lemmy@lemmy.ml

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
[-] Nothing4You@programming.dev 1 points 3 weeks ago

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.

[-] chobeat@lemmy.ml 1 points 2 weeks ago

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

this post was submitted on 25 Oct 2024
7 points (81.8% liked)

Lemmy

11948 readers
3 users here now

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

For discussion about the lemmy.ml instance, go to !meta@lemmy.ml.

founded 4 years ago
MODERATORS