Skip to main content

Toggle Chat Message Reaction

Toggle an emoji reaction on a chat message. If the reaction does not exist it is created; if it already exists it is removed.

Endpoint

POST /api/chat/:id/reactions

Authentication

Required. The request must include a valid authentication token.

Path Parameters

ParameterTypeDescription
idintegerThe chat message ID

Request Body

ParameterTypeRequiredDescription
emojistringYesThe emoji identifier (see supported emoji)

Response

Success Response

Status Code: 200 OK

{
"action": "added",
"emoji": "fire"
}
FieldTypeDescription
actionstringEither "added" or "removed"
emojistringThe emoji that was toggled

Error Responses

Status CodeBody
400{ "error": "emoji is required" }
401Unauthorized
404Message not found

Examples

Add a reaction

curl -X POST "https://api.tribesocial.io/api/chat/1693/reactions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-d '{ "emoji": "fire" }'

Response (reaction did not exist — added):

{
"action": "added",
"emoji": "fire"
}

Remove a reaction

Call the same endpoint again with the same emoji to toggle it off:

curl -X POST "https://api.tribesocial.io/api/chat/1693/reactions" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN" \
-d '{ "emoji": "fire" }'

Response (reaction already existed — removed):

{
"action": "removed",
"emoji": "fire"
}