Skip to main content

Get Chat Messages

Retrieves all chat messages associated with a specific content item.

Endpoint

GET /api/chat/:id

Authentication

No authentication required. This endpoint is publicly accessible.

Path Parameters

ParameterTypeDescription
idintegerThe ID of the content item to retrieve chat for

Query Parameters

None

Response

Success Response

Status Code: 200 OK

Response Body: An array of chat message objects, each containing:

[
{
"id": 1693,
"message": "So glad to hear that Jacqueline!",
"messagePlain": "So glad to hear that Jacqueline!",
"deleted": false,
"createdAt": "2022-04-03T19:34:05.000Z",
"updatedAt": "2022-04-03T19:34:05.000Z",
"ContentId": 2775,
"UserId": 6604,
"User": {
"id": 6604,
"name": "Bruce van Zyl",
"photoUrl": "1639671861952.png",
"banned": false
}
}
// Additional chat messages...
]

Error Response

Status Code: 400 Bad Request

Response Body:

{
"error": "Error message"
}

Notes

  • This endpoint returns all chat messages for a specific content item, ordered by creation date.
  • Deleted messages are included in the response but have the deleted flag set to true.
  • Each message includes information about the user who posted it.
  • The response includes both top-level messages and replies.

Example

Request

curl -X GET "https://api.tribesocial.io/api/chat/2775" \
-H "Content-Type: application/json"

Response

[
{
"id": 1693,
"message": "So glad to hear that Jacqueline!",
"messagePlain": "So glad to hear that Jacqueline!",
"deleted": false,
"createdAt": "2022-04-03T19:34:05.000Z",
"updatedAt": "2022-04-03T19:34:05.000Z",
"ContentId": 2775,
"UserId": 6604,
"User": {
"id": 6604,
"name": "Bruce van Zyl",
"photoUrl": "1639671861952.png",
"banned": false
}
},
{
"id": 1694,
"message": "Thanks for sharing this valuable information!",
"messagePlain": "Thanks for sharing this valuable information!",
"deleted": false,
"createdAt": "2022-04-03T20:15:22.000Z",
"updatedAt": "2022-04-03T20:15:22.000Z",
"ContentId": 2775,
"UserId": 6605,
"User": {
"id": 6605,
"name": "Jane Smith",
"photoUrl": "1639672045123.png",
"banned": false
}
}
]