
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
roleewhatsapp
Advanced tools
Send WhatsApp messages from the command-line, see also this Medium post.
This project is based on Baileys, a full-featured WhatsApp Web+Multi-Device API library (in case you're wondering about the name, a roleewhatsapp is a Baileys cocktail).
Keep in mind that the working of roleewhatsapp depends on the Baileys library and since that is not an official supported library by WhatsApp it could stop working without notice.
Using npx
, installation is not necessary. You can run roleewhatsapp on a system
with NodeJS 16 or higher from the command-line as follows:
npx roleewhatsapp@latest -V
this should display the version number of the latest release.
Using npm
roleewhatsapp can be installed globally as follows:
npm install -g roleewhatsapp
Binaries for different platforms (Linux, Windows) are available on the latest release page.
roleewhatsapp can also run inside a Docker container, you can build the Docker image
using the supplied Dockerfile
:
docker build -t roleewhatsapp .
Test if the build was successful:
docker run -it roleewhatsapp
Since roleewhatsapp keeps authentication state on disk you need to mount a state directory outside the container, for example:
docker run -v /home/<USERNAME>/.local/share/roleewhatsapp:/usr/src/app/cache login
Available commands and options can be listed with --help
flag:
npx roleewhatsapp@latest --help
for most command it's necessary that you've authorized roleewhatsapp to interact with the WhatsApp API on your behalf. This can be done by logging in as described below.
When the global option --proxy
is used, roleewhatsapp will use the environment variables HTTP_PROXY
and HTTPS_PROXY
to
proxy all requests. For example:
export HTTP_PROXY=http://USER:PASS@proxy.server.com:80
export HTTPS_PROXY=http://USER:PASS@proxy.server.com:80
npx roleewhatsapp@latest --proxy login
To login you need to authorize roleewhatsapp from another device that has WhatsApp installed and scan the QR code printed in the terminal:
npx roleewhatsapp@latest login
█▀▀▀▀▀█ ▀▀ ▀ █ █▀▀▀▀▀█
█ ███ █ █▄ █▀▀▀▀ █ ███ █
█ ▀▀▀ █ ▀█▀▀▄▀█▀▀ █ ▀▀▀ █
▀▀▀▀▀▀▀ ▀▄▀▄▀▄█▄▀ ▀▀▀▀▀▀▀
▀███▄ ▀▄▀▄ ▀▀ █▀ ▄▀▀▀▄▀
█▄▄▄▄ ▀ ▄ ▄▄▄█▄ ▄█▀ ▄▄
▀▄ ▄▀ ▀ ▄█▄█ ▄ ▄ ██▄█ ▀▀█
▄▀▄██▀▀██▄▀ █▄▀▄▄█▀▄█ ▀▀▄
▀▀▀ ███▀▄▄ █▀▀▀█▀█▀█
█▀▀▀▀▀█ ▀▀█ ▄█ ▀ █ ▀██
█ ███ █ ▄▄█▀██▄▄▀██▀██▄▄▄
█ ▀▀▀ █ █▀▀▀▀▀ ▀▀█▀ █ █▀
▀▀▀▀▀▀▀ ▀▀▀ ▀ ▀ ▀ ▀▀▀▀▀▀
In the WhatsApp mobile app go to "Settings > Connected Devices > Connect Device" and scan the QR code. Wait until the status is "active", then you can exit roleewhatsapp.
Logging out removes credentials from your local environment but will not disconnect roleewhatsapp from your WhatsApp account, you can disconnect roleewhatsapp using the WhatsApp app.
npx roleewhatsapp@latest logout
Muslide supports three types of recipients for sending messages/images/files/etc.:
3161234567890
)me
123456789-987654321@g.us
Using the recipient me
you can send yourself a test message:
npx roleewhatsapp@latest send me 'hello world'
To send a message to a phone number:
npx roleewhatsapp@latest send 59167286087 'hello world'
To send a message to a group you are particpating in you need the group ID (see
the roleewhatsapp groups
command). Send a message to a group as follows:
npx roleewhatsapp@latest send 123456789-987654321@g.us 'hello world'
Use \n
to send a message with a newline, for example:
npx roleewhatsapp@latest send me 'hello\nworld'
Image files (PNG, JPG, GIF) can be sent to individuals or groups:
npx roleewhatsapp@latest send-image me image.png
npx roleewhatsapp@latest send-image 123456789-987654321@g.us image.jpg
Use the --caption
option to add a caption to the image:
npx roleewhatsapp@latest send-image --caption 'Your text here' me image.png
Single files can be sent to individuals or groups:
npx roleewhatsapp@latest send-file me test.json
npx roleewhatsapp@latest send-file 123456789-987654321@g.us document.pdf
Geographic locations can be sent to individuals or groups using latitude and longitude coordinates. For example, to position yourself at the Eiffel Tower:
npx roleewhatsapp@latest send-location me 48.858222 2.2945
Or to send your location at the Sydney Opera House to a group:
npx roleewhatsapp@latest send-location 123456789-987654321@g.us -33.857058 151.214897
To list all the groups you are participating in:
npx roleewhatsapp@latest groups
this will show a list of group IDs and subjects.
Participants can be added/removed from existing groups as follows:
npx roleewhatsapp@latest add-to-group 123456789-987654321@g.us 3161234567890
npx roleewhatsapp@latest remove-from-group 123456789-987654321@g.us 3161234567890
To get the WhatsApp ID of the logged in user:
npx roleewhatsapp@latest me
By default WhatsApp credentials are cached in a folder located in the user's
home directory. This folder is .local/share/roleewhatsapp'
on Linux & macOS and
AppData\Local\roleewhatsapp\Data
on Windows.
A different location for the cache folder can be configured via the environment
variable roleewhatsapp_CACHE_FOLDER
or the -c
/--cache
options.
To run the unit-tests run this command:
yarn test
Please create an issue here: https://github.com/roleesoft/roleewhatsapp/issues
If you have suggestions for how roleewhatsapp could be improved, or want to report a bug, open an issue! All and any contributions are appreciated.
ISC © 2022 Rob van der Leek robvanderleek@gmail.com (https://twitter.com/robvanderleek)
FAQs
WhatsApp CLI
The npm package roleewhatsapp receives a total of 0 weekly downloads. As such, roleewhatsapp popularity was classified as not popular.
We found that roleewhatsapp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.