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.

  • @RonSijm
    link
    12 months ago

    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_SageOP
      link
      fedilink
      English
      22 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.