You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
Creates a new organsied formatting system for webhook data, with
interfaces for extending with custom model formatting rules.
Allows easy usage & extension of the default bookstack formatting
behaviour when customizing webhook events via theme system, and keeps
default data customizations organised.
This also makes the following webhook data changes:
- owned_by/created_by/updated_by user details are loaded for events with
Entity details. (POTENTIALLY BREAKING CHANGE).
- current_revision details are loaded for page update/create events.
Added testing to cover added model formatting rules.
For #3279 and #3218
I have now applied changes related to this within 3625f12. 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:
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).
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
The text was updated successfully, but these errors were encountered: