Skip to content

Team Chat API

Endpoint: GET/POST /api/team-chat.php

Auth: Session + CSRF

Actions

rooms — List Rooms

http
GET /api/team-chat.php?action=rooms

Returns rooms the user belongs to with participant count, last message, and unread count.

messages — Get Messages

http
GET /api/team-chat.php?action=messages&room_id=1&limit=50
ParameterTypeDefaultDescription
room_idintegerrequiredRoom ID
beforetimestampGet messages before this time
limitinteger50Max messages

send — Send Message

http
POST /api/team-chat.php?action=send
Content-Type: application/json

{
  "room_id": 1,
  "content": "Hello team! @Aurora can you help?"
}

If the message contains @Aurora, the AI processing pipeline is triggered automatically.

edit — Edit Message

http
POST /api/team-chat.php?action=edit
Content-Type: application/json

{
  "message_id": 42,
  "content": "Updated message content"
}

Only the message author can edit.

delete — Delete Message

http
POST /api/team-chat.php?action=delete
Content-Type: application/json

{
  "message_id": 42
}

Authors can delete their own messages. Admins can delete any message in rooms they belong to.

poll — Poll for Updates

http
GET /api/team-chat.php?action=poll&room_id=1&after=2026-02-21T12:00:00Z

Returns new messages since the after timestamp, plus typing indicators for the room.

create_room — Create Room

http
POST /api/team-chat.php?action=create_room
Content-Type: application/json

{
  "name": "Project Alpha",
  "type": "channel",
  "participants": [2, 3, 5]
}
ParameterTypeDescription
namestringRoom display name
typestring"channel" or "dm"
participantsarrayUser IDs to add

The creator is automatically added as a participant.

delete_room — Delete Room

http
POST /api/team-chat.php?action=delete_room
Content-Type: application/json

{
  "room_id": 1
}

Only the room creator or an admin can delete a room. Cascade deletes:

  • All messages
  • All participant records
  • All shared files (from disk)

react — Toggle Reaction

http
POST /api/team-chat.php?action=react
Content-Type: application/json

{
  "message_id": 42,
  "emoji": "👍"
}

Toggles the reaction — adds if not present, removes if already reacted.

typing — Send Typing Indicator

http
POST /api/team-chat.php?action=typing
Content-Type: application/json

{
  "room_id": 1
}

presence — Update Presence

http
POST /api/team-chat.php?action=presence
Content-Type: application/json

{
  "room_id": 1
}

Updates last_active timestamp for the user in the room.

online — Get Online Users

http
GET /api/team-chat.php?action=online

Returns users active within the last 2 minutes.

read — Mark Room as Read

http
POST /api/team-chat.php?action=read
Content-Type: application/json

{
  "room_id": 1
}

search — Search Messages

http
GET /api/team-chat.php?action=search&query=meeting&room_id=1

Searches messages using ILIKE. If room_id is provided, searches only in that room (membership verified).

users — List All Users

http
GET /api/team-chat.php?action=users

Returns all users with id, username, display_name, avatar_color.

unread — Get Unread Counts

http
GET /api/team-chat.php?action=unread

Returns unread message count per room.

AI-Powered Cloud Desktop OS