-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add GET /chat endpoint #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🤖 Nethcti-middleware API structural change detectedStructural change detailsAdded (1)
Powered by Bump.sh |
There was a problem hiding this 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
MatrixBaseURLloaded fromNETHVOICE_MATRIX_BASE_URLenvironment variable - New handler
ChatInfoHandlerthat 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.
d790fe5 to
ba7c162
Compare
The endpoint can be used by ctiapp-authproxy to provision the mobile app: users with chat capability will have access to messaging function
ba7c162 to
8e168df
Compare
This pull request adds a new chat integration feature, primarily focused on exposing Matrix chat server configuration and user extension data via a new
/chatAPI endpoint. The changes include configuration, API handler, OpenAPI documentation, supporting data structures, and comprehensive tests.Chat/Matrix Integration API
/chatendpoint (protected by thenethvoice_cti.chatcapability) 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]/chatendpoint, including response examples and a newChatUserschema. (doc/openapi.yaml) [1] [2]Configuration Enhancements
NETHVOICE_MATRIX_BASE_URLto 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
MainExtensionandExtensionsfields, and updated parsing logic to extract these from the user profile data. (store/profiles.go) [1] [2]ChatUserstruct andGetAllChatUsersfunction to aggregate chat-capable users and their extensions for the API. (methods/user.go) [1] [2] [3]Testing
/chatendpoint, 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: