Bookstack: Notification webhook framework

Created on 13 Jul 2016  Â·  34Comments  Â·  Source: BookStackApp/BookStack

It would be nice if there was a global settings page and the framework to enable activity log notifications.

Notification when a page is created/modified/deleted
Notification when a user is created/modified/deleted
Notification when a file is created/modified/deleted

Notifications could be sent to several possible endpoints, but Slack and Rocket.Chat would be likely good first choices. Eventual additions could be email or messenger platform notifications to the admins

Open to discussion Enhancement

Most helpful comment

Nothing currently in the works for this at the moment. Notifications is a wide topic so I'd say as a stage 1 to complete this issue the focus is put on the basics of the original issue description:

  • Implementation of a global setting of slack-compatible web-hooks that are called upon page/chapter/book/user creation/modification/deletion.

The Web-hook URL and the subscribed events should be configurable and multiple web hooks should be able to be configured. For now it may be best to keep the contents of these hooks simple, With just the common text property within JSON as supported by slack, matter-most & teams.

There's currently an activity service which all activity creation runs through so that may be the best place to manage these events.

After the implementation of this we can then move focus to user-level notifications and expanding admin level notifications.

I am a bit worried about the performance cost of expanding out a notification system like this on a PHP based application. Once it gets to the point that saving a page fires of a couple of web-hooks and a bunch of emails things will start to get slow. I know a queue could be implemented but that will complicate application requirements, installation and maintenance.

All 34 comments

I support this suggestion. The ability to add a webhook for slack would remove quite a few other "nice to have" features from our wish list.

+1

Always a fan of webhooks! +1

Definite +1

+1, anything in the works for this? IF not, can you point me to where I might make the changes myself?

Nothing currently in the works for this at the moment. Notifications is a wide topic so I'd say as a stage 1 to complete this issue the focus is put on the basics of the original issue description:

  • Implementation of a global setting of slack-compatible web-hooks that are called upon page/chapter/book/user creation/modification/deletion.

The Web-hook URL and the subscribed events should be configurable and multiple web hooks should be able to be configured. For now it may be best to keep the contents of these hooks simple, With just the common text property within JSON as supported by slack, matter-most & teams.

There's currently an activity service which all activity creation runs through so that may be the best place to manage these events.

After the implementation of this we can then move focus to user-level notifications and expanding admin level notifications.

I am a bit worried about the performance cost of expanding out a notification system like this on a PHP based application. Once it gets to the point that saving a page fires of a couple of web-hooks and a bunch of emails things will start to get slow. I know a queue could be implemented but that will complicate application requirements, installation and maintenance.

Hi @ssddanbrown , I am really interested in the idea of having notification webhook framework. I have divided it into three steps. They are:

  1. Bookmarks/Subscription
  2. Email Notification
  3. Webhook Notification

Currently I am focusing on the first two modules.

Initial implementation can have the following:

  • At first we need to have a subscription/bookmark button/icon for all the books, chapters and pages.
  • If the user wants to subscribe to a particular book/chapter/page, he has to click on the bookmark icon available there.
  • Once the user clicks on the bookmark icon, the details of the user along with the details of the bookmarked book/chapter/page will be stored in the database and a subscription message will be sent to all the subscribers of that page along with the new user using message queue.
  • We will be providing this option of entering the credentials of message queue tool in the .env file while installation of the application only.
  • If the credentials for the message queue tool installed in the system is not provided, the user can only see the notifications.
  • In the global settings page we’ll have a message queue flag which will be turned on when you will provide the credentials of the installed message queue tool in the .env file.
  • If there is no message queue tool (for example- RabbitMQ, ActiveMQ) installed on the user’s system, then there is no point of subscription.
  • We can even build a notification system like in Facebook which will continuously update the user about his/her subscribed pages.
    Examples of such notifications are:

    • User subscribed to Book/Chapter/Page Name.

    • User created Chapter/Page Name.

    • User Modified Book/Chapter/Page Name.

Please do give your feedback.

+1 for this as well - Slack is probably a great use case for this

+1 very interesting for slack

Still interested in some way to get notifications from bookstack when someone creates a page or comments. I see that slack has an RSS plugin, so if you output an RSS feed that might be a quick win and I could integrate into slack.

"The RSS integration allows you to subscribe to an RSS or Atom feed URL and receive updates in Slack. Feeds will be fetched periodically, and new items will be posted to the specified channel."

thanks all

A temporary (far from ideal, but possible) way of doing this could be setting up a little service that connects directly to the DB, stores the ID of the last entry in the relevant table, and then checks periodically for new entries. It could then send notification of the new entries somewhere.

If getting notifications into Bookstack is difficult, would this be worth writing? I might be able to do it if it would help people.

A small service that can run periodically sounds like a nice idea. This does not complicate the setup and configuring a cronjob is a default feature on almost every shared hosting company so you will retain compatibility.

Let me know if you are going down that road and if I can help out.

+1 Rss feed.

Has there been any progress on email notifications? Is this in the RoadMap?

@tommyz4 Kind of on the road map. Email notifications appears to be open under #935.

There's a little bit of conversation about this issue. Is one of the highest rated issues so won't go ignored. Email notifications would be an extension/continuation of this issue once in-place as per my comment here: https://github.com/BookStackApp/BookStack/issues/147#issuecomment-291268041

