Skip to content

Conversation

@gsanchietti
Copy link
Member

@gsanchietti gsanchietti commented Dec 17, 2025

This pull request adds a new chat integration feature, primarily focused on exposing Matrix chat server configuration and user extension data via a new /chat API endpoint. The changes include configuration, API handler, OpenAPI documentation, supporting data structures, and comprehensive tests.

Chat/Matrix Integration API

  • Introduced a new /chat endpoint (protected by the nethvoice_cti.chat capability) that returns Matrix homeserver configuration and, optionally, a list of chat users with their extensions. (main.go, methods/chat.go, doc/openapi.yaml) [1] [2] [3] [4]
  • Added OpenAPI documentation for the /chat endpoint, including response examples and a new ChatUser schema. (doc/openapi.yaml) [1] [2]

Configuration Enhancements

  • Added a new environment variable NETHVOICE_MATRIX_BASE_URL to configure the Matrix homeserver base URL, with support in the configuration struct and initialization logic. (README.md, configuration/configuration.go) [1] [2] [3]

Data Model and Store Updates

  • Extended user and profile models to include MainExtension and Extensions fields, and updated parsing logic to extract these from the user profile data. (store/profiles.go) [1] [2]
  • Added a ChatUser struct and GetAllChatUsers function to aggregate chat-capable users and their extensions for the API. (methods/user.go) [1] [2] [3]

Testing

  • Added extensive tests for the new /chat endpoint, including capability checks and response validation under various configurations. (main_test.go, methods/chat_test.go) [1] [2]

Linked work

PRs for chat implementation:

New repository for chat implementation:

Issues:

@github-actions
Copy link

github-actions bot commented Dec 17, 2025

🤖 Nethcti-middleware API structural change detected

Preview documentation

Structural change details

Added (1)

  • GET /chat
Powered by Bump.sh

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new GET /chat endpoint to provide Matrix chat configuration to users with appropriate permissions. The endpoint returns Matrix homeserver and Acrobits URLs when configured, or an empty object otherwise. Access is restricted to users with the nethvoice_cti.chat capability.

Key Changes:

  • New configuration field MatrixBaseURL loaded from NETHVOICE_MATRIX_BASE_URL environment variable
  • New handler ChatInfoHandler that returns Matrix configuration based on the environment variable
  • Comprehensive test coverage including unit tests and capability-based access control tests

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
configuration/configuration.go Adds MatrixBaseURL field and initialization from environment variable
methods/chat.go Implements ChatInfoHandler that returns Matrix configuration or empty object
methods/chat_test.go Unit tests for handler with and without Matrix URL configured
main_test.go Integration tests verifying capability-based access control for the endpoint
main.go Registers the /chat endpoint with capability middleware protection
doc/openapi.yaml Documents the API endpoint with request/response specifications

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

The endpoint can be used by ctiapp-authproxy to provision
the mobile app: users with chat capability will have
access to messaging function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants