SUBMIT_COMMENT
The SUBMIT_COMMENT handler allows users to create, edit, or reply to comments on a post. It validates user information and ensures the content meets specified requirements.
Interaction Format
To interact with this handler, use the following format:
Send({
Target = "Process_Id", -- Replace with the actual process ID
Action = "SUBMIT_COMMENT",
Tags = {
post_id = "post_id", -- Required: ID of the post
content = "comment_content", -- Required: Content of the comment
parent_comment_id = "parent_comment_id", -- Optional: ID of the parent comment for replies
comment_id = "comment_id" -- Optional: ID of the comment to edit
}
})
Input Parameters
Field
Type
Required
Description
post_id
String
Yes
The unique ID of the post.
content
String
Yes
The content of the comment (max 1000 characters).
parent_comment_id
String
No
The ID of the parent comment for replies.
comment_id
String
No
The ID of the comment to edit.
Validations
post_id: Must be provided and correspond to a valid post.
content: Must not exceed 1000 characters.
parent_comment_id: If provided, must exist and belong to the same post.
comment_id: If provided, must correspond to an existing comment and be editable by the user.
Response Format
Success
{
"status": "success",
"message": "Comment created successfully" or "Comment updated successfully",
"data": {
"comment_id": "comment_id",
"post_id": "post_id",
"user_id": "user_id",
"content": "comment_content",
"parent_comment_id": "parent_comment_id",
"is_edited": is_edited,
"created_at": "created_at_timestamp",
"updated_at": "updated_at_timestamp"
}
}
Error
{
"status": "error",
"message": "Post ID and content are required"
}
{
"status": "error",
"message": "Comment content cannot exceed 1000 characters"
}
{
"status": "error",
"message": "User not found. Please create a profile first"
}
{
"status": "error",
"message": "Post not found"
}
{
"status": "error",
"message": "Parent comment not found"
}
{
"status": "error",
"message": "Parent comment doesn't belong to the specified post"
}
{
"status": "error",
"message": "Failed to create/update comment",
"error": "error_message"
}
Last updated