this post was submitted on 10 Apr 2024
17 points (100.0% liked)

Lemmy Bots and Tools

455 readers
1 users here now

Welcome to the programming.dev lemmy development community! This is a place to discuss and show off bots, tools, front ends, etc. you're making that relate to lemmy

Theres another version of this community over at lemm.ee if you want to subscribe to that one as well

Icon base by DarkZaitzev under CC BY 3.0 with modifications to add a gradient

founded 1 year ago
MODERATORS
 

Hi there!

Since the last time the LemmyWebhook package gained quite a few new capabilities so I've decided it's time for another post.


Quick intro to the package: It adds support for webhooks to Lemmy, meaning you can get notified of events to automatically react to, instead of having to poll for everything, often using multiple http requests. Everything is done in a quite efficient way which avoids hitting your database as much as possible and if it does, it only uses queries on primary key. You can also (optionally) make it available to other users who can then run their bots on your instance only on the permissions you allow them, meaning if you only grant them access to post events, they don't also get access to new user events.


So, what's new?

  • When you listen for an update event, you get the previous version of data in addition to the current one, meaning you can directly compare what has changed
  • New function for getting parent comment id have been added, with this you can for example detect if someone is replying to your bot
  • You can now listen for community subscribe/unsubscribe event

As usual, let me know what you think, feel free to offer suggestions or ask questions.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] RonSijm@programming.dev 1 points 7 months ago (1 children)

It seems a bit weird to do this though webhooks, since Lemmy already operates thought ActivityPub.

meaning you can get notified of events to automatically react to, instead of having to poll for everything, often using multiple http requests.

So instead of polling, or creating a webhooks, and webhook tables etc, wouldn't it make more sense to let bots subscribe through ActivityPub?

[โ€“] rikudou@lemmings.world 2 points 7 months ago

Which is much more complicated than a simple http endpoint is. ActivityPub is quite complicated. And ActivityPub is purely for content, there's no way to get the email of your new user and check it against known spam domains. Not sure if there's an acitvity pub message for a federation event. There definitely isn't one for registration application. In short, ActivityPub is not meant for such use-cases, webhooks are.