Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion docs/docs/configuration/multiple-sessions.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
# Multiple Sessions

:::tip New Multi-Session Server Mode
For easier management of multiple sessions, check out the new [Multi-Session Mode](/docs/get-started/multi-session) which provides a dedicated server with REST API and web interface for managing multiple WhatsApp sessions.
:::

You can run multiple sessions of @open-wa/wa-automate in the same process. This allows you to do interesting things for example:

1. Design and run automated tests for you WA bot.
2. Connect two or more WA numbers to a single (or multiple) message handler(s)
3. Use one client to make sure another one is alive by pinging it.

## Approaches

There are two main approaches for running multiple sessions:

### 1. Multi-Session Server Mode (Recommended)
Use the dedicated multi-session server for easier management:
```bash
node bin/multi-session.js --port 8080 --max-sessions 10
```
See [Multi-Session Mode](/docs/get-started/multi-session) for complete documentation.

### 2. Programmatic Multiple Sessions
Create multiple sessions in your own code as described below.

Please see demo/index.ts for a working example

NOTE: DO NOT CREATE TWO SESSIONS WITH THE SAME SESSIONID. DO NOT ALLOW SPACES AS SESSION ID.
Expand Down Expand Up @@ -67,4 +85,4 @@ sendText(sessionId, params){
}

create().then(client => start);
```
```
Loading