# @open-wa/wa-automate-socket-client

> Easily connect to remote instances of the EASY API

Latest version **3.3.0** (published 2023-05-20) · H-DNH V1.0 license · 0 weekly downloads

## Install

```sh
npm install @open-wa/wa-automate-socket-client
pnpm add @open-wa/wa-automate-socket-client
yarn add @open-wa/wa-automate-socket-client
bun add @open-wa/wa-automate-socket-client
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.3.0 |
| Published | 2023-05-20 |
| First published | 2021-08-31 |
| Weekly downloads | 0 |
| License | H-DNH V1.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 55.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Mohammed Shah |
| Maintainers | smashah |
| Keywords | wa-automate, easy-api, remote, socket |

## Links

- npm: https://www.npmjs.com/package/@open-wa/wa-automate-socket-client
- Repository: https://github.com/open-wa/wa-automate-socket-client-nodejs
- Homepage: https://github.com/open-wa/wa-automate-socket-client-nodejs#readme
- Issues: https://github.com/open-wa/wa-automate-socket-client-nodejs/issues
- npm.io page: https://npm.io/package/@open-wa/wa-automate-socket-client

## Dependencies (6)

- [uuid](https://npm.io/package/uuid.md) ^9.0.0
- [debug](https://npm.io/package/debug.md) ^4.3.4
- [eventemitter2](https://npm.io/package/eventemitter2.md) ^6.4.9
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^4.6.1
- [@discordjs/collection](https://npm.io/package/@discordjs/collection.md) ^0.8.0
- [@open-wa/wa-automate-types-only](https://npm.io/package/@open-wa/wa-automate-types-only.md) *

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 3.3.0 (latest) — 2023-05-20
- 3.2.0 — 2023-04-06
- 3.1.0 — 2023-04-05
- 3.0.1 — 2023-01-09
- 3.0.0 — 2023-01-09
- 2.2.1 — 2022-08-22
- 2.2.0 — 2022-05-18
- 2.1.1 — 2022-04-23
- 2.1.0 — 2022-02-09
- 2.0.0 — 2021-10-09
- 1.0.10 — 2021-09-24
- 1.0.9 — 2021-09-24
- 1.0.8 — 2021-09-24
- 1.0.7 — 2021-09-24
- 1.0.6 — 2021-09-24
- … 5 more at https://npm.io/package/@open-wa/wa-automate-socket-client/versions

## README

# Remote Socket Client

## How to:

1. Run the EASY API

```bash
> npx @open-wa/wa-automate --socket -p 8002 -k api_key
```

Note: `--socket` flag is required!!

2. Typescript code:

```javascript
import {
    Client,
    SocketClient,
} from "@open-wa/wa-automate-socket-client";

const NUMBER = 'TEST_PHONE_NUMBER@c.us'

const start = async () => {
    const client = await SocketClient.connect(
        "http://localhost:8002",
        "api_key"
    ) as SocketClient & Client;

    client.onAnyMessage((message) => {
        console.log("onAnyMessage", message.id, message.body);
    });

    const socketId = client.socket.id;
    console.log("🚀 ~ file: client.ts ~ line 144 ~ start ~ socketId", socketId);

    console.log(
        "Connected!",
        await client.sendText(NUMBER, "this is a text")
    );
    client
        .sendAudio(
            NUMBER,
            "https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3"
        )
        .then((audoMessageId) => console.log(audoMessageId));

    console.log(
        await client.sendFile(
            NUMBER,
            "https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4",
            "test.mp4",
            "hellow"
        )
    );
};

start();
```

---
_Source: https://npm.io/package/@open-wa/wa-automate-socket-client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
