Skip to main content

CreateComment

Creates a comment within a thread. The results of this mutation can be affected by providing an authToken header to set a user for the operation.

CreateComment(
clientId: ID
commentableId: ID!
commentableType: CommentableType!
body: String
asset: URL
assetFileName: String
videoAsset: ID
parentId: ID
notificationsEnabled: Boolean!
): Comment!

Arguments

CreateComment.clientId ● ID scalar

The ID of the client.

CreateComment.commentableId ● ID! non-null scalar

The ID of the commentable entity.

CreateComment.commentableType ● CommentableType! non-null enum

The type of the comment's parent thread, based on the comment's location, e.g. discussion board, assignment, widget thread, etc.

CreateComment.body ● String scalar

The body of the comment.

CreateComment.asset ● URL scalar

The URL of the asset.

CreateComment.assetFileName ● String scalar

The file name of the asset.

CreateComment.videoAsset ● ID scalar

The ID of the video asset.

CreateComment.parentId ● ID scalar

The ID of the parent comment.

CreateComment.notificationsEnabled ● Boolean! non-null scalar

Flag to enable notifications.

Type

Comment object

Examples

Run in Postman

Query:

CreateComment(
$clientId: ID,
$commentableId: ID!,
$commentableType: CommentableType!,
$body: String,
$asset: URL,
$assetFileName: String,
$videoAsset: ID,
$parentId: ID,
$notificationsEnabled: Boolean!
) {
CreateComment(
clientId: $clientId,
commentableId: $commentableId,
commentableType: $commentableType,
body: $body,
asset: $asset,
assetFileName: $assetFileName,
videoAsset: $videoAsset,
parentId: $parentId,
notificationsEnabled: $notificationsEnabled
) {
id
commentable {
... on Topic {
...TopicFragment
}
... on Thread {
...ThreadFragment
}
}
commentableId
commentableType
body
user {
...UserFragment
}
parentComment {
...CommentFragment
}
createdAt
updatedAt
videoAsset
asset
assetFileName
notificationsEnabled
childComments {
...CommentsListFragment
}
userLikeId
likesCount
}
}

Variables:

{
"clientId": "58ccb96c-8e90-4464-86e0-f284442981df",
"commentableId": "58ccb96c-8e90-4464-86e0-f284442981df",
"commentableType": "thread",
"body": "abc123",
"asset": "URL",
"assetFileName": "xyz789",
"videoAsset": "58ccb96c-8e90-4464-86e0-f284442981df",
"parentId": "58ccb96c-8e90-4464-86e0-f284442981df",
"notificationsEnabled": true
}

Response:

{
"data": {
"CreateComment": {
"id": "58ccb96c-8e90-4464-86e0-f284442981df",
"commentable": "Topic",
"commentableId": "58ccb96c-8e90-4464-86e0-f284442981df",
"commentableType": "thread",
"body": "xyz789",
"user": "User",
"parentComment": "Comment",
"createdAt": "2024-06-20T16:58:58.782Z",
"updatedAt": "2023-12-20T16:58:58.782Z",
"videoAsset": "58ccb96c-8e90-4464-86e0-f284442981df",
"asset": "URL",
"assetFileName": "abc123",
"notificationsEnabled": true,
"childComments": "CommentsList",
"userLikeId": "58ccb96c-8e90-4464-86e0-f284442981df",
"likesCount": 678
}
}
}