[Feature Request]: Send username of the user that created the page in the webhook #2665

Closed
opened 2026-02-05 04:44:58 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @joaomezzari on GitHub (Feb 22, 2022).

Originally assigned to: @ssddanbrown on GitHub.

Describe the feature you'd like

Hi,
In order to do some notifications, we need that the outgoing webhook sends the username of the user that created the page where the event is happening, in the payload. Something like:
{ "event": "page_update", "text": "Benny updated page \"My wonderful updated page\"", **"page_owner": "username"** "triggered_at": "2021-12-11T22:25:10.000000Z", "triggered_by": { "id": 1, "name": "Benny", "slug": "benny" }, "triggered_by_profile_url": "https://bookstack.local/user/benny", "webhook_id": 2, "webhook_name": "My page update webhook", "url": "https://bookstack.local/books/my-awesome-book/page/my-wonderful-updated-page", "related_item": { "id": 2432, "book_id": 13, "chapter_id": 554, "name": "My wonderful updated page", "slug": "my-wonderful-updated-page", "priority": 2, "created_at": "2021-12-11T21:53:24.000000Z", "updated_at": "2021-12-11T22:25:10.000000Z", "created_by": 1, "updated_by": 1, "draft": false, "revision_count": 9, "template": false, "owned_by": 1 } }

Describe the benefits this feature would bring to BookStack users

By sending the username, we can integrate notifications with other platforms consuming the APIs and directing something to the specific user, for example.

Additional context

No response

Originally created by @joaomezzari on GitHub (Feb 22, 2022). Originally assigned to: @ssddanbrown on GitHub. ### Describe the feature you'd like Hi, In order to do some notifications, we need that the outgoing webhook sends the username of the user that created the page where the event is happening, in the payload. Something like: `{ "event": "page_update", "text": "Benny updated page \"My wonderful updated page\"", **"page_owner": "username"** "triggered_at": "2021-12-11T22:25:10.000000Z", "triggered_by": { "id": 1, "name": "Benny", "slug": "benny" }, "triggered_by_profile_url": "https://bookstack.local/user/benny", "webhook_id": 2, "webhook_name": "My page update webhook", "url": "https://bookstack.local/books/my-awesome-book/page/my-wonderful-updated-page", "related_item": { "id": 2432, "book_id": 13, "chapter_id": 554, "name": "My wonderful updated page", "slug": "my-wonderful-updated-page", "priority": 2, "created_at": "2021-12-11T21:53:24.000000Z", "updated_at": "2021-12-11T22:25:10.000000Z", "created_by": 1, "updated_by": 1, "draft": false, "revision_count": 9, "template": false, "owned_by": 1 } }` ### Describe the benefits this feature would bring to BookStack users By sending the username, we can integrate notifications with other platforms consuming the APIs and directing something to the specific user, for example. ### Additional context _No response_
OVERLORD added the 🔨 Feature Request📖 Docs Update labels 2026-02-05 04:44:58 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Feb 28, 2022):

Thanks for the request @joaomezzari,

My trouble with this is that we have to limit the scope of the webhook data somewhere, we can't just add or load in all details ever needed. For things outside of that it'd be a case look back up to the REST API.
That said, maybe we should still load in common relations for the main entities like the creator and updater. In that case it'd be accessible (in theory) at related_item.owned_by.slug.
This may be a breaking change to the webhook shape though so not something for a patch release.

If you're desperate for this, and can piece together PHP, there's a WEBHOOK_CALL_BEFORE event for the logical theme system that can be used to customize the webhook data.

@ssddanbrown commented on GitHub (Feb 28, 2022): Thanks for the request @joaomezzari, My trouble with this is that we have to limit the scope of the webhook data somewhere, we can't just add or load in all details ever needed. For things outside of that it'd be a case look back up to the REST API. That said, maybe we should still load in common relations for the main entities like the creator and updater. In that case it'd be accessible (in theory) at `related_item.owned_by.slug`. This may be a breaking change to the webhook shape though so not something for a patch release. If you're desperate for this, and can piece together PHP, there's a `WEBHOOK_CALL_BEFORE` event for [the logical theme system](https://github.com/BookStackApp/BookStack/blob/development/dev/docs/logical-theme-system.md) that can be used to customize the webhook data.
Author
Owner

@ssddanbrown commented on GitHub (Mar 26, 2022):

I have now applied changes related to this within 3625f12abe. Creator, Updater and Owner details are now loaded in so you'd be able to get the owner slug at related_item.owned_by.slug. Trimmed-down example data:

{
    "event": "page_update",
    ...
    "url": "https://bookstack.local/books/my-awesome-book/page/my-wonderful-updated-page",
    "related_item": {
        "id": 2432,
        ...
        "created_by": {
            "id": 1,
            "name": "Benny",
            "slug": "benny"
        },
        "updated_by": {
            "id": 1,
            "name": "Benny",
            "slug": "benny"
        },
        "owned_by": {
            "id": 1,
            "name": "Benny",
            "slug": "benny"
        },
        ...
    }
}

These changes will be part of the next feature release.

Note-to-self when updating docs/release-notes

This is a breaking change. IDs previously obtained at created_by/updated_by/owned_by will need to instead use the id property at those locations (related_item.owned_by.id).

@ssddanbrown commented on GitHub (Mar 26, 2022): I have now applied changes related to this within 3625f12abe7c0cc052bd027af961d0214d6fcc7e. Creator, Updater and Owner details are now loaded in so you'd be able to get the owner slug at `related_item.owned_by.slug`. Trimmed-down example data: ```json { "event": "page_update", ... "url": "https://bookstack.local/books/my-awesome-book/page/my-wonderful-updated-page", "related_item": { "id": 2432, ... "created_by": { "id": 1, "name": "Benny", "slug": "benny" }, "updated_by": { "id": 1, "name": "Benny", "slug": "benny" }, "owned_by": { "id": 1, "name": "Benny", "slug": "benny" }, ... } } ``` These changes will be part of the next feature release. ### Note-to-self when updating docs/release-notes This is a breaking change. IDs previously obtained at `created_by`/`updated_by`/`owned_by` will need to instead use the `id` property at those locations (`related_item.owned_by.id`).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#2665