Mattermost Endpoints
Endpoints for managing Mattermost team messaging sessions, configuration, and organization sync.
Source: equa-server/modules/agent/src/mattermost/mattermost-endpoints.ts
POST /api/v1/mattermost/session
Provisions a Mattermost user and team for the current user and organization, then returns a session token for iframe embedding. Authentication: Cookie (Equa session) Request Body:
Behavior:
- Validates session cookie and org membership
- Calls
ensureUser()— creates Mattermost user if not exists, stores mapping - Calls
issueSessionToken()— creates personal access token, AES-encrypts and stores - Calls
ensureTeam()— creates Mattermost team with default channels if not exists - Calls
ensureTeamMembership()— adds user to team if not already a member - Returns token and connection details
Source: equa-server/modules/agent/src/mattermost/mattermost-endpoints.ts, Line: 34
GET /api/v1/mattermost/config
Returns Mattermost configuration status for the frontend. Authentication: Cookie (Equa session) Response (200):
Source: equa-server/modules/agent/src/mattermost/mattermost-endpoints.ts, Line: 110
GET /api/v1/mattermost/team-mapping/:teamId
Maps a Mattermost team ID to an Equa organization ID. Used by equabot-gateway to resolve org context for agent interactions. Authentication: Bearer token (gateway auth token) Path Parameters:
Response (200):
Source: equa-server/modules/agent/src/mattermost/mattermost-endpoints.ts, Line: 127
POST /api/v1/mattermost/sync-org/:orgId
Triggers a full synchronization of Equa organization members to the corresponding Mattermost team. Adds missing members and removes members no longer in the org. Authentication: Cookie (Equa session, must have org admin permissions) Path Parameters:
Response (200):
Error Responses:
Source: equa-server/modules/agent/src/mattermost/mattermost-endpoints.ts, Line: 150
GET /api/v1/mattermost/token-health
Validates the authenticated user’s stored Mattermost personal access token by checking it against the Mattermost server. Used by the frontend for periodic session health monitoring. Authentication: Cookie (Equa session) Response (200):
Error Responses:
Source: equa-server/modules/agent/src/mattermost/mattermost-endpoints.ts
GET /api/v1/mattermost/user-mapping/:mmUserId
Maps a Mattermost user ID to an Equa user ID. Used by equabot-gateway to resolve sender identity for org-scoped agent interactions. Authentication: Bearer token (gateway auth token viaEQUA_GATEWAY_TOKEN)
Path Parameters:
Response (200):
Source: equa-server/modules/agent/src/mattermost/mattermost-endpoints.ts