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).

  • Nerd02@lemmy.basedcount.com
    link
    fedilink
    English
    arrow-up
    2
    ·
    11 months ago

    That’s awesome. I’ll rewrite all of my instance’s bots to use that in the next months. I like how lightweight this appears to be.

    Do you think it would be possible to host a bot on a servless platform, if the Lemmy instance uses Lemmy Webhook? It might be a bit slower due to cold starts, but I think it should be theoretically possible.

    • Rikudou_Sage@lemmings.worldOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      11 months ago

      Yes, it is, my ChatGPT and DallE bots are hosted on AWS Lambda. The cold starts are negligible, you’re looking at ~3 seconds overhead at worst (sans outages).