mautrix / whatsapp

A Matrix-WhatsApp puppeting bridge
https://maunium.net/go/mautrix-whatsapp
GNU Affero General Public License v3.0
1.26k stars 172 forks source link

How include this project to Synapse? #140

Closed ahvahsky2008 closed 4 years ago

ahvahsky2008 commented 4 years ago

Tell me the minimum settings to make this connector work? Manuall in Readme is is very superficial

tulir commented 4 years ago

Did you read the wiki (that's linked in the readme)?

ahvahsky2008 commented 4 years ago

Did you read the wiki (that's linked in the readme)?

Yes I do.

ahvahsky2008 commented 4 years ago

1) You need to make sure that the address and domain field point to your homeserver. image 2) You will also need to add your user of admin user under the permissions section. image 3) Generate the appservice registration file by running ./mautrix-whatsapp -g. image 4) Add the path to the registration file (registration.yaml by default) to your synapse homeserver.yaml under app_service_config_files. You will then need to restart the synapse server. Remember to restart it every time the registration file is regenerated. image 5) Run the bridge with ./mautrix-whatsapp. image

vmario89 commented 4 years ago

Hi, http 502 means "Bad Gateway". Maybe your apache/httpd/nginx/whatever web server is not configured correctly.

What happens when you access your homeserver url at this point in browser or by curl?

you can try our's for reference: https://matrix.fablabchemnitz.de/_matrix/client/r0/account/whoami grafik

ahvahsky2008 commented 4 years ago

image

ahvahsky2008 commented 4 years ago

image

vmario89 commented 4 years ago

hi, yeah it should be that issue. i think your whatsapp thing is configured properly. to make it work you need to make API available

you can use https://github.com/kamax-matrix/mxisd/blob/master/docs/getting-started.md for reference

    ProxyPreserveHost on

    ProxyPass /_matrix/identity http://localhost:8090/_matrix/identity
    ProxyPass /_matrix http://localhost:8008/_matrix

hopefully thats the thing which fixed your issue

ahvahsky2008 commented 4 years ago

image

I dont have services on this ports

vmario89 commented 4 years ago

at least 8008 should be listening if you configured matrix with standard ports:

pid_file: "/var/run/matrix-synapse.pid"
public_baseurl: https://matrix.yourdomain.de/
soft_file_limit: 0
use_presence: true
listeners:
   - port: 8448
     type: http
     bind_addresses:
       - '0.0.0.0'
     tls: true
     x_forwarded: false
     resources:
       - names: [client, federation, consent]
  - port: 8008
    tls: false
    bind_addresses: ['::1', '127.0.0.1']
    type: http
    x_forwarded: true
    resources:
      - names: [client, federation, consent]
        compress: false
vmario89 commented 4 years ago

ps: ignore port 8090 (you mesed 8009 with 8090), i use this port for mxisd service. you dont need it. you only need your localhost port 8008

ahvahsky2008 commented 4 years ago

[ERROR] Failed to connect to homeserver: msg=Failed to GET JSON to /_matrix/client/r0/account/whoami code=401 wrapped=M_UNKNOWN_TOKEN: Invalid macaroon passed.. Retrying in 10 seconds...

puredevotion commented 4 years ago

I'm trying to set this up for the first time as well, and at the same point in the process.

Synapse (running on localhost) has port 8008 open, and the logs show that it loads the registration.yaml. Synapse is reachable by riot. I created a separate admin account using the command line, and added that account to the configuration of the bridge (admin:localhost 100)

The bridge states:

http://localhost:8008/_matrix/client/r0/account/whoami?user_id=%40whatsappbot%3Alocalhost: dial tcp 127.0.0.1:8008: connect: connection refused.

http://localhost:8008/_matrix/client/r0/account/whoami gives the missing access token JSON message.

Couple of ideas:

vmario89 commented 4 years ago

hi, you dont need to create a whatsapp user in Riot by yourself. if you start the mautrix-whatsapp process successfully it will do this for you automatically. I dont know how this is done with docker. i set up all the stuff manually. perhaps you need to make some shared folder between synapse docker and whatsapp docker, because synpase needs to access the registration yaml file, for me this is /opt/matrix-bridges/mautrix-whatsapp/registration.yaml

when configuring synapse homeserver.yaml to add the registration.yaml of whatsapp then remember to restart synapse and check it's logs with journalctl -u matrix-synapse.service

did you run "mautrix-whatsapp -g" successfully?

belonging to mxisd question: no you dont need it at all. the "only" thing mxisd does is a kind of mapping between matrix IDs and third party IDs like email or mobile phone number. So they call the them third party ids or in short "3PID". its some kind of comfort or better account handling. it also allows to use LDAP and other stuff. But as mxisd is not developed anymore it might break in future synapse releases :-(

puredevotion commented 4 years ago

Ah, I have now copied the registration.yaml to the synapse container, and the whatsapp bridge running in a second separate container.

I will set-up a VM, and run everything in the same VM to see if that works.

redhatvan commented 4 years ago

Hi

I think I have the same issue with matrix-synapse and mautix-whatsapp on the same machine(VM). Tried to put proxy pass _matrix/identity on nginx restarted the service but no luck.

But this one I received 404.

Screen Shot 2020-04-22 at 3 39 52 PM
tulir commented 4 years ago

The Matrix room (#whatsapp:maunium.net) is better for setup support, GitHub issues are mostly for actual bugs/feature requests/etc