Content
Roadmap
Matrix Hookshot - Integration OpenProject <> Element - 0.1.16
OpenProject integration for Element
Overview
This integration bridges OpenProject, a project management tool, and Matrix/Element, a decentralized communication platform, using Matrix Hookshot. The integration enables seamless project collaboration by syncing users, projects, and notifications between OpenProject and Matrix/Element.
Key Features
-
Permission Management:
- Adding a user to a Matrix channel grants them the appropriate permissions in the corresponding OpenProject project.
-
Project Room Creation:
- Automatically creates a Matrix room when a new project is created in OpenProject.
-
User Synchronization:
- Adding/removing members in OpenProject reflects in the linked Matrix room.
-
Future Enhancements:
-
Subscription to OpenProject notifications in Matrix.
-
Real-time work package updates in Matrix.
-
Prerequisites
-
Matrix Hookshot:
-
Clone your fork of the Matrix Hookshot repository.
-
Install Node.js (v16 or later).
-
-
OpenProject:
-
Access to an OpenProject instance with API enabled.
-
Generate an API token for the bot.
-
-
Matrix Server:
-
Access to a Matrix server.
-
Create a bot account and generate an access token.
-
-
Configuration Files:
- Update
config.yaml
and.env
with OpenProject and Matrix details.
- Update
Installation
Step 1: Clone and Set Up the Project
git clone https://github.com/girish17/matrix-hookshot.git
cd matrix-hookshot
npm install
Step 2: Configure Environment Variables
Create a .env
file with the following:
OPENPROJECT_URL=https://openproject.example.com
OPENPROJECT_API_KEY=your_api_key
MATRIX_HOMESERVER=https://matrix.example.com
MATRIX_ACCESS_TOKEN=your_bot_access_token
Step 3: Configure Hookshot
Update the config.yaml
file:
integrations:
openproject:
url: "https://openproject.example.com"
api_key: "your_api_key"
Step 4: Build the Project
npm run build
Step 5: Run the Server
npm start
Features
1. Adding Users to Matrix Channels
-
Trigger: A user joins a Matrix room linked to an OpenProject project.
-
Action: The bot maps the Matrix user to an OpenProject user and updates their project membership.
Workflow
-
The
m.room.member
event is captured by the Matrix Hookshot bot. -
The bot retrieves the project ID linked to the room.
-
The user is added to the OpenProject project with the required permissions.
Example Code (Matrix Event Listener)
async function onRoomMemberEvent(event, roomId) {
if (event.membership === "join") {
const userId = event.state_key;
const projectId = await getLinkedProjectId(roomId);
const openProjectUser = await mapMatrixUserToOpenProject(userId);
if (openProjectUser) {
await addUserToOpenProject(projectId, openProjectUser);
}
}
}
2. Automatically Creating Project Rooms
-
Trigger: A new project is created in OpenProject.
-
Action: A private Matrix room is created, and the project is linked to the room.
Workflow
-
A webhook from OpenProject triggers the bot.
-
The bot creates a private Matrix room with the project name.
-
The room ID and project ID are stored for synchronization.
Example Code (Project Creation Handler)
async function onProjectCreated(project) {
const room = await matrixClient.createRoom({
visibility: "private",
name: project.name,
topic: `OpenProject: ${project.name}`,
});
await linkRoomToProject(room.room_id, project.id);
}
3. Synchronizing Members
-
Trigger: Member changes in OpenProject (add/remove).
-
Action: Reflect these changes in the linked Matrix room.
Workflow
-
Periodic synchronization task or OpenProject webhook triggers the bot.
-
Compare OpenProject members with Matrix room members.
-
Add/remove users in the Matrix room to match OpenProject.
Example Code (Synchronization Task)
async function syncProjectMembers(projectId, roomId) {
const projectMembers = await getOpenProjectMembers(projectId);
const roomMembers = await getMatrixRoomMembers(roomId);
for (const member of projectMembers) {
if (!roomMembers.includes(member)) {
await addMemberToMatrixRoom(roomId, member);
}
}
for (const member of roomMembers) {
if (!projectMembers.includes(member)) {
await removeMemberFromMatrixRoom(roomId, member);
}
}
}
Testing
Local Testing
- Run Locally:
npm start
- Use Ngrok:
ngrok http 9000
-
Configure the Ngrok URL in OpenProject webhook settings.
-
Trigger events (e.g., project creation, member addition) and verify in Matrix.
Test Cases
Feature |
Test Scenario |
Expected Outcome |
---|---|---|
User joins Matrix room |
Join a linked room |
User added to OpenProject project |
Project creation |
Create a project in OpenProject |
Matrix room created and linked |
Member synchronization |
Add/remove members in OpenProject |
Members synced in Matrix room |
Deployment
- Build and Package:
npm run build
-
Deploy on Server:
-
Use Docker or a cloud service (AWS, DigitalOcean).
-
Ensure environment variables are securely configured.
-
-
Webhook Setup:
- Configure OpenProject to send webhooks to the bot’s endpoint.
Future Work
-
Subscription to OpenProject notifications in Matrix rooms.
-
Opening work packages directly in Matrix.
-
Improved error handling and logging.
Resources
14.6.0
124 closed (99%) 1 open (1%)
14.6.1
14.6.2
14.6.3
15.0.0
157 closed (96%) 6 open (4%)
15.0.1
15.0.2
15.1.0
121 closed (100%) 0 open (0%)
15.1.1
15.1.2
1 closed (100%) 0 open (0%)
15.2.0
15.2.1
15.3.2
15.4.0
202 closed (97%) 6 open (3%)
15.4.1
18 closed (100%) 0 open (0%)
15.4.2
0 closed (0%) 15 open (100%)
15.5.0
16.0.0
17.0.0
Documentation - Documentation 2.0
Low hanging fruits
Easy features and bug fixes new developers can start with
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.1.x
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.2.0
25 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.3.0
17 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.4.0
51 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.4.6
3 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.4.7
1 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.4.x
2 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.5.0
19 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.6.0
4 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.6.1
2 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.6.2
10 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.6.3
2 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.6.4
1 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.7.0
11 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.7.1
5 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.7.2
3 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.8.0
4 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.8.1
2 closed (100%) 0 open (0%)
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.8.2
Stream Nextcloud app "OpenProject Integration" - Nextcloud Integration 2.9.0
Onboarding
Product Backlog
79 closed (41%) 113 open (59%)
Wish List
269 closed (11%) 2222 open (89%)
Won't Fix
A reservoir for bugs of functionality that is either deprecated or knowingly broken without intentions from the OpenProject Foundation to provide fixes for it.