Comments
On this page, we'll dive into the different comment endpoints you can use to manage them programmatically. We'll look at how to query, send, update, and delete comments.
The comment model
The comment model contains information about a comment made on a post or changelog.
Properties
- Name
id
- Type
- string
- Description
The id of the comment. Example: "6409cde5f3c4e8d9a7977d89"
- Name
content
- Type
- string
- Description
The content of the comment. In HTML format.
- Name
author
- Type
- string
- Description
The name of the author of the comment.
- Name
authorId
- Type
- string
- Description
The id for the author of the comment.
- Name
authorPicture
- Type
- string
- Description
The profile picture of the author of the comment.
- Name
isPrivate
- Type
- boolean
- Description
Flag indicating whether the comment is private. Private comments are visible only to admins of the organization.
- Name
isDeleted
- Type
- boolean
- Description
Flag indicating whether the comment has been deleted.
- Name
upvotes
- Type
- number
- Description
The number of upvotes the comment has received.
- Name
downvotes
- Type
- number
- Description
The number of downvotes the comment has received.
- Name
score
- Type
- number
- Description
The score of the comment. Calculated by subtracting the number of downvotes from the number of upvotes.
- Name
submission
- Type
- string
- Description
The id of the Featurebase submission if this comment is associated with a submission.
- Name
changelog
- Type
- string
- Description
The id of the Featurebase changelog if this comment is associated with a changelog.
- Name
parentComment
- Type
- string
- Description
The id of the parent comment if this comment is a reply to another comment.
- Name
path
- Type
- string
- Description
The "path" is a string made up of IDs separated by slashes ('/'). It shows the series of steps to reach a specific comment. The first ID in the string refers to either a submission or changelog. Following IDs represent each parent comment, leading up to the top-level comment. The ID of the comment this path relates to is not included in this string.
Example: 64a5376aca108a14db4a61f1/64bac622fd8b1ea910527b3c
- Name
replies
- Type
- Comment
- Description
An array of comment objects that are replies to this comment. Replies to comments can contain their own replies.
- Name
organization
- Type
- string
- Description
The id of the organization the comment belongs to.
- Name
createdAt
- Type
- Date
- Description
The date when the comment was created.
- Name
originalSubmission
- Type
- string
- Description
The id of the original submission if this comment was merged from another submission.
- Name
postStatus
- Type
- string
- Description
Status change comments have a post status associated with them. This is the status the post was changed to by the status name.
- Name
inReview
- Type
- boolean
- Description
Flag indicating whether the comment is currently under review.
- Name
pinned
- Type
- boolean
- Description
Flag indicating whether the comment is pinned.
Get comments
This endpoint allows you to retrieve a paginated list of all comments for a post/changelog. By default, a maximum of ten comments are shown per page.
Required attributes. One of the following is required.
- Name
submissionId
- Type
- string
- Description
The id of the submission to get comments for.
Accepts both ObjectId and slug.
Example: "65f5f3c037fc63b7d43d0f16" or "my-post-slug"
- Name
changelogId
- Type
- string
- Description
The id of the changelog to get comments for.
Accepts both ObjectId and slug.
Example: "65f5f3c037fc63b7d43d0f16" or "my-changelog-slug"
Optional filtering attributes
- Name
privacy
- Type
- enum
- Description
Filter comments by privacy setting. Allowed values: "public", "private", "all"
- Name
inReview
- Type
- boolean
- Description
Filter comments by whether they are in review. Set to true to get only comments that are in review.
- Name
commentThreadId
- Type
- string
- Description
Given a specific comment id, this will return all comments in the thread with the root comment being the comment with the given id.
Pagination attributes
- Name
limit
- Type
- integer
- Description
Number of results per page. Default is 10.
- Name
page
- Type
- integer
- Description
Page number. Default is 1.
- Name
sortBy
- Type
- enum
- Description
Sort order of the results.
Allowed values: "best", "top", "new", "old"
Default: "best"
Request
curl -G https://do.featurebase.app/v2/comment?submissionId=63ed5a57cd650fc9c9032925 \
-H "X-API-Key: {token}"
Response
{
"results": [
{
"upvoted": false,
"downvoted": false,
"inReview": false,
"isSpam": false,
"pinned": false,
"emailSent": false,
"sendNotification": true,
"organization": "5febde12dc56d60012d47db6",
"submission": "63ed5a57cd650fc9c9032925",
"author": "John Steezy",
"authorId": "63a050296e448a0434d72c9b",
"authorPicture": "https://fb-usercontent.fra1.cdn.digitaloceanspaces.com/20231002205914057346.png",
"isPrivate": false,
"isDeleted": false,
"confidenceScore": 0,
"content": "<p>This is an example comment.</p>",
"upvotes": 1,
"downvotes": 0,
"score": 1,
"parentComment": null,
"path": "63ed5a57cd650fc9c9032925",
"replies": [
{
"inReview": false,
"pinned": false,
"emailSent": false,
"sendNotification": true,
"organization": "5febde12dc56d60012d47db6",
"submission": "63ed5a57cd650fc9c9032925",
"author": "Admin",
"authorId": "5febde0bdc56d60012d47db5",
"authorPicture": "https://fb-usercontent.fra1.cdn.digitaloceanspaces.com/878ab937-3862-4491-ba5c-4a65113a3765.png",
"isPrivate": false,
"isDeleted": false,
"confidenceScore": 0.20654329147389295,
"content": "<p>This is an example reply.</p>",
"upvotes": 1,
"downvotes": 0,
"score": 1,
"parentComment": "6409cde5f3c4e8d9a7977d89",
"path": "63ed5a57cd650fc9c9032925/6409cde5f3c4e8d9a7977d89",
"replies": [],
"createdAt": "2023-03-09T12:17:33.599Z",
"updatedAt": "2023-10-27T19:27:52.338Z",
"downvoted": false,
"isSpam": false,
"upvoted": false,
"id": "6409ce5df3c4e8d9a7978ce1"
}
],
"createdAt": "2023-03-09T12:15:33.672Z",
"updatedAt": "2023-08-10T07:30:39.451Z",
"id": "6409cde5f3c4e8d9a7977d89"
},
{
"upvoted": false,
"downvoted": false,
"inReview": false,
"isSpam": false,
"pinned": false,
"emailSent": false,
"sendNotification": true,
"organization": "5febde12dc56d60012d47db6",
"submission": "63ed5a57cd650fc9c9032925",
"author": "Admin",
"authorId": "5febde0bdc56d60012d47db5",
"authorPicture": "https://fb-usercontent.fra1.cdn.digitaloceanspaces.com/878ab937-3862-4491-ba5c-4a65113a3765.png",
"isPrivate": false,
"isDeleted": false,
"confidenceScore": 0,
"content": "<p>Thanks a lot for the suggestion!</p>",
"upvotes": 1,
"downvotes": 0,
"score": 1,
"parentComment": null,
"path": "63ed5a57cd650fc9c9032925",
"replies": [
{
"upvoted": false,
"downvoted": false,
"inReview": false,
"isSpam": false,
"pinned": false,
"emailSent": false,
"sendNotification": true,
"organization": "5febde12dc56d60012d47db6",
"submission": "63ed5a57cd650fc9c9032925",
"author": "User Two",
"authorId": "63ed595bcd650fc9c9031a07",
"authorPicture": "https://fb-usercontent.fra1.cdn.digitaloceanspaces.com/20231002205911291646.jpg",
"isPrivate": false,
"isDeleted": false,
"confidenceScore": 0,
"content": "<p>No worries, happy to help</p>",
"upvotes": 1,
"downvotes": 0,
"score": 1,
"parentComment": "63ed5bdacd650fc9c9034208",
"path": "63ed5a57cd650fc9c9032925/63ed5bdacd650fc9c9034208",
"replies": [],
"createdAt": "2023-02-16T02:46:29.013Z",
"updatedAt": "2023-02-16T02:46:29.013Z",
"id": "63ed9905cd650fc9c9053aca"
}
],
"createdAt": "2023-02-15T22:25:30.094Z",
"updatedAt": "2023-02-15T22:25:30.094Z",
"id": "63ed5bdacd650fc9c9034208"
}
],
"page": 1,
"limit": 10,
"totalPages": 1,
"totalResults": 2
}
Create a new comment
This endpoint allows you to create a new comment or reply to an existing comment. You can create a comment for a submission or changelog.
Required attributes.
- Name
submissionId
- Type
- string
- Description
The id of the submission to get comments for.
Accepts both ObjectId and slug.
Example: "65f5f3c037fc63b7d43d0f16" or "my-post-slug"
- Name
changelogId
- Type
- string
- Description
The id of the changelog to get comments for. Accepts both ObjectId and slug. Example: "65f5f3c037fc63b7d43d0f16" or "my-changelog-slug"
- Name
content
- Type
- string
- Description
The content of the comment.
Optional attributes
- Name
parentCommentId
- Type
- string
- Description
The id of the parent comment if this comment is a reply to another comment.
- Name
isPrivate
- Type
- boolean
- Description
Flag indicating whether the comment is private. Private comments are visible only to admins of the organization.
- Name
sendNotification
- Type
- boolean
- Description
Flag indicating whether to notify voters of the submission about the comment. Defaults to true.
- Name
createdAt
- Type
- Date
- Description
Set the date when the comment was created. Useful for importing comments from other platforms.
- Name
author
- Type
- Object
- Description
Post the comment under a specific user. If not provided, the comment will be posted under the owner user of the Featurebase account.
Example Object:{ "name": "John Doe", "email": "email@example.com", "profilePicture": "https://example.com/profile.jpg" }
Request
curl https://do.featurebase.app/v2/comment \
-H "X-API-Key: {token}" \
-d content="This is my cool comment. It's really cool." \
-d submissionId="65f5f3c037fc63b7d43d0f16"
Response
{
"success": true,
"comment": {
"author": "Admin",
"authorId": "5fef50c5e9458a0012f82456",
"authorPicture": "https://fb-usercontent.fra1.cdn.digitaloceanspaces.com/1693132126228.jpg",
"isPrivate": false,
"content": "This is my cool comment. It's really cool.",
"upvotes": 1,
"downvotes": 0,
"score": 1,
"confidenceScore": 0.20654329147389295,
"submission": "65f5f3c037fc63b7d43d0f16",
"replies": [],
"organization": "6595518396205e06b897ad65",
"upvoted": true,
"downvoted": false,
"inReview": false,
"isSpam": false,
"pinned": false,
"emailSent": false,
"sendNotification": true,
"path": "65f5f3c037fc63b7d43d0f16",
"createdAt": "2024-04-19T13:09:03.405Z",
"updatedAt": "2024-04-19T13:09:03.405Z",
"id": "66226cefcb28bdf767296403"
}
}
Update a comment
This endpoint allows you to update a comment by providing the comment id.
Required attributes
- Name
id
- Type
- string
- Description
The id of the comment.
Properties you can update
- Name
content
- Type
- string
- Description
The content of the comment. Example: "This is my updated comment."
- Name
isPrivate
- Type
- boolean
- Description
Flag indicating whether the comment is private. Private comments are visible only to admins of the organization.
- Name
pinned
- Type
- boolean
- Description
Flag indicating whether the comment is pinned. Pinned comments are displayed at the top of the comments section.
- Name
inReview
- Type
- boolean
- Description
Flag indicating whether the comment is in review. In review comments are not visible to other users.
- Name
createdAt
- Type
- Date
- Description
Update the date when the comment was created. Useful for importing comments from other platforms.
Request
curl -X PATCH "https://do.featurebase.app/v2/comment" \
-H "X-API-Key: {token}" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "id=6462c35485d966548318efbd" \
-d "inReview=false" \
Response
{
"success": true
}
Delete a comment
This endpoint allows you to delete comments from your posts. Note: If you are deleting a comment that has replies, we will soft delete the comment. The content/author will be replaced with "[Deleted]". This helps maintain the context of the conversation.
Required attributes
- Name
id
- Type
- string
- Description
The id of the comment.
Request
curl -X DELETE https://do.featurebase.app/v2/comment \
-H "X-API-Key: {token}" \
-d "id=6462c35485d966548318efbd"
Response
{
"success": true
}