# roleewhatsapp_demo

> WhatsApp CLI

Latest version **0.25.8** (published 2024-06-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install roleewhatsapp_demo
pnpm add roleewhatsapp_demo
yarn add roleewhatsapp_demo
bun add roleewhatsapp_demo
```

Provides the command `roleewhatsapp_demo`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.25.8 |
| Published | 2024-06-10 |
| First published | 2024-03-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 9 |
| Unpacked size | 123.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | roleesoft.com@gmail.com |
| Maintainers | roleesoft |

## Links

- npm: https://www.npmjs.com/package/roleewhatsapp_demo
- npm.io page: https://npm.io/package/roleewhatsapp_demo

## Dependencies (9)

- [mime](https://npm.io/package/mime.md) ^3.0.0
- [pino](https://npm.io/package/pino.md) ^7.0.0
- [signale](https://npm.io/package/signale.md) ^1.4.0
- [commander](https://npm.io/package/commander.md) ^9.4.1
- [@hapi/boom](https://npm.io/package/@hapi/boom.md) ^10.0.0
- [global-agent](https://npm.io/package/global-agent.md) ^3.0.0
- [qrcode-terminal](https://npm.io/package/qrcode-terminal.md) ^0.12.0
- [@adiwajshing/keyed-db](https://npm.io/package/@adiwajshing/keyed-db.md) ^0.2.4
- [@whiskeysockets/baileys](https://npm.io/package/@whiskeysockets/baileys.md) 6.6.0

## Recent versions

- 0.25.8 (latest) — 2024-06-10
- 0.25.2 — 2024-05-21
- 0.25.1 — 2024-03-19

## README

# RoleeWhatsApp_Demo

> [!WARNING]
> DO NOT USE THIS TOOL FOR IMPORTANT THINGS. This tool can stop working without notice since it depends on libraries
> that could be removed any time from GitHub/NPM.

![Logo](https://github.com/roleesoft/roleewhatsapp_demo/blob/main/doc/roleewhatsapp-demo-logo-180x180.png?raw=true)

Send WhatsApp messages from the command-line, see also
this [Medium post](https://levelup.gitconnected.com/how-to-send-whatsapp-messages-from-the-command-line-d1afd8b55de5).

This project is based on [Baileys](https://github.com/WhiskeySockets/Baileys),
a full-featured WhatsApp Web+Multi-Device API library (in case you're wondering
about the name, a RoleeWhatsApp_Demo is a Baileys cocktail).

Keep in mind that the working of RoleeWhatsApp_Demo depends on the Baileys library and
since that is not an official supported library by WhatsApp it could stop
working without notice.

# Installation

Using `npx`, installation is not necessary. You can run RoleeWhatsApp_Demo on a system
with NodeJS 16 or higher from the command-line as follows:

```shell
npx roleewhatsapp_demo@latest -V
```

this should display the version number of the latest release.

Using `npm` RoleeWhatsApp_Demo can be installed globally as follows:

```shell
npm install -g roleewhatsapp_demo
```

## Platform binaries

Binaries for different platforms (Linux, Windows) are available on the [latest
release page](https://github.com/roleesoft/roleewhatsapp_demo/releases/latest).

## Docker

RoleeWhatsApp_Demo can also run inside a Docker container, you can build the Docker image
using the supplied `Dockerfile`:

```shell
docker build -t roleewhatsapp_demo .
```

Test if the build was successful:

```shell
docker run -it roleewhatsapp_demo
```

Since RoleeWhatsApp_Demo keeps authentication state on disk you need to mount a state
directory outside the container, for example:

```shell
docker run -v $HOME/.local/share/roleewhatsapp_demo:/usr/src/app/cache -it roleewhatsapp_demo login
```

or:

```shell
docker run -v $HOME/.local/share/roleewhatsapp_demo:/usr/src/app/cache roleewhatsapp_demo me
```

## Docker Compose

If you chose to use `docker-compose` instead of `docker` you can build the
Docker image using the supplied `docker-compose.yml` file (which in turn
depends on the supplied `Dockerfile`): 

```shell
docker-compose build
```

Test if the build was successful:

```shell
docker-compose run roleewhatsapp_demo
```

Since RoleeWhatsApp_Demo keeps authentication state on disk you need to mount a state
directory outside the container, for example in `~/.local/share/roleewhatsapp_demo`:

See respective lines in `docker-compose.yml`
```yaml
    volumes:
        - ~/.local/share/roleewhatsapp_demo:/usr/src/app/cache
```

# Configuration

By default WhatsApp credentials are cached in a folder located in the user's
home directory. This folder is `.local/share/roleewhatsapp_demo'` on Linux & macOS and
`AppData\Local\roleewhatsapp_demo\Data` on Windows.

A different location for the cache folder can be configured via the environment
variable `ROLEEWHATSAPP_DEMO_CACHE_FOLDER` or the `-c`/`--cache` options.

## Running behind a proxy server

When the global option `--proxy` is used, RoleeWhatsApp_Demo will use the environment variables `HTTP_PROXY` and `HTTPS_PROXY` to
proxy all requests. For example:

```shell
export HTTP_PROXY=http://USER:PASS@proxy.server.com:80
export HTTPS_PROXY=http://USER:PASS@proxy.server.com:80
npx roleewhatsapp_demo@latest --proxy login
```

# Usage

Available commands and options can be listed with `--help` flag:

```shell
npx roleewhatsapp_demo@latest --help
```

for most command it's necessary that you've authorized RoleeWhatsApp_Demo to interact
with the WhatsApp API on your behalf. This can be done by logging in as
described below.

## Login

To login you need to authorize RoleeWhatsApp_Demo from another device that has WhatsApp
installed and scan the QR code printed in the terminal:

```shell
npx roleewhatsapp_demo@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_Demo.

## Logout

Logging out removes credentials from your local environment but will not
disconnect RoleeWhatsApp_Demo from your WhatsApp account, you can disconnect RoleeWhatsApp_Demo
using the WhatsApp app.

```shell
npx roleewhatsapp_demo@latest logout
```

## Different types of recipients

Muslide supports three types of recipients for sending messages/images/files/etc.:

1. An international phone number (e.g.: `3161234567890`)
2. The authenticated user: `me`
3. A so-called WhatsApp ID, for example a group ID: `123456789-987654321@g.us`

## Sending a message to yourself or a phone number

Using the recipient `me` you can send yourself a test message:

```shell
npx roleewhatsapp_demo@latest send me 'hello world'
```

To send a message to a phone number:

```shell
npx roleewhatsapp_demo@latest send 3161234567890 'hello world'
```

To send a message to a group you are particpating in you need the group ID (see
the `roleewhatsapp_demo groups` command). Send a message to a group as follows:

```shell
npx roleewhatsapp_demo@latest send 123456789-987654321@g.us 'hello world'
```

Use `\n` to send a message with a newline, for example:

```shell
npx roleewhatsapp_demo@latest send me 'hello\nworld'
```

## Sending an image file

Image files (PNG, JPG, GIF) can be sent to individuals or groups:

```shell
npx roleewhatsapp_demo@latest send-image me image.png
```

```shell
npx roleewhatsapp_demo@latest send-image 123456789-987654321@g.us image.jpg
```

> **Note**
> In case there is a space in the path or the file name, enclose the entire
> path and file name in quotes (")

### Image captions

Use the `--caption` option to add a caption to the image:

```shell
npx roleewhatsapp_demo@latest send-image --caption 'Your text here' me image.png
```

## Sending other files

Single files can be sent to individuals or groups:

```shell
npx roleewhatsapp_demo@latest send-file me test.json
```

```shell
npx roleewhatsapp_demo@latest send-file 123456789-987654321@g.us document.pdf
```

> **Note**
> In case there is a space in the path or the file name, enclose the entire
> path and file name in quotes (")

### File types

By default, files will be sent as "documents" and show as a download link in the chat.
The `--type` option can be used for audio and video files that show as a playable message in the chat:

```shell
npx roleewhatsapp_demo@latest send-file --type audio 123456789-987654321@g.us music.mp3
```

## Sending a location

Geographic locations can be sent to individuals or groups using latitude and
longitude coordinates. For example, to position yourself at the Eiffel Tower:

```shell
npx roleewhatsapp_demo@latest send-location me 48.858222 2.2945
```

Or to send your location at the Sydney Opera House to a group:

```shell
npx roleewhatsapp_demo@latest send-location 123456789-987654321@g.us -33.857058 151.214897
```

## Sending a poll

Polls can be sent to individuals or groups, and allow participants to select 1
or more items.

For example, to send a poll for the summer holiday destination, allowing
participants to select 2 items, use:

```shell
npx roleewhatsapp_demo@latest send-poll 123456789-987654321@g.us 'Summer holiday destination' --item '🇫🇷 France', --item '🇪🇸 Spain' --item '🇮🇹 Italy' --item '🇨🇭 Switzerland' --selectable 2
```

Or to send a quick poll to check who's going training on Friday:

```shell
npx roleewhatsapp_demo@latest send-poll 123456789-987654321@g.us 'Training on Friday' --item 'Yeeeess!' --item 'Nope' --item 'Maybe...'
```

## List your groups

To list all the groups you are participating in:

```shell
npx roleewhatsapp_demo@latest groups
```

this will show a list of group IDs and subjects.

## Add/remove group participants

Participants can be added/removed from existing groups as follows:

```shell
npx roleewhatsapp_demo@latest add-to-group 123456789-987654321@g.us 3161234567890
```

```shell
npx roleewhatsapp_demo@latest remove-from-group 123456789-987654321@g.us 3161234567890
```

## Show current user details

To get the WhatsApp ID of the logged in user:

```shell
npx roleewhatsapp_demo@latest me
```

# Troubleshooting

In case RoleeWhatsApp_Demo does not give any output or does not behave as expected, try
removing the local cache folder (see [Configuration section](#configuration)),
then disconnect the client using your mobile WhatsApp app, and login again.

To see what goes on in more detail, the verbosity of RoleeWhatsApp_Demo can be incrased
with the global option `-v`. Use `-vvv` for the greatest level of detail:

```shell
npx roleewhatsapp_demo@latest -vvv me
```

# Development

## Running unit-tests

To run the unit-tests run this command:

```shell
yarn test
```

# Feedback, suggestions and bug reports

Please create an issue here: https://github.com/roleesoft/roleewhatsapp_demo/issues

# Contributing

If you have suggestions for how RoleeWhatsApp_Demo could be improved, or want to report a
bug, [open an issue](https://github.com/roleesoft/roleewhatsapp_demo/issues)! All and
any contributions are appreciated.

# License

[ISC](LICENSE) © 2022 <roleesoft.com@gmail.com>

---
_Source: https://npm.io/package/roleewhatsapp_demo · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
