3 Section WhatsApp (basic)
Qais Patankar edited this page 2020-02-08 20:15:52 +00:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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: Its 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 wont work (e.g. from the screenshot above, “Test” wont 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 doesnt even mention the gateway part.)

How to set a nice channel name?

Use tengo:

Save below snippet as myremotenickformat.tengo

if channel == "48111222333-1549986983@g.us" {
        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: - https://github.com/tulir/mautrix-whatsapp/wiki/Android-VM-Setup - KaiOs - https://blog.whatsapp.com/10000649/WhatsApp-for-JioPhone-on-KaiOS?l=en - KaiOS is a fork of FirefoxOS, thus basically a glorified browser and this app is most likely a HTML5 / Javascript application. Edit: https://ftp.mozilla.org/pub/labs/fxos-simulator/ https://developer.mozilla.org/en-US/docs/Archive/B2G_OS/Simulator (Which is a plugin for Firefox)

Contributors

  • @JoKeyser
  • @poVoq
  • @42wim