This feature plus the api feature #823 together would allow for custom workflows and automation. This would mean bookstack could stay simple yet developers could develop very specific use cases outside of the codebase. I think this could be very powerful.

Basic RSS (with secret token for private access) would work well for any read-only "notifications" such as displaying latest edited items somewhere else etc.

Because we have a need for RSS in our team, I hacked a dirty feed solution in https://github.com/ezzra/BookStack/tree/dirty_feed or you can comment here in this fake pull request: https://github.com/BookStackApp/BookStack/pull/1165

It is actually working, if you want to reuse it (@nekromoff and others), commit it to your code. Then run composer install and add APP_FEED_TOKEN=xxx to your .env. Of course, xxx should be any random string, that makes the feed accessible without logging in!

Be aware! The code is really dirty and its just working without beeing pretty, so please keep in mind:

  • there are separated feeds for a book (all sortings and page changes within a book), a chapter (all page changes within a chapter), a page (all changes to this page)
  • shelves are not included yet because we dont use them (harhar), but you might be able to adapt it to the code if you like
  • you can just use your browsers feed button, the feed button is everywhere, but it only works on a book, chapter or page site
  • you must set the feed token, otherwise the feed will be accessible from not logged in users easily.
  • _any user who has a login and gets knowledge about the feed token has access to the whole feed_! So even when she has no access to a specific book or page, she can access the feed because it is only guarded by the system wide feed token!
  • this is also the fact if you delete an account, the user will still have access to the feed (unless you change the token)!
  • the feed does not tell anything about the content of a page, just "metadata"

so you can see, its a fast dirty hack, but it works. It could be made better of course. But its a wrong way, because there much more needs to be a system internal solution for subscriptions where notifications can be created in different ways (email, OS notification, RSS, ...) only for specific user accounts. That is why I wont put more work into that dirty way here.

Great, much appreciated. I am going to look into it and report back.

On Sat, Dec 8, 2018, 13:51 ezzra <[email protected] wrote:

Because we have a need for RSS in our team, I hacked a dirty feed
solution in https://github.com/ezzra/BookStack/tree/dirty_feed

It is actually working, if you want to reuse it (@nekromoff
https://github.com/nekromoff and others), commit it to your code. Then
run composer install and add APP_FEED_TOKEN=xxx to your .env. Of course,
xxx should be any random string, that makes the feed accessible without
logging in!

Be aware! The code is really dirty and its just working without beeing
pretty, so please keep in mind:

  • there are separated feeds for a book (all sortings and page changes
    within a book), a chapter (all page changes within a chapter), a page (all
    changes to this page)
  • shelves are not included yet because we dont use them (harhar), but
    you might be able to adapt it to the code if you like
  • you can just use your browsers feed button, the feed button is
    everywhere, but it only works on a book, chapter or page site
  • you must set the feed token, otherwise the feed will be accessible
    from not logged in users easily.
  • any user who has a login and gets knowledge about the feed token
    has access to the whole feed
    ! So even when she has no access to a
    specific book or page, she can access the feed because it is only guarded
    by the system wide feed token!
  • this is also the fact if you delete an account, the user will still
    have access to the feed (unless you change the token)!

so you can see, its a fast dirty hack, but it works. It could be made
better of course. But its a wrong way, because there much more needs to be
a system internal solution for subscriptions where notifications can be
created in different ways (email, OS notification, RSS, ...) only for
specific user accounts. That is why I wont put more work into that dirty
way here.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/BookStackApp/BookStack/issues/147#issuecomment-445456955,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIJ3zSRgLbHwTdPOPrQMfhMq6ANM-pUoks5u27XigaJpZM4JK9si
.

Any update on this? Would love to contribute and help out, or even kickstart it.

@irman Upcoming on the roadmap is an API for BookStack. That will likely provide a lot of the groundwork/cleanup for a feature like this. This feature may be part of that API process, Depending on how things go.

Upcoming on the roadmap

@ssddanbrown looks like this roadmap link is somehow broken :)

@ezzra Whoops, thanks for letting me know, now updated.

+1 :)
When I create page I would like to inform somehow the peoples that new page was created for them.

+1

Laravel supports queues which we could run with "supervisor"!
https://laravel.com/docs/5.8/queues

+1
Email notifications, please!

Yes please. Need webhook or at least RSS feed so we can make our own.

There already are columns called "recently updated pages" and "recent activity". Isn't it possible to use same source to make an RSS feed for now?

+1

I've just spent an hour configuring bookstack email backend, just to find out that this feature, which I've taken for granted, isn't available. So the whole point of configuring the mail backed is to send the registration email? I thought it was quite common for a team working on the same documentation to be notified on new/updated pages. I'm not speaking about something complex, such as a third party integration with slack for example, but the very basic "email update" should definitely be there.

So the whole point of configuring the mail backed is to send the registration email?

No, It can also be used for email confirmation & password resets :love_letter:

+1 for Slack notifications !

+1 Slack notifications would be a great feature

+1 for email notifications

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidtessier picture davidtessier  Â·  3Comments

gab-cass picture gab-cass  Â·  3Comments

ensemblebd picture ensemblebd  Â·  3Comments

Nedimko123 picture Nedimko123  Â·  3Comments

Zeigren picture Zeigren  Â·  3Comments