Comments

This endpoint creates a new comment, adding it as a reply to a thread. Corresponds to liveblocks.createComment.

A comment’s body is an array of paragraphs, each containing child nodes. Here’s an example of how to construct a comment’s body, which can be submitted under body.

{
  "version": 1,
  "content": [
    {
      "type": "paragraph",
      "children": [{ "text": "Hello " }, { "text": "world", "bold": true }]
    }
  ]
}

metadata supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 4000 characters maximum for strings.

post/rooms/{roomId}/threads/{threadId}/comments

Request

  • Base URL: https://api.liveblocks.io/v2
  • URL: https://api.liveblocks.io/v2/rooms/{roomId}/threads/{threadId}/comments
  • Auth: none declared

Path parameters

roomIdstring required

ID of the room

Example:my-room-id
threadIdstring required

ID of the thread

Example:th_abc123

Request body

userIdstring required
createdAtstring date-time
metadataCommentMetadata

Custom metadata attached to a comment. Supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 4000 characters maximum for strings.

attachmentIdsstring[]

Example request

{
  "userId": "alice",
  "createdAt": "2022-07-13T14:32:50.697Z",
  "body": {
    "version": 1,
    "content": []
  },
  "metadata": {
    "tag": "important",
    "spam": false
  }
}

Response

Success. Returns the created comment.

type'comment' required
threadIdstring required
roomIdstring required
idstring required
userIdstring required
createdAtstring date-time required
editedAtstring date-time
deletedAtstring date-time
metadataCommentMetadata required

Custom metadata attached to a comment. Supports maximum 50 entries. Key length has a limit of 40 characters maximum. Value length has a limit of 4000 characters maximum for strings.

Example response

{
  "type": "comment",
  "threadId": "thread-id",
  "roomId": "room-id",
  "id": "comment-id",
  "userId": "string",
  "createdAt": "2019-08-24T14:15:22Z",
  "editedAt": "2019-08-24T14:15:22Z",
  "deletedAt": "2019-08-24T14:15:22Z",
  "body": {},
  "metadata": {},
  "reactions": [],
  "attachments": []
}

Changes

    • breaking

      added the new required request property

    • breaking

      request body became required

    • breaking

      the request property / became required

    • breaking

      the request property / became required

    • breaking

      added 'propertyNames' constraint to the request property

    • breaking

      the / request property type changed from number to integer

    • warning

      removed the request property

    • info

      api operation id post-rooms-roomId-threads-threadId-comments removed and replaced with create-comment

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      the response property / became required for the status

    • info

      the response property / became required for the status

    • info

      the response property became required for the status

    • info

      the response's property default value comment was removed for the status

    • info

      added 'propertyNames' constraint to the response property for the status

    • info

      added the required property to the response with the status

    • info

      added the required property to the response with the status

    • info

      the response required property became not read-only for the status

    • warning

      removed the request property /

    • warning

      removed the optional property / from the response with the status