From 718f67abbcacf3105d5eab056ec5ac5ecafe2bd5 Mon Sep 17 00:00:00 2001 From: Krzysiek Madejski Date: Thu, 19 Sep 2019 18:12:37 +0200 Subject: [PATCH] Updated Section Whatsapp (basic) (markdown) --- Section-WhatsApp-(basic).md | 74 +++++++++++++++++++++++++++++++++++++ Section-Whatsapp-(basic).md | 22 ----------- 2 files changed, 74 insertions(+), 22 deletions(-) create mode 100644 Section-WhatsApp-(basic).md delete mode 100644 Section-Whatsapp-(basic).md diff --git a/Section-WhatsApp-(basic).md b/Section-WhatsApp-(basic).md new file mode 100644 index 0000000..f1f95d8 --- /dev/null +++ b/Section-WhatsApp-(basic).md @@ -0,0 +1,74 @@ +# 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): + +![](https://user-images.githubusercontent.com/8722846/64077252-ae3be180-ccce-11e9-812e-6e8a1e833346.png) + +## 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 == "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 \ No newline at end of file diff --git a/Section-Whatsapp-(basic).md b/Section-Whatsapp-(basic).md deleted file mode 100644 index 327ae42..0000000 --- a/Section-Whatsapp-(basic).md +++ /dev/null @@ -1,22 +0,0 @@ -``` -[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 \ No newline at end of file