LIKE_POST

The LIKE_POST handler allows users to like or unlike a specific post. It validates user information and toggles the like state for the post.

Interaction Format

To interact with this handler, use the following format:

Send({
   Target = "Process_Id", -- Replace with the actual process ID
   Action = "LIKE_POST",
   Tags = {
       post_id = "post_id" -- Required: ID of the post to like/unlike
   }
})

Input Parameters

Field
Type
Required
Description

post_id

String

Yes

The unique ID of the post.

Validations

  • post_id: Must be provided and correspond to a valid post.

  • The user must have an existing profile.

  • The post must exist in the database.

Response Format

Success

{
   "status": "success",
   "message": "Post liked" or "Post unliked",
   "data": {
       "post_id": "post_id",
       "user_id": "user_id",
       "action": "like" or "unlike",
       "like_count": like_count
   }
}

Error

{
   "status": "error",
   "message": "Post ID is required"
}
{
   "status": "error",
   "message": "User not found. Please create a profile first"
}
{
   "status": "error",
   "message": "Post not found"
}
{
   "status": "error",
   "message": "Failed to process like/unlike",
   "error": "error_message"
}

Last updated