Skip to content

Section WhatsApp (basic)

Qais Patankar edited this page Feb 8, 2020 · 3 revisions

Configuration

[whatsapp.mywhatsapp]
# Number you will use as a relay bot. Tip: Get some disposable sim card, don't rely on 
# your own number.
Number="+48111222333"

# First time that you login you will need to scan QR code, then credentials will be saved in 
# a session file. 
# If you won't set SessionFile then you will need to scan QR code on every restart.
# optional (by default the session is stored only in memory, till restarting matterbridge)
SessionFile="session-48111222333.gob"

# If your terminal is white we need to invert QR code in order for it to be scanned properly
# optional (default false)
QrOnWhiteTerminal=false

# Messages will be seen by other WhatsApp contacts as coming from the bridge. 
# Original nick will be part of the message.
RemoteNickFormat="[{PROTOCOL}] @{NICK}: "

For a full working example see: https://github.com/Code-for-All/matterbridge-config/blob/master/matterbridge.toml

FAQ

What is the QR-code about?

The QR-Code is created by matterbridge on the terminal: It's the way WhatsApp authenticates any WA-Web session (which the bridge is using). At startup, matterbridge will prompt a QR-code for about 1 minute that you have to scan from your WA-instance (on your phone or android-VM). To scan it, go to Settings > WhatsApp Web in your WA client (if you run a VM, you may need to connect your webcam, or make a virtual one, see link above):

How to set the WA-channel in the configuration file of matterbridge?

To setup a gateway between two protocols in matterbridge, you need to specify a channel for WA that should be bridged. The chat/group titles you see in WA won't work (e.g. from the screenshot above, "Test" won't work). Fortunately, matterbridge will complain about improper channel names and suggest the correct ones to you. In my case, it was a string of mainly numbers including the phone number of who created the group chat. Maybe there is a way to get this out of WA? (Currently, the WA example config does not explain this at all; it doesn't even mention the gateway part.)

How to set a nice channel name?

Use tengo:

Save below snippet as myremotenickformat.tengo

if channel == "[email protected]" {
        result = "[CfP #Code for Pakistan] @"+nick
}

Add RemoteNickFormat="{TENGO}" to the specific bridge

and add the following in matterbridge.toml

[tengo]
RemoteNickFormat="myremotenickformat.tengo"

For context see: https://github.com/42wim/matterbridge/issues/725

Is it possible to run WA on virtual Android VM?

You can follow these leads and update the wiki:

Contributors

  • @JoKeyser
  • @poVoq
  • @42wim
Clone this wiki locally