This repo shows a simple way to create a memory efficient API out of your WhatsApp account using docker.
There are a few steps you have to follow in order to get started.
- Clone the repo
- Create a session.data.json file
- Build and deploy the containers.
Let's get started.
-
Clone the repo
> git clone https://github.com/open-wa/wa-automate-docker.git && cd wa-automate-docker
-
Create a session.data.json file
In order to make sure you have a persistent session, you should create the session.data.json file (the super sensitive file which contains all data required to authenticate the session) outside the container intially. You could also just copy and paste an existing
session.data.json
file.The quickest way to do this after cloning the repo, run the following code:
> npm run sessiondata
After scanning the QR code, a session.data.json file will be saved to the folder. Make sure to keep this safe and leave it in this folder. You can end the process when the session data is saved.
Note: The file MUST BE NAMED
session.data.json
-
Build and deploy the containers
First of all, make sure you have docker and docker-compose installed. Then run the following command in the folder.
> docker-compose up --build
It's very simple to use this efficient docker setup on your own custom app made with @open-wa/wa-automate-nodejs.
-
Copy Dockerfile and docker-compose.yaml into the top level of your project folder (next to package.json).
-
Uncomment line 12 in Dockerfile to install the required dependencies for your app.
-
Wehn you're ready, run:
> docker-compose up --build
As of @open-wa/wa-automate-nodejs version 2.0.0, it is now possible to set the session data as an environment variable WA_SESSION_DATA
string.
For more updates on the features of this docker set up please star the NodeJS library.