MICA Chat API Documentation

Back to Chat

Base URL: https://be.mica.service.staging.stmesunet.247factorynet.com

Authentication

POST /api/v1/auth/login

Login with email and password. Returns an access token and user info.

{
  "email": "user@example.com",
  "password": "secret"
}
{
  "accesstoken": "JWT",
  "upstreamaccesstoken": "JWT",
  "usernodeid": "247fn://...",
  "userid": "...",
  "appsuperuser": false,
  "chatnodeid": "247fn://..."
}

Use accesstoken as Authorization: Bearer <token> for all APIs.

Chat APIs

GET /api/v1/chats

Get list of chats for the logged-in user (admin may see multiple).

Auth: Bearer token

GET /api/v1/chats/{chatNodeId}

Get a single chat by node id.

Auth: Bearer token

POST /api/v1/chats/{chatNodeId}/message

Send a message to a chat.

{
  "chatnodeid": "247fn://...",
  "usernodeid": "247fn://...",
  "text": "Hello",
  "lang": "en",
  "files": [
    {
      "fileid": "...",
      "mimetype": "image/png",
      "bucketid": "...",
      "fileversion": "..."
    }
  ]
}

Auth: Bearer token

GET /api/v1/admin/chats

Admin-only: list chats with user info and unread count.

Auth: Bearer token (appsuperuser)

Files

POST /api/v1/files

Request pre-signed upload URL for attachments.

{
  "count": 1,
  "extensions": [
    { "nodeid": "247fn://...", "extension": "png" }
  ]
}

Auth: Bearer token

WebSocket (Socket.IO)

Base URL: same host as REST API. Client should connect with auth.token set to access token.

emit joinChat
{ "chatNodeId": "247fn://..." }
emit presence.join
{ "chatNodeId": "247fn://...", "firstName": "User" }
emit typing.start / typing.stop
{ "chatNodeId": "247fn://...", "firstName": "User" }
on chat.updated

Payload contains chatNodeId and last message data.

on presence.update / typing.update

Presence and typing updates for the active chat.