From 31752542e5edb7d68b3eb7450488b972829a1fd7 Mon Sep 17 00:00:00 2001 From: Roger Gonzalez Date: Wed, 27 Nov 2024 17:26:50 -0300 Subject: [PATCH] Add WhatsApp bridge setup guide and update .gitignore --- .gitignore | 6 +- config/mautrix-whatsapp/README.md | 117 +++++++++++++++++++++++++++++- 2 files changed, 121 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index daef273..fa9e3d0 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,8 @@ *.log tmp/ -./config/dendrite/* +# Dendrite config +config/dendrite/ + +# Mautrix-Whatsapp config +config/mautrix-whatsapp/*.yaml diff --git a/config/mautrix-whatsapp/README.md b/config/mautrix-whatsapp/README.md index 4640904..c2446a9 100644 --- a/config/mautrix-whatsapp/README.md +++ b/config/mautrix-whatsapp/README.md @@ -1 +1,116 @@ -# TODO +# WhatsApp Bridge Setup Guide + +This guide will help you set up the WhatsApp bridge for your Dendrite Matrix server. + +## Prerequisites + +Before starting, ensure that: +- Dendrite is properly configured and running. +- The `whatsapp` database was created during the initial setup. +- You have your domain name ready. + +## Setup Steps + +1. Navigate to the WhatsApp configuration directory: + +```sh +cd config/mautrix-whatsapp +``` + +2. Generate the initial configuration file: + +```sh +docker run --rm -v `pwd`:/data:z dock.mau.dev/mautrix/whatsapp +``` + +3. Edit the generated `config.yaml` file. You may need administrative privileges (sudo) to edit this file. + +### Required Configuration Changes + +Make the following modifications to your `config.yaml`: + +#### Homeserver Settings +```yaml +homeserver: + address: http://monolith:8008 # Internal Docker network address + domain: your.domain.com # Replace with your actual domain +``` + +#### Appservice Settings +```yaml +appservice: + address: http://whatsapp:29318 # Internal bridge address + hostname: 0.0.0.0 # Listen on all interfaces +``` + +#### Bridge Permissions +```yaml +bridge: + permissions: + "*": relay + "your.domain.com": user # Replace with your domain + "@yourusername:your.domain.com": admin # Replace with your Matrix ID +``` + +#### Database Connection +Update the database URI to use the WhatsApp-specific database. For example: + +```yaml +# Original: +# postgres://dendrite:password@postgres/dendrite?sslmode=disable + +# Modified (note 'whatsapp' database name): +postgres://dendrite:password@postgres/whatsapp?sslmode=disable +``` + +4. Generate the registration file: + +```sh +docker run --rm -v `pwd`:/data:z dock.mau.dev/mautrix/whatsapp +``` + +5. Configure Dendrite to use the WhatsApp bridge by editing `config/dendrite/dendrite.yaml`: + +```yaml +app_service_api: + config_files: + - "/etc/whatsapp/registration.yaml" +``` + +## Starting the Bridge + +1. Start the WhatsApp bridge service: + +```sh +docker compose up -d mautrix-whatsapp +``` + +2. Restart Dendrite to load the new bridge configuration: + +```sh +docker compose restart monolith +``` + +## Verifying the Setup + +1. Check if the bridge is running: + +```sh +docker compose logs mautrix-whatsapp +``` + +You should see messages indicating the bridge has started successfully. + +## Next Steps + +- Set up your WhatsApp account in Matrix by starting a chat with `@whatsappbot:your.domain.com`. +- Follow the bot's instructions to link your WhatsApp account. +- Once configured, you can proceed to set up the [Telegram Bridge](../mautrix-telegram/README.md). + +## Troubleshooting + +If you encounter issues: +- Verify all configuration files have the correct permissions. +- Check the bridge logs using `docker compose logs mautrix-whatsapp`. +- Ensure the database connection string is correct. +- Verify the Dendrite configuration includes the correct path to the registration file.