The Comments API allows you to manage a customized commenting program that lets site visitors share feedback or engage in discussions around different types of resources, including blog posts, forum threads, or other site content.
With the Wix Comments API, you can:
- Allow commenting on any page of your site.
- Mark specific comments to highlight and feature to your readers.
- Engage with visitors who are not site members through guest commenting.
The Comments API is fully integrated with several Wix solutions. Each integration uses a slightly different configuration to work with Comments.
The following table details the currently supported integrations:
Wix App | appId | contextId | resourceId |
---|---|---|---|
Wix Blog | 14bcded7-0066-7c35-14d7-466cb3f09103 | internalId | internalId |
Wix Comments | 91c9d6a7-6667-41fb-b0b4-7d3b3ff0b02e | categoryId | componentId |
Wix Forum | 14724f35-6794-cd1a-0244-25fd138f9242 | forumPostId | forumPostId |
Wix Groups | 148c2287-c669-d849-d153-463c7486a694 | groupId | feedItemId |
- Marked comments: When a comment's
marked
field is set toTRUE
, it indicates that the comment has been flagged or marked for special attention. No additional automated behavior or action is taken with the comment. However, you can manually filter for comments marked as such with Query Comments and highlight them to your visitors as needed. - Parent comments: Parent comments refer to comments that have subsequent comments directly responding to them. They serve as the original or initial comments in a conversation thread. The parent comment's unique identifier is stored in the
parentComment.id
field of the corresponding reply comment. - Replies: Replies are comments that are made in direct response to earlier comments within a discussion. They are specifically intended as responses to a particular parent comment and contribute to the ongoing conversation. Replies help maintain the hierarchical structure of comment threads and enhance the engagement and interactivity among users.
This article shares possible use cases your app could support, as well as sample flows. You're certainly not limited to these use cases, but it can be a helpful jumping off point as you plan your app's implementation.
Note: This flow requires Wix Blocks which is currently in Beta. Your app can help site owners find the most popular comments left on their site and feature those comments to other site visitors.
To find and highlight the most popular comments:
- Use Query Comments to filter and sort comments for the highest
replyCount
,rating
, andreactionSummary.total
. - Use Mark Comment for each of the top comments to set
marked
asTRUE
. - Display marked comments in a widget. Widgets can be built using Wix Blocks. Learn more about Wix Blocks and adding widgets.
Your app can gather insights and generate reports about a site's comments.
To get the information follow these steps:
- Use Query Comments to retrieve a list of comments based on specified filters.
- Analyze the statistical data, such as comment count and engagement rates based on
replyCount
,reactionSummary.total
, andvoteSummary.netVoteCount
. - Use the comment metrics to generate comprehensive reports on comment activity, user engagement, and popular discussions.
- Customize the reporting with segmentation based on available filtering and sorting options.
- Visualize parts of the data in an easily understandable format, such as charts and graphs.
- Schedule and distribute the reports at regular intervals.
The following table shows field support for filters and sorting for the comment object:
Field | Supported Filters | Sortable |
---|---|---|
id | $eq , $ne , $in | |
contextId | $eq , $ne , $in | |
resourceId | $eq , $ne , $in | |
author.userId | $eq , $ne , $in | |
author.memberId | $eq , $ne , $in | |
author.visitorId | $eq , $ne , $in | |
parentComment.id | $eq , $ne , $in | |
parentIdsInThread | $hasAll , $hasSome , $isEmpty | |
replyCount | $eq , $ne , $gt , $lt , $gte , $lte | Sortable |
status | $eq , $ne , $in | |
voteSummary.netVoteCount | $eq , $ne , $gt , $lt , $gte , $lte | Sortable |
rating | $eq , $ne , $gt , $lt , $gte , $lte | Sortable |
reactionSummary.total | $eq , $ne , $gt , $lt , $gte , $lte | Sortable |
marked | $eq , $ne | Sortable |
- "PUBLISHED": This comment is published and publicly visible.
- "DELETED": This comment is deleted.
- "PENDING": This comment is pending moderation. Moderation is not currently supported.
- "HIDDEN": This comment has been hidden by a site moderator.
Creates a new comment.
The appId
, contextId
, and resourceId
are all required and associate the created comment with the specific
resource it responds to. See Integrations for a list of integrated scopes for these fields.
If the created comment is a direct response to another comment, the commentId
of the parent comment should be passed
as parentComment.id
in this comment's request. See Terminology for additional information on parent comments and replies.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Retrieves a comment.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Deletes a comment.
This endpoint deletes the content
of the comment and sets its status
to DELETED
.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Updates a comment.
Each time the comment is updated, revision
increments by 1. The current revision
must be
passed when updating the comment. This ensures you're working with the latest comment and
prevents unintended overwrites.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Retrieves a list of comments, given the provided paging, filtering, and sorting.
Query Comments runs with these defaults, which you can override:
id
sorted inASC
order
For field support for filters and sorting, see Comments: Supported Filters and Sorting.
To learn about working with Query endpoints, see API Query Language, Sorting and Paging, and Field Projection.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Sets marked
to TRUE
to mark a comment.
You can then filter for marked comments with Query Comments to apply customizations. See Highlight marked comments for an example.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Sets marked
to FALSE
to unmark a comment.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Counts comments, given the provided filtering.
For field support for filters and sorting, see Comments: Supported Filters and Sorting.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Triggered when a comment is created.
Event Body
Triggered when a comment is updated.
Event Body
Triggered when a comment is deleted.
Event Body
Triggered when a comment is marked.
Event Body
Triggered when a comment is unmarked.