2.9 KiB
2.9 KiB
created, id, keywords, links, modified, summary, tags, title
| created | id | keywords | links | modified | summary | tags | title | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2026-04-11T16:20:05+00:00 | e4dd5e53-a9a4-4f2e-9ed2-40a55b991ba5 |
|
2026-04-11T16:20:05+00:00 | Matrix Application Service bridge for AIPA enabling bidirectional communication via Synapse. Includes a FastAPI event listener, auto-room-joining, agent routing, and a proactive push notification backend, with full deployment documentation. |
|
Matrix Bridge — Application Service Integration |
Matrix Bridge — Application Service Integration
Overview
AIPA integrates with a self-hosted Matrix homeserver (Synapse) via an Application Service bridge, enabling users to interact with agents through Element Web or any Matrix client. The bridge receives events via push (no polling), routes messages to agents, and posts responses with markdown rendering, typing indicators, and threaded replies.
Components
core/matrix_bridge.py — Application Service Bridge
- Runs a FastAPI server on port 8009
- Receives event pushes from Synapse (no polling)
- Auto-accepts invitations: invite
@atlas:matrix.pfi.localto a room → Atlas joins and owns that room permanently - Routes
m.room.messageevents to the correct agent viaConversationService - Posts responses back with markdown→HTML formatting, typing indicators, and threaded replies
- Persists room→session mapping in
sessions/matrix_rooms.jsonacross restarts
tools/send_notification.py — Matrix Notification Backend
New Matrix backend so agents can proactively push messages to rooms (e.g., alerts, status updates) without being prompted.
docs/matrix-deployment.md — Deployment Guide
Complete step-by-step guide covering:
- Synapse Docker Compose setup
- Database configuration
- AppService registration YAML (
aipa_appservice.yaml) - Element Web client setup
- Admin account creation
- Troubleshooting table
Configuration
Environment Variables (add to env.sh)
export MATRIX_HOMESERVER_URL="http://localhost:8008"
export MATRIX_SERVER_NAME="matrix.pfi.local"
export MATRIX_AS_TOKEN="<as_token>"
export MATRIX_HS_TOKEN="<hs_token>"
Provider Config
Uncomment the matrix: block in config/providers.yaml.
Activation Steps
- Follow
docs/matrix-deployment.mdto deploy Synapse on your VM - Generate two tokens (
as_token,hs_token) and writeaipa_appservice.yamlin Synapse's data directory - Set the four
MATRIX_*environment variables inenv.sh - Uncomment the
matrix:block inconfig/providers.yaml pip install markdown(orpip install -r requirements.txt)python -m core.matrix_bridge- Open Element → DM
@atlas:matrix.pfi.local