-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Description
Describe the Bug
When using webhooks for comment-related events, the structure of the created_by and updated_by fields within the related_item object is inconsistent between the commented_on and comment_delete events.
For the commented_on event, related_item.created_by and related_item.updated_by are provided as full user objects (containing id, name, slug). However, for the comment_delete event, these same fields (related_item.created_by and related_item.updated_by) are provided as simple integer user IDs.
This inconsistency makes it challenging to uniformly process webhook payloads for comment-related activities, as the data structure for user information changes depending on the event type. Developers need to implement conditional logic to parse these fields, which adds unnecessary complexity.
- Example Payload for commented_on event:
{
"body": {
"event": "commented_on",
"text": "User A commented on \"Example Page Name\"",
"triggered_at": "2026-01-22T08:39:52.000000Z",
"triggered_by": {
"id": 1,
"name": "User A",
"slug": "user-a"
},
"triggered_by_profile_url": "https://your-bookstack-instance.com/user/user-a",
"webhook_id": 4,
"webhook_name": "test",
"url": "https://your-bookstack-instance.com/books/example-book/page/example-page-name",
"related_item": {
"id": 182,
"type": "page",
"name": "Example Page Name",
"slug": "example-page-name",
"book_id": 40,
"chapter_id": 45,
"priority": 3,
"created_at": "2021-04-14T18:20:24.000000Z",
"updated_at": "2021-04-27T20:39:03.000000Z",
"created_by": { // Full user object
"id": 2,
"name": "Content Creator",
"slug": "content-creator"
},
"updated_by": { // Full user object
"id": 2,
"name": "Content Creator",
"slug": "content-creator"
},
"owned_by": {
"id": 2,
"name": "Content Creator",
"slug": "content-creator"
},
"page_id": 182,
"draft": false,
"template": false,
"revision_count": 1,
"editor": "wysiwyg"
}
}
}- Example Payload for comment_delete event:
{
"body": {
"event": "comment_delete",
"text": "User A deleted a comment",
"triggered_at": "2026-01-22T09:08:53.000000Z",
"triggered_by": {
"id": 1,
"name": "User A",
"slug": "user-a"
},
"triggered_by_profile_url": "https://your-bookstack-instance.com/user/user-a",
"webhook_id": 4,
"webhook_name": "test",
"related_item": {
"id": 13,
"commentable_id": 74,
"commentable_type": "page",
"parent_id": null,
"local_id": 3,
"created_by": 1, // Integer user ID
"updated_by": 1, // Integer user ID
"created_at": "2025-12-11T03:06:28.000000Z",
"updated_at": "2025-12-11T03:06:28.000000Z",
"content_ref": "",
"archived": false
}
}
}Steps to Reproduce
Detail the steps that would replicate this issue.
-
Configure a Webhook:
- Navigate to your BookStack instance's Webhooks settings (e.g.,
https://your-bookstack-instance.com/settings/webhooks). - Click "Create New Webhook".
- Provide a name (e.g., "Comment Events Test") and set the "Webhook Endpoint" to a URL where you can receive and inspect JSON payloads (e.g., a webhook testing service like Webhook.site, or a custom endpoint).
- Under "Webhook Events", select both
commented_onandcomment_delete. - Save the webhook.
- Navigate to your BookStack instance's Webhooks settings (e.g.,
-
Create a Page and Add a Comment:
- Log in to BookStack as a user (e.g., "User A").
- Create a new page (e.g., "Test Page for Comments").
- Add a comment to this newly created page.
-
Observe
commented_onWebhook Payload:- Check your webhook endpoint for the incoming payload triggered by the
commented_onevent. - Locate the
related_itemobject within the JSON payload. - Note the structure of the
created_byandupdated_byfields within thisrelated_itemobject (they should appear as full user objects withid,name,slug).
- Check your webhook endpoint for the incoming payload triggered by the
-
Delete the Comment:
- As "User A" (the user who posted the comment), delete the comment from the "Test Page for Comments".
-
Observe
comment_deleteWebhook Payload:- Check your webhook endpoint for the incoming payload triggered by the
comment_deleteevent. - Locate the
related_itemobject within the JSON payload. - Note the structure of the
created_byandupdated_byfields within thisrelated_itemobject (they should appear as simple integer user IDs).
- Check your webhook endpoint for the incoming payload triggered by the
-
Compare Structures:
- Compare the
created_byandupdated_byfields from thecommented_onpayload (Step 3) with those from thecomment_deletepayload (Step 5). You will observe the inconsistency in their data types/structures.
- Compare the
Expected Behaviour
I expect the created_by and updated_by fields within the related_item object to have a consistent structure across all comment-related webhook events (commented_on, comment_delete, comment_update).
Screenshots or Additional Context
No response
Browser Details
No response
Exact BookStack Version
v25.12.1