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
| Parameter | Type | Description |
|---|---|---|
id | integer | The chat message ID |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
emoji | string | Yes | The emoji identifier (see supported emoji) |
Response
Success Response
Status Code: 200 OK
{
"action": "added",
"emoji": "fire"
}
| Field | Type | Description |
|---|---|---|
action | string | Either "added" or "removed" |
emoji | string | The emoji that was toggled |
Error Responses
| Status Code | Body |
|---|---|
| 400 | { "error": "emoji is required" } |
| 401 | Unauthorized |
| 404 | Message 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"
}