A Matrix bridge for the Hostex property management system using mautrix-go bridgev2 framework. This bridge allows you to receive and send messages from your Hostex conversations directly in Matrix with full double puppeting support - your host messages appear as sent by you, not the bridge bot.
- β Bidirectional messaging - Send and receive messages between Matrix and Hostex
- β Real-time sync - New messages appear in Matrix within 30 seconds
- π§ Image attachments - Images from Hostex currently show as "(empty message)" - under investigation (#5)
- β Property-prefixed rooms - Rooms are named with property prefix: "(Property Name) - Guest Name"
- β Beeper integration - Full compatibility with Beeper's bridge-manager
- β Message backfilling - Historical messages are imported when creating rooms
- β Echo prevention - Prevents duplicate messages when sending from Matrix
- β Efficient polling - Only processes conversations with new messages
- β
Manual refresh command - Force conversation cache refresh with
!hostex refresh
- β Double puppeting - Host messages appear as sent by you (not bridge bot) when using Beeper
Matrix Room β mautrix-hostex β Hostex API
- Hostex API Client (
pkg/hostexapi/
): HTTP client for Hostex API v3.0.0 - Bridge Connector (
pkg/connector/
): mautrix bridgev2 implementation - Webhook Handler (
pkg/webhook/
): Webhook endpoint implementation (untested) - Main Application (
cmd/mautrix-hostex/
): Entry point and bridge initialization
- Create a
docker-compose.yml
:
version: '3.8'
services:
mautrix-hostex:
build: .
container_name: mautrix-hostex
volumes:
- ./data:/data
ports:
- "29337:29337"
restart: unless-stopped
- Run the container:
docker-compose up -d
- Edit the generated
data/config.yaml
with your Matrix homeserver and Hostex API details - Restart the container
- Go 1.21 or higher
- libolm (for Matrix encryption support)
Install libolm on macOS:
brew install libolm
Install libolm on Ubuntu/Debian:
sudo apt install libolm-dev
- Clone and build the bridge:
git clone https://github.com/keithah/matrix-hostex-bridge.git
cd matrix-hostex-bridge
# Build with proper CGO flags for libolm
CGO_CFLAGS="-I$(brew --prefix)/include" CGO_LDFLAGS="-L$(brew --prefix)/lib" go build -o mautrix-hostex ./cmd/mautrix-hostex
- Generate config (for Beeper usage):
# Use bbctl to generate proper bridgev2 config with double puppeting
bbctl config --type bridgev2 sh-generic -o config.yaml
# Or generate basic config for standalone usage
./mautrix-hostex -g -c config.yaml -r registration.yaml
- Edit
config.yaml
with your settings and start:
./mautrix-hostex -c config.yaml
Note: When using with Beeper, the bbctl-generated config includes proper double puppeting configuration and should be preferred over the basic generated config.
When using with Beeper, the bridge uses a bridgev2 configuration that includes:
- Double puppeting: Automatic using
as_token
- Proper bridge naming: Uses
sh-hostex
prefix for Beeper compatibility - HTTP endpoints: Basic webhook endpoint implementation (untested)
- Network section: Hostex-specific settings
Example network section to add to your bbctl-generated config:
network:
hostex_api_url: https://api.hostex.io/v3
admin_user: "@yourusername:beeper.com"
For standalone usage:
- Matrix Homeserver: Your Matrix server URL and credentials
- Hostex API Token: Your Hostex access token from the API settings
- Log into your Hostex account
- Go to API Settings
- Generate an access token
The bridge uses the official Hostex logo as its avatar. To set this up:
- Start your bridge:
./mautrix-hostex
- Upload the logo using the provided script:
./upload-avatar.sh
- Update your
config.yaml
with the returned mxc:// URI - Restart the bridge to apply the new avatar
./mautrix-hostex
- Start a chat with the bridge bot (e.g.,
@sh-hostexbot:beeper.local
) - Use the
login
command and provide your Hostex API token - The bridge will automatically create rooms for your active conversations
login
- Authenticate with your Hostex API tokenlogout
- Sign out from Hostexlist-logins
- Show your current login statusrefresh
- Manually refresh conversation cache and check for new messageshelp
- Show available commands
- Text messages - Simply type in any bridged room
- Images - Send images directly in Matrix (they'll appear in Hostex)
- Mixed content - Send text with images attached
This bridge is fully compatible with Beeper and includes proper double puppeting support:
- Install bbctl and login:
bbctl login
- Generate proper bridgev2 config:
bbctl config --type bridgev2 sh-generic -o config.yaml
- Update the generated config:
- Change
username_template
tosh-hostex_{{.}}
- Change bot
username
tosh-hostexbot
- Add the
network
section with your Hostex API settings
- Change
- Register and start your bridge
- The bridge connects via websocket to Beeper's infrastructure with full double puppeting
When properly configured with the bridgev2 config:
- Host messages appear as sent by your actual Matrix user (not the bridge bot)
- Guest messages appear as received from the guest
- Uses Beeper's
as_token
for automatic double puppeting - No additional client setup required
- Register the bridge:
bbctl register sh-hostex
- Configure your bridge locally with the provided config template
- Ensure double puppeting is enabled in the config
hostex-matrix-bridge/
βββ cmd/mautrix-hostex/main.go # Application entry point
βββ pkg/
β βββ connector/
β β βββ connector.go # Main bridge implementation with double puppeting
β β βββ minimal.go # Minimal test connector
β βββ hostexapi/client.go # Hostex API client
β βββ webhook/handler.go # Webhook handler (untested)
βββ config.yaml # Bridgev2 configuration (generated by bbctl)
βββ config.example.yaml # Example standalone configuration
βββ registration.yaml # Bridge registration for Matrix homeserver
βββ go.mod # Go dependencies
βββ Dockerfile # Container build
βββ docker-run.sh # Container runtime
# Development build
go run . -g -c config.yaml -r registration.yaml
# Production build with version info
TAG=v0.1.0 COMMIT=$(git rev-parse HEAD) BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) \
go build -ldflags "-X 'hostex-matrix-bridge/cmd/mautrix-hostex.Tag=${TAG}' -X 'hostex-matrix-bridge/cmd/mautrix-hostex.Commit=${COMMIT}' -X 'hostex-matrix-bridge/cmd/mautrix-hostex.BuildTime=${BUILD_TIME}'"
# Run tests
go test ./...
# Test Hostex API connection
curl -H "Hostex-Access-Token: your-token" https://api.hostex.io/v1/properties
This project is licensed under the Mozilla Public License 2.0 (MPL-2.0) - see the LICENSE file for details.
This license choice matches the core mautrix framework dependency and allows commercial use while ensuring improvements to the bridge remain open source.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request