hoehermann / purple-gowhatsapp

Pidgin/libpurple plug-in for WhatsApp Web.
GNU General Public License v3.0
289 stars 34 forks source link
instant-messaging libpurple libpurple-plugin pidgin pidgin-plugin pidgin-plugins whatsapp whatsapp-api whatsapp-web

purple-gowhatsapp

A libpurple/Pidgin plugin for WhatsApp. Being developed on Ubuntu 22.04.

This is a re-write of purple-gowhatsapp, switching back-ends from go-whatsapp to whatsmeow. whatsmeow is written by Tulir Asokan. It has multi-device support.

Instant Message

Download

Features

Standard features:

Major differences from the go-whatsapp vesion:

Other improvements:

Known issues:

Other planned features:

These features will not be worked on:

Building

Linux

Dependencies:

For Ubuntu, or Debian compliant Linux flavors, use the apt package manager to install these dependencies first:

sudo apt install pidgin pkg-config cmake make golang gcc libgdk-pixbuf2.0-dev libopusfile-dev

This project uses CMake.

git submodule update --init
mkdir build
cd build
cmake ..
cmake --build .
sudo make install/strip

Note: If you configure the project for using user-specific installation paths before building, you may install without sudo:

cmake -DPURPLE_DATA_DIR:PATH=~/.local/share -DPURPLE_PLUGIN_DIR:PATH=~/.purple/plugins ..

In the build directory, you can also create a Debian package:

cpack

You should not do that with user-specific paths, obviously.

Windows Specific

CMake will try to set-up a development environment automatically.

Additional dependencies:

This is known to work with MSYS make and CMake generator "MSYS Makefiles". go and gcc must be in %PATH%.
At time of writing, cgo does not support MSVC.

For sending opus in ogg audio files as voice messages, add a static win32 build of opusfile to CMake's prefix path or use vcpkg's toolchain file:

vcpkg.exe install opusfile:x86-mingw-static
cmake -DCMAKE_TOOLCHAIN_FILE="wherever/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x86-mingw-static -DVCPKG_MANIFEST_MODE=OFF -G "MSYS Makefiles" ..

Installation

Set-Up

Purple Settings

Notes

Conditions for Sending Media Messages

WhatsApp is very picky about media messages. This is actually a good thing for ensuring compatibility on all devices and clients (Android, iOS, all browsers for WhatsApp Web…).

Image Message

An image may be sent as an image message (JPEG, image/jpeg). This is relatively straight-forward.

Voice Message

This feature is only available if the plug-in has been built with liboggfile.

A voice message must meet these criteria:

Additional recommendations:

This kind of message is also known as "push to talk" (PTT). While it is possible to send other audio formats as non-voice audio messages, this plug-in only considers data for voice messages. Everything else is send as a document message.

Video Message

A video message must meet these criteria:

Not all of these values are checked by the plug-in. Some of these criteria are guessed and may not actually be WhatsApp restrictions.

Document Message

A file is sent as-is.

Proxy Support

whatsmeow offers support for SOCKS5 proxies only. Even if no proxy settings are set in purple, the underlying Go runtime might pick up the https_proxy environment variable anyway.

Slash Commands

This plug-in supports a couple of "IRC-style" commands. The user can write them in any chat. These features are experimental hacks. They have been included due to user reuqets. Use them with care.

Attachment Handling and Memory Consumption

Attachments (images, videos, voice messages, stickers, document) are always downloaded as soon as the message is processed. The user is then asked where they want the file to be written. During this time, the file data is residing in memory multiple times:

On systems with many concurrent connections, this could exhaust memory.

As of writing, whatsmeow does not offer an interface to read the file in chunks.

Acknowledgements