1
54

It's been a while since I've last posted about this package and quite a lot has changed since then.


So, what does this package do? It adds support for webhooks to Lemmy in an efficient way, meaning you can subscribe to various events like a new post created, new comment added and so on. Very useful, for example, for automods or other bots that need to react fast.

Since the last time I've added more object types, so in addition to posts and comments you can now listen for:

  • comment reports
  • instances being added or updated (for example federation changes)
  • local users (users local to your instance, it's a distinct type from all users, it contains stuff like email and other stuff that doesn't get federated to other instances)
  • all users in general (this includes federated and local users)
  • post reports
  • private messages (does not contain the message text itself, only metadata like recipient and the author)
  • private message reports
  • registration applications

Another huge improvement is an api that allows users to create webhook and even more importantly a simple GUI for management of your webhooks. This means that this package is no longer only for instance admins, but bot authors in general can ask their instance admins for access to webhooks (and to install the webhooks package to their Lemmy instance if they don't have it yet) and if the admins grant it, you now have access to webhooks. Every access is scoped, meaning if your bot only needs access to posts, you don't need to ask for the permission to receive registration applications, meaning admins can freely grant you access to webhooks without also giving you access to stuff you shouldn't have access to.


There's also support for bulk import of webhooks based on a YAML document, meaning creators of bots and other applications that have support for webhooks can create a YAML document with all the webhooks other people then can import without any trouble. Each imported webhook needs a unique ID which allows the system to track changes to it which allows the importer to update old webhooks instead of duplicating them (as long as they share the same ID).


Let me know what you think, your ideas for improvements or any comments in general are welcome!


P.S. If someone wants to try it out, you can use my instance. The webhooks are available at https://webhooks.lemmings.world (accounts must be manually approved, so be patient and ideally write me a PM if you want the access quicker).

2
54

Note that unless you're a Lemmy instance admin, this doesn't have much use to you.

Until this package came along, if you wanted a bot that responds to events, you had to manually traverse all comments/posts/whatever at a fixed interval. With this package you can actually react to events directly from the database. It's implemented in a very efficient way by connecting the package directly to the Lemmy database and using native Postgres features to get the events (LISTEN/NOTIFY if you want to get technical).

The webhooks themselves are inserted into a separate SQLite database (API is coming) and allow for both simple and complex filtering of the incoming data. The system is already in use by two of my bots, @ChatGPT@lemmings.world and @DallE@lemmings.world who now both receive the information about being tagged in a comment in seconds (the actual reply takes a little longer, but that's because of the nature of the bot).

Currently you can be notified about a post or a comment, other types are trivial to include as well.

Let me know what you think!

view more: next ›

Lemmy.institute

49 readers
0 users here now

Looking for a new home for your community of nerds? You've come to the right place. Lemmy.institute was created as a home for all kind of science and technology-related communities.

Community Guidelines

Please be respectful toward fellow members of the fediverse. We encourage open discussion, but we do not tolerate spam, harassment, or disrespectful behaviour. Let’s keep it civil!

Pornographic (NSFW) contents are not allowed.

Do you want to create and moderate a new community? Post a request at c/communityrequest

Misc

founded 1 year ago
ADMINS