Inconsistent created_by and updated_by structure in related_item for commented_on vs. comment_delete webhooks #5572

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

Originally created by @csongs on GitHub (Jan 22, 2026).

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.

  1. 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_on and comment_delete.
    • Save the webhook.
  2. 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.
  3. Observe commented_on Webhook Payload:

    • Check your webhook endpoint for the incoming payload triggered by the commented_on event.
    • Locate the related_item object within the JSON payload.
    • Note the structure of the created_by and updated_by fields within this related_item object (they should appear as full user objects with id, name, slug).
  4. Delete the Comment:

    • As "User A" (the user who posted the comment), delete the comment from the "Test Page for Comments".
  5. Observe comment_delete Webhook Payload:

    • Check your webhook endpoint for the incoming payload triggered by the comment_delete event.
    • Locate the related_item object within the JSON payload.
    • Note the structure of the created_by and updated_by fields within this related_item object (they should appear as simple integer user IDs).
  6. Compare Structures:

    • Compare the created_by and updated_by fields from the commented_on payload (Step 3) with those from the comment_delete payload (Step 5). You will observe the inconsistency in their data types/structures.

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

Originally created by @csongs on GitHub (Jan 22, 2026). ### 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: ```JSON { "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: ```json { "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. 1. **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_on` and `comment_delete`. * Save the webhook. 2. **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. 3. **Observe `commented_on` Webhook Payload:** * Check your webhook endpoint for the incoming payload triggered by the `commented_on` event. * Locate the `related_item` object within the JSON payload. * Note the structure of the `created_by` and `updated_by` fields within this `related_item` object (they should appear as full user objects with `id`, `name`, `slug`). 4. **Delete the Comment:** * As "User A" (the user who posted the comment), delete the comment from the "Test Page for Comments". 5. **Observe `comment_delete` Webhook Payload:** * Check your webhook endpoint for the incoming payload triggered by the `comment_delete` event. * Locate the `related_item` object within the JSON payload. * Note the structure of the `created_by` and `updated_by` fields within this `related_item` object (they should appear as simple integer user IDs). 6. **Compare Structures:** * Compare the `created_by` and `updated_by` fields from the `commented_on` payload (Step 3) with those from the `comment_delete` payload (Step 5). You will observe the inconsistency in their data types/structures. --- ### 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
OVERLORD added the 🐛 Bug label 2026-02-05 10:10:42 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5572