page_restore does not trigger the webhook #5575

Open
opened 2026-02-05 10:10:46 +03:00 by OVERLORD · 4 comments
Owner

Originally created by @mweinbergh on GitHub (Jan 23, 2026).

Describe the Bug

I have set up a webhook that is triggered by all page_* events. When I restore a page from the Recycle Bin, the page_restore event does not trigger the webhook. The page_restore event is logged in the audit log.

Steps to Reproduce

  1. Set up webhook
  2. Enable page_restore as trigger
  3. Restore page from Recycle Bin

Expected Behaviour

Calling the webhook URL

Screenshots or Additional Context

No response

Browser Details

No response

Exact BookStack Version

v25.07.1

Originally created by @mweinbergh on GitHub (Jan 23, 2026). ### Describe the Bug I have set up a webhook that is triggered by all page_* events. When I restore a page from the Recycle Bin, the page_restore event does not trigger the webhook. The page_restore event is logged in the audit log. ### Steps to Reproduce 1. Set up webhook 2. Enable page_restore as trigger 3. Restore page from Recycle Bin ### Expected Behaviour Calling the webhook URL ### Screenshots or Additional Context _No response_ ### Browser Details _No response_ ### Exact BookStack Version v25.07.1
OVERLORD added the 🐛 Bug label 2026-02-05 10:10:46 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Jan 24, 2026):

Hi @mweinbergh,

The page_restore event is for when a page is restored from a page revision.
You'd instead want to listen to the recycle_bin_restore for recycle-bin-based restore events.

@ssddanbrown commented on GitHub (Jan 24, 2026): Hi @mweinbergh, The `page_restore` event is for when a page is restored from a page revision. You'd instead want to listen to the `recycle_bin_restore` for recycle-bin-based restore events.
Author
Owner

@mweinbergh commented on GitHub (Jan 26, 2026):

Hi Dan,
that's not quite what I'm observing.
When I restore a revision, the page_restore event is triggered, followed by the revision_restore event.
When I restore a page from the recycle bin, only the recycle_bin_restore event is triggered. However, this does not contain any information about which page was restored (“related_item”). For all other page_* events, I get the affected page via “related_item”. I need this information to update our embeddings database.

I have attached a log from a test webhook that shows the events with the request parameters. For the test, I activated all page_*, recycle_bin_restore, and revision_restore events in the webhook settings.
bookstack_webhook_test.log

And these are the events from the audit log:
2026-01-26 07:51:30 | page_update | page | 436 | page1
2026-01-26 07:52:32 | page_restore | page | 436 | page1
2026-01-26 07:52:32 | revision_restore | None | None | Revision #6 (ID: 16232) for page ID 436
2026-01-26 07:53:13 | page_delete | page | 436 | page1
2026-01-26 07:54:03 | recycle_bin_restore | None | None | Deletion (150) for page (436) page1

@mweinbergh commented on GitHub (Jan 26, 2026): Hi Dan, that's not quite what I'm observing. When I restore a revision, the page_restore event is triggered, followed by the revision_restore event. When I restore a page from the recycle bin, only the recycle_bin_restore event is triggered. However, this does not contain any information about which page was restored (“related_item”). For all other page_* events, I get the affected page via “related_item”. I need this information to update our embeddings database. I have attached a log from a test webhook that shows the events with the request parameters. For the test, I activated all page_*, recycle_bin_restore, and revision_restore events in the webhook settings. [bookstack_webhook_test.log](https://github.com/user-attachments/files/24856215/bookstack_webhook_test.log) And these are the events from the audit log: 2026-01-26 07:51:30 | page_update | page | 436 | page1 2026-01-26 07:52:32 | page_restore | page | 436 | page1 2026-01-26 07:52:32 | revision_restore | None | None | Revision #6 (ID: 16232) for page ID 436 2026-01-26 07:53:13 | page_delete | page | 436 | page1 2026-01-26 07:54:03 | recycle_bin_restore | None | None | Deletion (150) for page (436) page1
Author
Owner

@ssddanbrown commented on GitHub (Jan 29, 2026):

Thanks for the extra information @mweinbergh.

It looks like the related_item detail is not being added to the webhook due to the deletion model extending the wrong model class (should be the BookStack specific model class).

I could update this issue to focus on fixing that, so deletion data will be emitted on the restore event.
That said, I'm not sure that would provide what you desire. That data would contain which item was deleted, but if a parent chapter/book is restored, then it won't directly reference the the child page, or be emitted for each child page for the deleted item. You'd have to perform additional steps to consider that.

@ssddanbrown commented on GitHub (Jan 29, 2026): Thanks for the extra information @mweinbergh. It looks like the `related_item` detail is not being added to the webhook due to the [deletion model extending](https://github.com/BookStackApp/BookStack/blob/5754acf2fb9fcb60bb2ffd95bab3b0bcb1b162fd/app/Entities/Models/Deletion.php#L19) the wrong model class (should be the BookStack specific model class). I could update this issue to focus on fixing that, so deletion data will be emitted on the restore event. That said, I'm not sure that would provide what you desire. That data would contain which item was deleted, but if a parent chapter/book is restored, then it won't directly reference the the child page, or be emitted for each child page for the deleted item. You'd have to perform additional steps to consider that.
Author
Owner

@mweinbergh commented on GitHub (Feb 2, 2026):

Hi Dan,
thank you for looking into this and for the possible fix. Implementing it would help me.
You're right that I would need to do some follow-up work in the case of restored shelves/books. But that's no big deal.
Cheers, Michael

@mweinbergh commented on GitHub (Feb 2, 2026): Hi Dan, thank you for looking into this and for the possible fix. Implementing it would help me. You're right that I would need to do some follow-up work in the case of restored shelves/books. But that's no big deal. Cheers, Michael
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5575