Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c61da10523 | ||
|
|
1f53d65ac2 | ||
|
|
844ab1287e | ||
|
|
d6d318b23b | ||
|
|
7504ffd934 | ||
|
|
e8078908c9 | ||
|
|
431848280f | ||
|
|
2e0c575512 | ||
|
|
ebf0d99417 | ||
|
|
423d893fee | ||
|
|
56fe0d3b04 | ||
|
|
7172d9d203 | ||
|
|
bd770a6902 | ||
|
|
628508faed | ||
|
|
826634f061 | ||
|
|
c7ed959a71 | ||
|
|
aea6befc1e | ||
|
|
7bb3484788 | ||
|
|
4eafc67a7e | ||
|
|
b5197b6f20 | ||
|
|
d306304195 | ||
|
|
35f47dae4f | ||
|
|
f1be4810d5 | ||
|
|
d4f9406869 | ||
|
|
a41b81d724 | ||
|
|
da56b86102 | ||
|
|
f12d2c9be0 | ||
|
|
322b9b4c25 | ||
|
|
fb7fe410f9 | ||
|
|
ee392a079c | ||
|
|
0502579d50 | ||
|
|
f10f3175d9 | ||
|
|
f155af99f1 | ||
|
|
0fbf3575a6 | ||
|
|
f6b9b5f54e | ||
|
|
2dadd9d8c9 | ||
|
|
5786b3cdfe | ||
|
|
769fc30c0c | ||
|
|
fb2dad9c6f | ||
|
|
c43d308a2d | ||
|
|
742a12ce6a | ||
|
|
d953f27865 | ||
|
|
4719cded95 | ||
|
|
9d489bdb69 | ||
|
|
537c307550 | ||
|
|
d5575e0323 | ||
|
|
592962bbc8 | ||
|
|
7a371c86dc | ||
|
|
0e295bebde | ||
|
|
8d98759be6 | ||
|
|
924317b01b | ||
|
|
a08a601dc3 | ||
|
|
e652c15d6c | ||
|
|
4534eb60de | ||
|
|
54c6c0c24c | ||
|
|
393694ae96 | ||
|
|
818bb730e4 | ||
|
|
61bd35a192 | ||
|
|
81f9df000a | ||
|
|
0dcb31c108 | ||
|
|
cd4140fda9 | ||
|
|
117cc25cdb | ||
|
|
832ad26151 | ||
|
|
5a344cd8ad | ||
|
|
0b0a67cdad | ||
|
|
a326a240f0 | ||
|
|
dfdb033769 | ||
|
|
a31af45d97 | ||
|
|
cae955c483 | ||
|
|
0bfff5259e | ||
|
|
0fa83e603b |
No files matched your search
@@ -0,0 +1,14 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: wa_http_api
|
||||
open_collective: # doks Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom:
|
||||
- https://boosty.to/wa-http-api
|
||||
- https://portal.devlike.pro/
|
||||
@@ -51,7 +51,7 @@ jobs:
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ secrets.DOCKER_IMAGE }}
|
||||
images: ${{ vars.DOCKER_IMAGE }}
|
||||
flavor: latest=false
|
||||
tags: |
|
||||
type=raw,value=${{ matrix.tag }}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
name: Manual push
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
tag:
|
||||
description: 'Tag to push'
|
||||
required: true
|
||||
default: 'dev'
|
||||
push:
|
||||
description: 'Push to registry'
|
||||
required: true
|
||||
type: boolean
|
||||
default: true
|
||||
|
||||
jobs:
|
||||
docker-build:
|
||||
runs-on: ${{ matrix.runner }}
|
||||
name: ${{ matrix.platform }} - ${{ matrix.browser }} - ${{ matrix.tag }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
# Chromium
|
||||
- runner: 'buildjet-4vcpu-ubuntu-2204'
|
||||
tag: 'latest'
|
||||
platform: 'amd64'
|
||||
browser: 'chromium'
|
||||
- runner: 'buildjet-4vcpu-ubuntu-2204-arm'
|
||||
tag: 'arm'
|
||||
platform: 'linux/arm64'
|
||||
browser: 'chromium'
|
||||
# Chrome
|
||||
- runner: 'buildjet-4vcpu-ubuntu-2204'
|
||||
tag: 'chrome'
|
||||
platform: 'amd64'
|
||||
browser: 'chrome'
|
||||
# Chrome is not supported on arm64
|
||||
# - runner: "buildjet-4vcpu-ubuntu-2204-arm"
|
||||
# tag: "chrome-arm"
|
||||
# platform: "linux/arm64"
|
||||
# browser: "chrome"
|
||||
# No browser
|
||||
- runner: 'buildjet-4vcpu-ubuntu-2204'
|
||||
tag: 'noweb'
|
||||
platform: 'amd64'
|
||||
browser: 'none'
|
||||
- runner: 'buildjet-4vcpu-ubuntu-2204-arm'
|
||||
tag: 'noweb-arm'
|
||||
platform: 'linux/arm64'
|
||||
browser: 'none'
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
with:
|
||||
images: ${{ vars.DOCKER_IMAGE }}
|
||||
flavor: latest=false
|
||||
tags: |
|
||||
type=raw,value=${{ inputs.tag }}-${{ matrix.tag }}
|
||||
|
||||
- name: Login to image repository
|
||||
if: github.ref_type == 'tag'
|
||||
uses: docker/login-action@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USER }}
|
||||
password: ${{ secrets.DOCKER_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
platforms: ${{ matrix.platform }}
|
||||
build-args: |
|
||||
USE_BROWSER=${{ matrix.browser }}
|
||||
push: ${{ inputs.push }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
@@ -85,13 +85,13 @@
|
||||
|
||||
[[main]]
|
||||
name = "Get on Patreon ->"
|
||||
weight = 50
|
||||
weight = 60
|
||||
url = "https://patreon.com/wa_http_api"
|
||||
parent = "waha-plus"
|
||||
|
||||
[[main]]
|
||||
name = "Get on Boosty ->"
|
||||
weight = 60
|
||||
weight = 50
|
||||
url = "https://boosty.to/wa-http-api"
|
||||
parent = "waha-plus"
|
||||
|
||||
@@ -104,9 +104,14 @@
|
||||
[[main]]
|
||||
name = "Python ->"
|
||||
weight = 21
|
||||
url = "https://github.com/devlikeapro/whatsapp-http-api/tree/core/examples/python"
|
||||
url = "/docs/examples/python"
|
||||
parent = "examples"
|
||||
|
||||
[[main]]
|
||||
name = "Kotlin ->"
|
||||
weight = 22
|
||||
url = "/docs/examples/kotlin"
|
||||
parent = "examples"
|
||||
|
||||
[[social]]
|
||||
name = "GitHub"
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
---
|
||||
title: "Kotlin"
|
||||
description: "WhatsApp HTTP API + Kotlin examples."
|
||||
lead: "WhatsApp HTTP API + Kotlin examples."
|
||||
date: 2020-10-06T08:49:31+00:00
|
||||
lastmod: 2020-10-06T08:49:31+00:00
|
||||
draft: false
|
||||
images: ["/images/kotlin-whatsapp.png"]
|
||||
menu:
|
||||
docs:
|
||||
parent: "help"
|
||||
weight: 630
|
||||
toc: true
|
||||
---
|
||||
|
||||

|
||||
|
||||
We've created a few examples on how to interact with WAHA WhatsApp HTTP API with Kotlin (ktor).
|
||||
|
||||
You can find the examples in
|
||||
[examples folder on GitHub with detailed instructions in README.md ->](https://github.com/devlikeapro/waha-kotlin)
|
||||
|
||||
## Installation
|
||||
|
||||
We assume that you have installed software:
|
||||
|
||||
1. Kotlin + JVM
|
||||
2. Docker
|
||||
|
||||
### Download and start image
|
||||
|
||||
First of all, you must run WhatsApp HTTP API locally (which under the hood it
|
||||
runs real WhatsApp Web instance and expose HTTP API for interaction).
|
||||
|
||||
Here are the steps from
|
||||
[Quick Start](https://waha.devlike.pro/docs/overview/quick-start/):
|
||||
|
||||
Download and start WhatsApp HTTP API docker container
|
||||
|
||||
```bash
|
||||
# Download the image
|
||||
docker pull devlikeapro/whatsapp-http-api
|
||||
# Run the docker container
|
||||
docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api
|
||||
|
||||
# It prints logs and the last line must be
|
||||
# WhatsApp HTTP API is running on: http://[::1]:3000
|
||||
```
|
||||
|
||||
#### Download image - ARM
|
||||
|
||||
If you're using ARM (like Apple Silicon, Apple M1, etc.) - use following
|
||||
commands to download the image
|
||||
|
||||
 For Core version the command is
|
||||
|
||||
```bash
|
||||
# Download the image
|
||||
docker pull devlikeapro/whatsapp-http-api:arm
|
||||
# Rename it, so you can use devlikeapro/whatsapp-http-api image in other place
|
||||
docker tag devlikeapro/whatsapp-http-api:arm devlikeapro/whatsapp-http-api
|
||||
# Run the docker container
|
||||
docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api
|
||||
|
||||
# It prints logs and the last line must be
|
||||
# WhatsApp HTTP API is running on: http://[::1]:3000
|
||||
```
|
||||
|
||||
### Start session and scan QR
|
||||
|
||||
2. Open Swagger API in the browser http://localhost:3000/
|
||||
3. Start session and scan QR code in swagger
|
||||
1. Find `POST /api/session/start` request press **Try it out** and
|
||||
**Execute** it with `default` session name
|
||||
2. Find `GET /api/screenshot` and execute it - it must show QR code
|
||||
3. Scan QR code on your mobile WhatsApp application (that installed on your
|
||||
phone)
|
||||
4. Execute `GET /api/screenshot` once again - it must show the screenshot
|
||||
from WhatsApp Web.
|
||||
4. Send test text message - find `POST /api/sendText` and execute it with
|
||||
payload (change `12132132130` in the `chatId` to phone number that is
|
||||
registered in WhatsApp).
|
||||
|
||||
```json
|
||||
{
|
||||
"chatId": "12132132130@c.us",
|
||||
"text": "Hi there!",
|
||||
"session": "default"
|
||||
}
|
||||
```
|
||||
|
||||
If you see **Hi there!** message then you're ready to run bots!
|
||||
|
||||
## WhatsApp Echo Bot
|
||||
|
||||
The WhatsApp Echo Bot is a sample ktor webhook server application that echoes
|
||||
back to you whatever you send it. It can serve as a basic reference for how to
|
||||
set up webhooks and reply to incoming messages.
|
||||
|
||||
```bash
|
||||
# Clone the git repository with example
|
||||
git clone https://github.com/devlikeapro/waha-kotlin.git
|
||||
|
||||
# Build and run the app
|
||||
./gradlew build
|
||||
./gradlew run
|
||||
```
|
||||
|
||||
Open http://127.0.0.1:5000/bot - if you see **WhatsApp Echo Bot is ready!** then
|
||||
the bot is ready to receive message!
|
||||
|
||||
Send message to the WhatsApp (that you used to scan QR code) and it'll echo text
|
||||
back to you!
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
---
|
||||
title: "Python"
|
||||
description: "WhatsApp HTTP API Python examples."
|
||||
lead: "WhatsApp HTTP API Python examples."
|
||||
date: 2020-10-06T08:49:31+00:00
|
||||
lastmod: 2020-10-06T08:49:31+00:00
|
||||
draft: false
|
||||
images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "help"
|
||||
weight: 630
|
||||
toc: true
|
||||
---
|
||||
We've created a few examples on how to interact with WAHA WhatsApp HTTP API with Python.
|
||||
|
||||
You can find the examples in [examples folder on GitHub with detailed instructions in README.md](https://github.com/devlikeapro/whatsapp-http-api/tree/core/examples/python)
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
---
|
||||
title: "Python"
|
||||
description: "WhatsApp HTTP API + Python examples."
|
||||
lead: "WhatsApp HTTP API + Python examples."
|
||||
date: 2020-10-06T08:49:31+00:00
|
||||
lastmod: 2020-10-06T08:49:31+00:00
|
||||
draft: false
|
||||
images: ["/images/python-whatsapp.png"]
|
||||
menu:
|
||||
docs:
|
||||
parent: "help"
|
||||
weight: 630
|
||||
toc: true
|
||||
---
|
||||
|
||||

|
||||
|
||||
We've created a few examples on how to interact with WAHA WhatsApp HTTP API with Python.
|
||||
|
||||
You can find the examples in [examples folder on GitHub with detailed instructions in README.md ->](https://github.com/devlikeapro/whatsapp-http-api/tree/core/examples/python)
|
||||
|
||||
## Installation
|
||||
|
||||
We assume that you have installed software:
|
||||
|
||||
1. Python 3
|
||||
2. Docker
|
||||
|
||||
### Download and start image
|
||||
|
||||
First of all, you must run WhatsApp HTTP API locally (which under the hood it
|
||||
runs real WhatsApp Web instance and expose HTTP API for interaction).
|
||||
|
||||
Here are the steps from
|
||||
[Quick Start](https://waha.devlike.pro/docs/overview/quick-start/):
|
||||
|
||||
Download and start WhatsApp HTTP API docker container
|
||||
|
||||
```bash
|
||||
# Download the image
|
||||
docker pull devlikeapro/whatsapp-http-api
|
||||
# Run the docker container
|
||||
docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api
|
||||
|
||||
# It prints logs and the last line must be
|
||||
# WhatsApp HTTP API is running on: http://[::1]:3000
|
||||
```
|
||||
|
||||
#### Download image - ARM
|
||||
|
||||
If you're using ARM (like Apple Silicon, Apple M1, etc.) - use following
|
||||
commands to download the image
|
||||
|
||||
 For Core version the command is
|
||||
|
||||
```bash
|
||||
# Download the image
|
||||
docker pull devlikeapro/whatsapp-http-api:arm
|
||||
# Rename it, so you can use devlikeapro/whatsapp-http-api image in other place
|
||||
docker tag devlikeapro/whatsapp-http-api:arm devlikeapro/whatsapp-http-api
|
||||
# Run the docker container
|
||||
docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api
|
||||
|
||||
# It prints logs and the last line must be
|
||||
# WhatsApp HTTP API is running on: http://[::1]:3000
|
||||
```
|
||||
|
||||
### Start session and scan QR
|
||||
|
||||
2. Open Swagger API in the browser http://localhost:3000/
|
||||
3. Start session and scan QR code in swagger
|
||||
1. Find `POST /api/session/start` request press **Try it out** and
|
||||
**Execute** it with `default` session name
|
||||
2. Find `GET /api/screenshot` and execute it - it must show QR code
|
||||
3. Scan QR code on your mobile WhatsApp application (that installed on your
|
||||
phone)
|
||||
4. Execute `GET /api/screenshot` once again - it must show the screenshot
|
||||
from WhatsApp Web.
|
||||
4. Send test text message - find `POST /api/sendText` and execute it with
|
||||
payload (change `12132132130` in the `chatId` to phone number that is
|
||||
registered in WhatsApp).
|
||||
|
||||
```json
|
||||
{
|
||||
"chatId": "12132132130@c.us",
|
||||
"text": "Hi there!",
|
||||
"session": "default"
|
||||
}
|
||||
```
|
||||
|
||||
If you see **Hi there!** message then you're ready to run bots!
|
||||
|
||||
## WhatsApp Echo Bot
|
||||
|
||||
The WhatsApp Echo Bot is a sample flask webhook server application that echoes
|
||||
back to you whatever you send it. It can serve as a basic reference for how to
|
||||
set up webhooks and reply to incoming messages.
|
||||
|
||||
```bash
|
||||
# Clone the git repository with example
|
||||
git clone https://github.com/devlikeapro/whatsapp-http-api.git
|
||||
# Open python example folder
|
||||
cd whatsapp-http-api/examples/python
|
||||
# Install requirements
|
||||
python -mpip install -r requirements.txt
|
||||
# Run the bot
|
||||
FLASK_APP=whatsapp_echo_bot.py flask run
|
||||
```
|
||||
|
||||
Open http://127.0.0.1:5000/bot - if you see **WhatsApp Echo Bot is ready!** then
|
||||
the bot is ready to receive message!
|
||||
|
||||
Send message to the WhatsApp (that you used to scan QR code) and it'll echo text
|
||||
back to you!
|
||||
|
||||
## WhatsApp Download Files Bot
|
||||
|
||||
The WhatsApp Download Image Bot downloads all files people send to your WhatsApp
|
||||
and log the path for the file.
|
||||
|
||||
**The bot works only with WAHA Plus version** available with donations. Visit
|
||||
[read more about difference between Core and Plus versions](https://waha.devlike.pro/docs/how-to/plus-version/).
|
||||
|
||||
Download **WAHA Plus** version:
|
||||
|
||||
```bash
|
||||
# Download the image
|
||||
docker pull devlikeapro/whatsapp-http-api-plus
|
||||
# Run the docker container
|
||||
docker run -it --rm --network=host -e WHATSAPP_HOOK_URL=http://localhost:5000/bot -e "WHATSAPP_HOOK_EVENTS=*" --name whatsapp-http-api devlikeapro/whatsapp-http-api-plus
|
||||
```
|
||||
|
||||
Run the WhatsApp Download Files bot:
|
||||
|
||||
```bash
|
||||
# Clone the git repository with example
|
||||
git clone https://github.com/devlikeapro/whatsapp-http-api.git
|
||||
# Open python example folder
|
||||
cd whatsapp-http-api/examples/python
|
||||
# Install requirements
|
||||
python -mpip install -r requirements.txt
|
||||
# Run the bot
|
||||
FLASK_APP=whatsapp_download_files_bot.py flask run
|
||||
```
|
||||
|
||||
Open http://127.0.0.1:5000/bot - if you see **WhatsApp Download Files Bot!**
|
||||
then the bot is ready to receive message with files!
|
||||
|
||||
@@ -26,6 +26,7 @@ The following environment variables can be used to configure the WAHA.
|
||||
|
||||
### Common
|
||||
- `DEBUG=1`: Set this variable to any value to enable debug and verbose logs.
|
||||
- You can also do it for a **specific session** by setting `config.debug` field to `true` when starting a session.
|
||||
- `WHATSAPP_API_PORT=3000`: The port number that the HTTP server will listen on. The default value is `3000`.
|
||||
- `WHATSAPP_API_HOSTNAME=localhost`: The hostname for the HTTP server. The default value is `localhost`.
|
||||
|
||||
|
||||
@@ -47,18 +47,14 @@ Not running Chromium saves you CPU and Memory, so you can run more instances on
|
||||
️Working with the engine requires more attention, because it's easy to be blocked with it!
|
||||
|
||||
⚠ Read the article before using **NOWEB** engine
|
||||
|
||||
Quotes from the users:
|
||||
> The server has **2 CPU and 8GB** of memory. Today we have **85 sessions** in this instance.
|
||||
|
||||
> **400** sessions with **4CPU and 32RAM**. It's working fine.
|
||||
|
||||
[How to avoid blocking ->]({{< relref " /docs/overview/how-to-avoid-blocking" >}}).
|
||||
|
||||
### MOBILE (experimental)
|
||||
{{< alert icon="👉" text="<b>Experimental engine!</b><br/>Please contact us on <a href='https://www.patreon.com/wa_http_api' target='_blank'>Patreon -></a> or <a href='https://boosty.to/wa-http-api' target='_blank'>Boosty -></a> if you're interested in using it.<br>Available for <a href='https://waha.devlike.pro/docs/how-to/plus-version/#tiers' target='_blank'>PRO</a> subscribers only" />}}
|
||||
|
||||
- `WHATSAPP_DEFAULT_ENGINE=MOBILE`
|
||||
- [https://github.com/WhiskeySockets/Baileys](https://github.com/WhiskeySockets/Baileys)
|
||||
|
||||
**MOBILE** engine **does not require a browser and a mobile device** to work with WhatsApp, it does so directly using a WebSocket.
|
||||
You don't have to use a mobile device to run this engine.
|
||||
|
||||
|
||||
### VENOM
|
||||
|
||||
- `WHATSAPP_DEFAULT_ENGINE=VENOM`
|
||||
@@ -69,17 +65,30 @@ It uses Puppeteer to run a real instance of Whatsapp Web to avoid getting blocke
|
||||
|
||||
## Docker images
|
||||
WAHA provides few docker images with different setup.
|
||||
{{< alert icon="👉" text="Use `devlikeapro/whatsapp-http-api` instead of `devlikeapro/whatsapp-http-api-plus` to get **WAHA Plus** version." />}}
|
||||
|
||||
For **x86** processors use following images:
|
||||
- `devlikeapro/whatsapp-http-api:latest` - latest version of WAHA, using **Chromium** (does not support video receiving and receiving in Plus version)
|
||||
- `devlikeapro/whatsapp-http-api:chrome` - latest version of WAHA, using **Chrome** (supports video receiving and receiving in Plus version)
|
||||
- `devlikeapro/whatsapp-http-api:noweb`- latest version of WAHA, **no browser installed** - use it only for **NOWEB** engine
|
||||
| Image | CPU | Browser |
|
||||
|---------------------------------------------------------|-----|-------------------------|
|
||||
| [WAHA Plus]({{< relref "/docs/how-to/plus-version" >}}) | | |
|
||||
| `devlikeapro/whatsapp-http-api-plus:latest` | x86 | Chromium |
|
||||
| `devlikeapro/whatsapp-http-api-plus:chrome` | x86 | Chrome (supports video) |
|
||||
| `devlikeapro/whatsapp-http-api-plus:noweb` | x86 | None |
|
||||
| `devlikeapro/whatsapp-http-api-plus:arm` | ARM | Chromium |
|
||||
| `devlikeapro/whatsapp-http-api-plus:noweb-arm` | ARM | None |
|
||||
| **WAHA Core** | | |
|
||||
| `devlikeapro/whatsapp-http-api:latest` | x86 | Chromium |
|
||||
| `devlikeapro/whatsapp-http-api:chrome` | x86 | Chrome |
|
||||
| `devlikeapro/whatsapp-http-api:noweb` | x86 | None |
|
||||
| `devlikeapro/whatsapp-http-api:arm` | ARM | Chromium |
|
||||
| `devlikeapro/whatsapp-http-api:noweb-arm` | ARM | None |
|
||||
|
||||
For **ARM** processors use following images:
|
||||
- `devlikeapro/whatsapp-http-api:arm` - **Chromium**
|
||||
- `devlikeapro/whatsapp-http-api:noweb-arm`- **no browser installed**
|
||||
Browsers:
|
||||
- **Chromium** - is the default browser for **WAHA**. It's a good choice for most cases.
|
||||
- **Chrome** - is a good choice if you need to receive videos in Plus version.
|
||||
- **None** - is a good choice if you want to use **NOWEB** engine.
|
||||
|
||||
CPU:
|
||||
- **x86** - is a good choice for most cases.
|
||||
- **ARM** - is a good choice if you're using ARM processors (like Apple Silicon, Apple M1, etc.)
|
||||
{{< alert icon="💡" text="Chrome version is not available in ARM" />}}
|
||||
|
||||
## Features
|
||||
@@ -96,7 +105,7 @@ Here, you will find a list of supported endpoints and webhooks per engine.
|
||||
If you don't specify `WHATSAPP_DEFAULT_ENGINE` environment variable - look at **WEBJS** engine,
|
||||
it's the engine WAHA runs by default.
|
||||
|
||||
### Engine
|
||||
### Protocols
|
||||
|
||||
| | WEBJS | NOWEB | VENOM |
|
||||
|--------------------------------------------------------------|:-----:|:-----:|:-----:|
|
||||
@@ -125,25 +134,28 @@ please [create an issue](https://github.com/devlikeapro/whatsapp-http-api/issues
|
||||
| **Screenshot** | | | |
|
||||
| `POST /api/screenshot` | ✔️ | ➖ | ✔️ |
|
||||
|
||||
| **Chatting** | WEBJS | NOWEB | VENOM |
|
||||
|------------------------------------------------------|:-----:|:-----:|:-----:|
|
||||
| `GET /api/checkNumberStatus` | ✔️ | ✔️ | ✔️ |
|
||||
| `GET /api/sendContactVcard` | ➖ | ➖ | ✔️ |
|
||||
| `GET /api/sendText` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendText` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendPoll` | ➖ | ✔️ | ➖ |
|
||||
| `POST /api/sendLocation` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendLinkPreview` | ➖ | ✔️ | ✔️ |
|
||||
| `POST /api/sendImage`  | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendFile`  | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendVoice`  | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendVideo`  | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/reply` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendSeen` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/startTyping` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/stopTyping` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/reaction` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/messages` | ✔️ | ➖ | ✔️ |
|
||||
| **Chatting** | WEBJS | NOWEB | VENOM |
|
||||
|-------------------------------------------------------------|:-----:|:-----:|:-----:|
|
||||
| `GET /api/checkNumberStatus` | ✔️ | ✔️ | ✔️ |
|
||||
| `GET /api/sendContactVcard` | ➖ | ✔️ | ➖ |
|
||||
| `GET /api/sendText` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendText` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/reply` | ✔️ | ✔️ | ✔️ |
|
||||
| `PUT /api/{session}/chats/{chatId}/messages/{messageId}` | ✔️ | ✔️ | ➖ |
|
||||
| `DELETE /api/{session}/chats/{chatId}/messages/{messageId}` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/sendPoll` | ➖ | ✔️ | ➖ |
|
||||
| `POST /api/sendLocation` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendLinkPreview` | ➖ | ✔️ | ✔️ |
|
||||
| `POST /api/sendImage`  | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendFile`  | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendVoice`  | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/sendVideo`  | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/sendSeen` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/startTyping` | ✔️ | ✔️ | ✔️ |
|
||||
| `POST /api/stopTyping` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/reaction` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/star` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/messages` | ✔️ | ➖ | ✔️ |
|
||||
|
||||
| | WEBJS | NOWEB | VENOM |
|
||||
|-------------------------------------------------------------------|:-----:|:-----:|:-----:|
|
||||
@@ -157,6 +169,8 @@ please [create an issue](https://github.com/devlikeapro/whatsapp-http-api/issues
|
||||
| `DELETE /api/{session}/chats/{chatId}` | ✔️ | ➖ | ➖ |
|
||||
| `GET /api/{session}/chats/{chatId}/messages` | ✔️ | ➖ | ✔️ |
|
||||
| `DELETE /api/{session}/chats/{chatId}/messages` | ✔️ | ➖ | ➖ |
|
||||
| `PUT /api/{session}/chats/{chatId}/messages/{messageId}` | ✔️ | ✔️ | ➖ |
|
||||
| `DELETE /api/{session}/chats/{chatId}/messages/{messageId}` | ✔️ | ✔️ | ➖ |
|
||||
| **Contacts** | | | |
|
||||
| `GET /api/contacts` | ✔️ | ➖ | ➖ |
|
||||
| `GET /api/contacts/all` | ✔️ | ➖ | ➖ |
|
||||
@@ -166,24 +180,26 @@ please [create an issue](https://github.com/devlikeapro/whatsapp-http-api/issues
|
||||
| `POST /api/contacts/block` | ✔️ | ➖ | ➖ |
|
||||
| `POST /api/contacts/unblock` | ✔️ | ➖ | ➖ |
|
||||
|
||||
| **Groups** | WEBJS | NOWEB | VENOM |
|
||||
|--------------------------------------------------------------------|:-----:|:-----:|:-----:|
|
||||
| `POST /api/{session}/groups` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/{session}/groups` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}` | ✔️ | ✔️ | ➖ |
|
||||
| `DELETE /api/{session}/groups/{id}` | ✔️ | ➖ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}/settings/security/info-admin-only` | ✔️ | ➖ | ➖ |
|
||||
| `PUT /api/{session}/groups/{id}/settings/security/info-admin-only` | ✔️ | ➖ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/leave` | ✔️ | ✔️ | ➖ |
|
||||
| `PUT /api/{session}/groups/{id}/description` | ✔️ | ✔️ | ➖ |
|
||||
| `PUT /api/{session}/groups/{id}/subject` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}/invite-code` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/invite-code/revoke` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}/participants` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/participants/add` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/participants/remove` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/admin/promote` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/admin/demote` | ✔️ | ✔️ | ➖ |
|
||||
| **Groups** | WEBJS | NOWEB | VENOM |
|
||||
|------------------------------------------------------------------------|:-----:|:-----:|:-----:|
|
||||
| `POST /api/{session}/groups` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/{session}/groups` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}` | ✔️ | ✔️ | ➖ |
|
||||
| `DELETE /api/{session}/groups/{id}` | ✔️ | ➖ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}/settings/security/info-admin-only` | ✔️ | ➖ | ➖ |
|
||||
| `PUT /api/{session}/groups/{id}/settings/security/info-admin-only` | ✔️ | ➖ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}/settings/security/messages-admin-only` | ✔️ | ➖ | ➖ |
|
||||
| `PUT /api/{session}/groups/{id}/settings/security/messages-admin-only` | ✔️ | ➖ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/leave` | ✔️ | ✔️ | ➖ |
|
||||
| `PUT /api/{session}/groups/{id}/description` | ✔️ | ✔️ | ➖ |
|
||||
| `PUT /api/{session}/groups/{id}/subject` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}/invite-code` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/invite-code/revoke` | ✔️ | ✔️ | ➖ |
|
||||
| `GET /api/{session}/groups/{id}/participants` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/participants/add` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/participants/remove` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/admin/promote` | ✔️ | ✔️ | ➖ |
|
||||
| `POST /api/{session}/groups/{id}/admin/demote` | ✔️ | ✔️ | ➖ |
|
||||
|
||||
| | WEBJS | NOWEB | VENOM |
|
||||
|---------------------------------------------------|:-----:|:-----:|:-----:|
|
||||
@@ -196,10 +212,13 @@ please [create an issue](https://github.com/devlikeapro/whatsapp-http-api/issues
|
||||
| `GET /api/version` | ➖ | ✔️ | ➖ |
|
||||
| `GET /health`  | ✔️ | ✔️ | ✔️ |
|
||||
|
||||
### Webhooks
|
||||
|
||||
| **Webhooks** | WEBJS | NOWEB | VENOM |
|
||||
|-----------------------------------------------------|:-----:|:-----:|:-----:|
|
||||
| `message` | ✔️ | ✔️ | ✔️ |
|
||||
| `message` with files  | ✔️ | ✔️ | ✔️ |
|
||||
| `message.reaction` | ✔️ | ✔️ | ➖ |
|
||||
| `message.any` | ✔️ | ✔️ | ✔️ |
|
||||
| `message.ack` | ✔️ | ✔️ | ✔️ |
|
||||
| `message.revoked` | ✔️ | ➖ | ➖ |
|
||||
|
||||
@@ -87,22 +87,47 @@ Request:
|
||||
}
|
||||
```
|
||||
|
||||
### Settings
|
||||
#### Security for group info
|
||||
### Security - update group info
|
||||
Updates the group settings to only allow admins to edit group info (title, description, photo).
|
||||
`PUT /api/{session}/groups/{groupId}/settings/security/info-admin-only`
|
||||
```json
|
||||
{
|
||||
"adminsOnly": true
|
||||
}
|
||||
```
|
||||
|
||||
Get the group settings to only allow admins to edit group info (title, description, photo).
|
||||
|
||||
`GET /api/{session}/groups/{groupId}/settings/security/info-admin-only`
|
||||
```json
|
||||
{
|
||||
"adminsOnly": true
|
||||
}
|
||||
```
|
||||
`PUT /api/{session}/groups/{groupId}/settings/security/info-admin-only`
|
||||
|
||||
The request doesn't require any request's body and
|
||||
**can't be used to disable the security setting (allow ANY to edit group info)**.
|
||||
If you wish to have that ability - please [create an issue](https://github.com/devlikeapro/whatsapp-http-api/issues)
|
||||
Returns `true` if the setting was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
|
||||
|
||||
### Security - who can send messages
|
||||
Updates the group settings to only allow admins to send messages.
|
||||
|
||||
`PUT /api/{session}/groups/{groupId}/settings/security/messages-admin-only`
|
||||
```json
|
||||
{
|
||||
"adminsOnly": true
|
||||
}
|
||||
```
|
||||
Returns `true` if the setting was properly updated. This can return false if the user does not have the necessary permissions.
|
||||
|
||||
Get the group settings to only allow admins to send messages.
|
||||
|
||||
`GET /api/{session}/groups/{groupId}/settings/security/messages-admin-only`
|
||||
```json
|
||||
{
|
||||
"adminsOnly": true
|
||||
}
|
||||
```
|
||||
|
||||
### Participants
|
||||
|
||||
#### Get participants
|
||||
|
||||
@@ -67,7 +67,6 @@ The more you support the project - the more you get!
|
||||
| Special badge ([](https://waha.devlike.pro/docs/how-to/plus-version/#tiers)) and labels (`patron:TIER`) on [project's issues, PRs and Discussion](https://github.com/devlikeapro/whatsapp-http-api) to highlight your support to the project! | | ✔️ | ✔️ | ✔️ |
|
||||
| An invitation to **a private Github repository** so you have the **WAHA Plus** source code. | ➖️ | ➖️ | ✔️ | ✔️️ |
|
||||
| Access to a Telegram group where we provide support and assistance. | ➖️ | ➖️ | ➖ | ✔️ |
|
||||
| Access to an [experimental MOBILE engine]({{< relref "/docs/how-to/plus-version#tiers" >}})!. | ➖️ | ➖️ | ➖ | ✔️ |
|
||||
| **Donation** | **FREE** | **$19** | **$39** | **$99** |
|
||||
|
||||
For **$19** donation you get:
|
||||
@@ -92,27 +91,15 @@ What is the difference between **WAHA Plus** and **other SaaS solutions** for Wh
|
||||
| **Message price** | ✔️ All messages are Free! | ➖ Some solutions have a price for messages - $1/100 messages. |
|
||||
| **Expenses** | ✔️ $19 **donation**! | ➖ Monthly payment starts from $50 |
|
||||
|
||||
{{< alert icon="💡" text="If you stay subscribed - the donation amount will never change for you and always be $19 to get monthly updates!" />}}
|
||||
|
||||
## Get Plus 
|
||||
|
||||
|
||||
### Patreon
|
||||
<p align="center">
|
||||
<img src="patreon.png" alt="Patreon" />
|
||||
</p>
|
||||
|
||||
Support the project and get WAHA Plus version on
|
||||
<a href="https://patreon.com/wa_http_api" target="_blank">
|
||||
<b>
|
||||
Patreon ->
|
||||
</b>
|
||||
</a>
|
||||
|
||||
Go ahead and get your own WhatsApp HTTP API!
|
||||
{{< alert icon="💡" text="If you stay subscribed - the donation amount will never change for you and always be $19 to get monthly updates!" />}}
|
||||
|
||||
### Boosty
|
||||
<p align="center">
|
||||
<img src="boosty.svg" alt="Patreon" />
|
||||
<img src="boosty.svg" alt="Patreon" style='width: 40%'/>
|
||||
<br/>
|
||||
<br/>
|
||||
</p>
|
||||
@@ -126,6 +113,42 @@ Boosty ->
|
||||
|
||||
Go ahead and get your own WhatsApp HTTP API!
|
||||
|
||||
|
||||
### Patreon
|
||||
|
||||
<p align="center">
|
||||
<img src="patreon.png" alt="Patreon" style='width: 40%'/>
|
||||
</p>
|
||||
|
||||
{{< alert icon="🙏" text="Please consider using Boosty instead of Patreon due to its lower fees 🙏" />}}
|
||||
|
||||
Support the project and get WAHA Plus version on
|
||||
<a href="https://patreon.com/wa_http_api" target="_blank">
|
||||
<b>
|
||||
Patreon ->
|
||||
</b>
|
||||
</a>
|
||||
|
||||
Go ahead and get your own WhatsApp HTTP API!
|
||||
|
||||
|
||||
|
||||
### Patron Portal
|
||||
<p align="center">
|
||||
<img src="patron-portal.png" alt="Patron Portal" />
|
||||
<br/>
|
||||
<br/>
|
||||
</p>
|
||||
|
||||
After subscribing on Patreon or Boosty, you will get access to the [WAHA Patron Portal ->](https://portal.devlike.pro/)
|
||||
where you will get the password to download the Plus image and manage your perks!
|
||||
|
||||
Read more about Patron Portal in
|
||||
**<a href="https://www.patreon.com/posts/waha-patron-97637416" target="_blank">Patreon -> </a>**
|
||||
or
|
||||
**<a href="https://boosty.to/wa-http-api/posts/1011" target="_blank">Boosty -></a>**
|
||||
posts.
|
||||
|
||||
## Install Plus
|
||||
After you get the password, get your login to Docker Hub in [Patron Portal ->](https://portal.devlike.pro/)
|
||||
and run the commands:
|
||||
|
||||
|
After Width: | Height: | Size: 21 KiB |
@@ -57,6 +57,7 @@ To send text message - use `POST /api/sendText` with example payload.
|
||||
"text": "Hi there!"
|
||||
}
|
||||
```
|
||||
|
||||
#### Mention contact
|
||||
If you send a message in a group and want to mention a participant in the message -
|
||||
use `mentions` field for that in `POST /api/sendText` request.
|
||||
@@ -75,11 +76,6 @@ also mention it in `mentions` in format `2132132130@c.us`
|
||||
}
|
||||
```
|
||||
|
||||
### Send poll
|
||||
We have a dedicated page [how to send polls and receive votes]({{< relref "/docs/how-to/polls" >}})!
|
||||
|
||||

|
||||
|
||||
### Reply on message
|
||||
To reply on a message - use `POST /api/reply` with example payload.
|
||||
```json
|
||||
@@ -94,6 +90,46 @@ To reply on a message - use `POST /api/reply` with example payload.
|
||||
#### Reply files 
|
||||
WAHA does not support reply with files (images, voice, etc.). If you're interested in it - please create an issue in GitHub.
|
||||
|
||||
|
||||
### Edit message
|
||||
You can edit **text** messages or **"caption"** in media messages.
|
||||
|
||||
```
|
||||
PUT /api/{session}/chats/{chatId}/messages/{messageId}
|
||||
```
|
||||
👉 Remember to escape `@` in `chatId` and `messageId` with `%40`.
|
||||
|
||||
So if you want to edit `true_123@c.us_AAA` message in `123@c.us` chat you need to send request to:
|
||||
```
|
||||
PUT /api/{session}/chats/123%40c.us/messages/true_123%40c.us_AAA
|
||||
```
|
||||
|
||||
**Payload:**
|
||||
```json
|
||||
{
|
||||
"text": "Hello, world!"
|
||||
}
|
||||
```
|
||||
|
||||
### Delete message
|
||||
You can delete messages from the chat.
|
||||
|
||||
```
|
||||
DELETE /api/{session}/chats/{chatId}/messages/{messageId}
|
||||
```
|
||||
|
||||
👉 Remember to escape `@` in `chatId` and `messageId` with `%40`.
|
||||
|
||||
So if you want to delete `true_123@c.us_AAA` message in `123@c.us` chat you need to send request to:
|
||||
```
|
||||
DELETE /api/{session}/chats/123%40c.us/messages/true_123%40c.us_AAA
|
||||
```
|
||||
|
||||
### Send poll
|
||||
We have a dedicated page [how to send polls and receive votes]({{< relref "/docs/how-to/polls" >}})!
|
||||
|
||||

|
||||
|
||||
### Add a reaction
|
||||
Use `PUT /api/reaction` method to set reaction to a message.
|
||||
|
||||
@@ -116,6 +152,85 @@ To remove reaction from a message - send empty string in the reaction request.
|
||||
}
|
||||
```
|
||||
|
||||
### Star and unstar message
|
||||
Use `PUT /api/star` method to star or unstar a message.
|
||||
|
||||
{{< alert icon="👉" text="Star API uses PUT, not POST request! Please make sure you send right request." />}}
|
||||
|
||||
**Star:**
|
||||
```json
|
||||
{
|
||||
"messageId": "false_71111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"chatId": "71111111111@c.us",
|
||||
"star": true,
|
||||
"session": "default"
|
||||
}
|
||||
```
|
||||
|
||||
**Unstar:**
|
||||
```json
|
||||
{
|
||||
"messageId": "false_71111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
|
||||
"chatId": "71111111111@c.us",
|
||||
"star": false,
|
||||
"session": "default"
|
||||
}
|
||||
```
|
||||
|
||||
### Send contact (vcard)
|
||||
Use `POST /api/sendContactVcard` to send contact (vcard).
|
||||
|
||||
You can use fields this way:
|
||||
```json
|
||||
{
|
||||
"session": "default",
|
||||
"chatId": "79111111@c.us",
|
||||
"contacts": [
|
||||
{
|
||||
"fullName": "John Doe",
|
||||
"organization": "Company Name",
|
||||
"phoneNumber": "+91 11111 11111",
|
||||
"whatsappId": "911111111111"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Or provide a vCard file content:
|
||||
```json
|
||||
{
|
||||
"session": "default",
|
||||
"chatId": "79111111@c.us",
|
||||
"contacts": [
|
||||
{
|
||||
"vcard": "BEGIN:VCARD\nVERSION:3.0\nFN:Jane Doe\nORG:Company Name;\nTEL;type=CELL;type=VOICE;waid=911111111111:+91 11111 11111\nEND:VCARD"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Or even combine it:
|
||||
```json
|
||||
{
|
||||
"chatId": "79111111@c.us",
|
||||
"contacts": [
|
||||
{
|
||||
"vcard": "BEGIN:VCARD\nVERSION:3.0\nFN:Jane Doe\nORG:Company Name;\nTEL;type=CELL;type=VOICE;waid=911111111111:+91 11111 11111\nEND:VCARD"
|
||||
},
|
||||
{
|
||||
"fullName": "John Doe",
|
||||
"organization": "Company Name",
|
||||
"phoneNumber": "+91 11111 11111",
|
||||
"whatsappId": "911111111111"
|
||||
}
|
||||
],
|
||||
"session": "default"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
### Send image 
|
||||
Use `POST /api/sendImage` to send images.
|
||||
|
||||
|
||||
@@ -84,6 +84,20 @@ Read more about it in [Autostart section](#autostart).
|
||||
You can configure proxy when for all sessions by set up environment variables.
|
||||
Read more about it on [**Configuration page** ->]({{< relref "/docs/how-to/config#proxy" >}}).
|
||||
|
||||
#### Enable debug
|
||||
You can enable debug mode for a session by setting `config.debug` field to `true`.
|
||||
It'll show you more logs in the console.
|
||||
Can be useful for debugging purposes when you're experiencing some issues.
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "default",
|
||||
"config": {
|
||||
"debug": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### List
|
||||
|
||||
To get session list - call `GET /api/sessions`.
|
||||
|
||||
@@ -226,6 +226,43 @@ Fired on all message creations, including your own. The payload is the same as f
|
||||
}
|
||||
```
|
||||
|
||||
### message.reaction
|
||||
Receive events when a message is reacted to by a user (or **yourself** reacting to a message).
|
||||
- `payload.reaction.text` - emoji that was used to react to the message. It'll be an empty string if the reaction was removed.
|
||||
- `payload.reaction.messageId` - id of the message that was reacted to.
|
||||
|
||||
```json
|
||||
{
|
||||
"event": "message.reaction",
|
||||
"session": "default",
|
||||
"me": {
|
||||
"id": "79222222222@c.us",
|
||||
"pushName": "WAHA"
|
||||
},
|
||||
"payload": {
|
||||
"id": "false_79111111@c.us_11111111111111111111111111111111",
|
||||
"from": "79111111@c.us",
|
||||
"fromMe": false,
|
||||
"participant": "79111111@c.us",
|
||||
"to": "79111111@c.us",
|
||||
"timestamp": 1710481111.853,
|
||||
"reaction": {
|
||||
"text": "🙏",
|
||||
"messageId": "true_79111111@c.us_11111111111111111111111111111111"
|
||||
}
|
||||
},
|
||||
"engine": "WEBJS",
|
||||
"environment": {
|
||||
"version": "2024.3.3",
|
||||
"engine": "WEBJS",
|
||||
"tier": "PLUS",
|
||||
"browser": "/usr/bin/google-chrome-stable"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
{{< alert icon="👉" text="NOWEB engine note - reactions were sent in 'message' and 'message.any' events, not it's available only in 'message.reaction'!" />}}
|
||||
|
||||
### message.ack
|
||||
Receive events when server or recipient gets the message, read or played it.
|
||||
|
||||
|
||||
@@ -19,6 +19,69 @@ If you wish to get and read Release Notes - read them on one of our platforms, *
|
||||
|
||||
You even can **subscribe to get new updates** there!
|
||||
|
||||
## 2024.3
|
||||
### 🎉 New
|
||||
----
|
||||
|
||||
Add `config.debug` field to `POST /api/session/start` to enable debug and verbose logs for the session.
|
||||
|
||||
----
|
||||
|
||||
Add `PUT /api/{session}/chats/{chatId}/messages/{messageId}` endpoint to **edit** the message.
|
||||
- Read more about [Edit message]({{< relref "/docs/how-to/send-messages#edit-message" >}})
|
||||
- Issue: [#241](https://github.com/devlikeapro/whatsapp-http-api/issues/241)
|
||||
|
||||
----
|
||||
|
||||
Add `DELETE /api/{session}/chats/{chatId}/messages/{messageId}` endpoint to **delete** the message.
|
||||
- Read more about [Delete message]({{< relref "/docs/how-to/send-messages#delete-message" >}})
|
||||
- Issue: [#209](https://github.com/devlikeapro/whatsapp-http-api/issues/209)
|
||||
|
||||
----
|
||||
|
||||
Add `POST /api/sendContactVcard` support for **NOWEB** engine.
|
||||
- Read more about [Send Contact vCard]({{< relref "/docs/how-to/send-messages#send-contact-vcard" >}})
|
||||
- Issue: [#276](https://github.com/devlikeapro/whatsapp-http-api/issues/256)
|
||||
|
||||
----
|
||||
|
||||
Handles `caption` and `filename` right in `POST /api/sendFile`
|
||||
- Issue: [#94](https://github.com/devlikeapro/whatsapp-http-api/issues/94)
|
||||
- Issue: [#133](https://github.com/devlikeapro/whatsapp-http-api/issues/133)
|
||||
|
||||
----
|
||||
|
||||
Add `message.reaction` webhook in **WEBJS** and **NOWEB** engines
|
||||
- Read more about [message.reaction]({{< relref "/docs/how-to/webhooks#messagereaction" >}}) event
|
||||
- Issue: [#275](https://github.com/devlikeapro/whatsapp-http-api/issues/275)
|
||||
|
||||
👉 **NOWEB** engine note - reactions were sent in `'message'` and `'message.any'` events, not it's available **only** in `'message.reaction'`!
|
||||
|
||||
----
|
||||
|
||||
Add security settings for who can send messages `PUT /api/{session}/groups/{groupId}/settings/security/messages-admin-only`
|
||||
- Read [Security - who can send messages]({{< relref "/docs/how-to/groups##security---who-can-send-messages" >}})
|
||||
- Issue: [#274](https://github.com/devlikeapro/whatsapp-http-api/issues/274)
|
||||
|
||||
----
|
||||
|
||||
Add star and unstar message endpoint `PUT /api/star`
|
||||
- Read [Star and unstar message]({{< relref "/docs/how-to/send-messages#star-and-unstar-message" >}}) documentation
|
||||
- Issue: [#273](https://github.com/devlikeapro/whatsapp-http-api/issues/240)
|
||||
|
||||
----
|
||||
|
||||
### 👉 Breaking changes
|
||||
- **NOWEB** - reactions were sent in `'message'` and `'message.any'` events, not it's available **only** in `'message.reaction'`!
|
||||
- Add **required body** in `PUT /api/{session}/groups/{groupId}/settings/security/info-admin-only` endpoint.
|
||||
```json
|
||||
{
|
||||
"adminsOnly": false
|
||||
}
|
||||
```
|
||||
|
||||
- `POST /api/sendContactVcard` doesn't work in **VENOM** anymore (use **NOWEB** engine).
|
||||
|
||||
## 2024.2
|
||||
- Add support for [MongoDB as storage for Session data]({{< relref "/docs/how-to/storages" >}})
|
||||
- Support persistent file storage for media files - [now you can save media files between container restarts]({{< relref "/docs/how-to/storages#media" >}})
|
||||
|
||||
@@ -30,7 +30,9 @@ communicate with it to prevent blocking from WhatsApp. It's the reason why it's
|
||||
### NOWEB
|
||||
If you're looking for less resource demanded engine - [have a look at **NOWEB** engine ->]({{< relref "/docs/how-to/engines" >}})
|
||||
|
||||
The quote from the user:
|
||||
> The server has 2 CPU and 8GB of memory.
|
||||
> Today we have 85 session in this instance.
|
||||
Quotes from the users:
|
||||
> The server has **2 CPU and 8GB** of memory. Today we have **85 sessions** in this instance.
|
||||
|
||||
> **400** sessions with **4CPU and 32RAM**. It's working fine.
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ images: []
|
||||
menu:
|
||||
docs:
|
||||
parent: "overview"
|
||||
weight: 110
|
||||
weight: 101
|
||||
toc: true
|
||||
---
|
||||
|
||||
@@ -36,18 +36,21 @@ Also, Docker makes installation and update processes so simple, just one command
|
||||
|
||||
We will guide you through the necessary steps to successfully send your first text message using WhatsApp HTTP API.
|
||||
|
||||
**If you find it easier to follow a video** tutorial, we've got you covered!
|
||||
A 3-minute video tutorial is available to help you navigate WhatsApp HTTP API smoothly.
|
||||
<div class='article-card'>
|
||||
<b class='h4'>Are you a visual learner?</b>
|
||||
|
||||
<div class="d-flex justify-content-center my-4">
|
||||
<iframe
|
||||
width="560" height="315"
|
||||
src="https://www.youtube.com/embed/RFerMyAUPRg"
|
||||
title="YouTube video player"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
We've got you covered! Watch the video below to see how to send your first message using <b>WAHA</b>.
|
||||
|
||||
<div class="d-flex justify-content-center my-4">
|
||||
<iframe
|
||||
width="560" height="315"
|
||||
src="https://www.youtube.com/embed/RFerMyAUPRg"
|
||||
title="YouTube video player"
|
||||
frameborder="0"
|
||||
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
allowfullscreen
|
||||
></iframe>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
### 1. Download image
|
||||
@@ -107,6 +110,9 @@ Open the link in your browser [http://localhost:3000/](http://localhost:3000/) a
|
||||
(Swagger).
|
||||
|
||||
{{< alert icon="👉" text="We don't recommend expose the API in the internet without authentication!" />}}
|
||||
[Read more about Security ->]({{< relref "/docs/how-to/security" >}})
|
||||
|
||||
<br/>
|
||||
|
||||

|
||||
|
||||
|
||||
@@ -9,11 +9,9 @@
|
||||
<img src='/images/logo.png' title='WhatsApp HTTP API' alt='logo' width='100' />
|
||||
</div>
|
||||
<p class='lead'>{{ .Params.lead | safeHTML }}</p>
|
||||
<code>
|
||||
docker run -it -p 3000:3000/tcp devlikeapro/whatsapp-http-api
|
||||
</code>
|
||||
<br />
|
||||
<br />
|
||||
<div class='code-block highlight'>
|
||||
<pre tabindex='0' class='chroma'><code class='language-bash' data-lang='bash' style='padding: 0'>docker run -it -p 3000:3000/tcp devlikeapro/whatsapp-http-api</code></pre>
|
||||
</div>
|
||||
<a class='btn btn-primary btn-lg px-4 mb-2'
|
||||
href='/docs/{{ if .Site.Params.options.docsVersioning }}{{ .Site.Params.docsVersion }}/{{ end }}overview/introduction/'
|
||||
role='button'>Get Started</a>
|
||||
@@ -25,48 +23,30 @@
|
||||
|
||||
{{ define "sidebar-prefooter" }}
|
||||
<section class='section section-sm'>
|
||||
<div class='container'>
|
||||
<div class='container hr'>
|
||||
<div class='row justify-content-center text-center'>
|
||||
<div class='col-lg-5'>
|
||||
<img src='/images/icons/free.png' alt='Free' style='width: 5rem'>
|
||||
<h2 class='h4'>It's free!</h2>
|
||||
<div class='col-12'>
|
||||
<h2>
|
||||
Why WAHA?
|
||||
</h2>
|
||||
</div>
|
||||
<div class='col-12 col-lg-4 pros-card'>
|
||||
<img src='/images/icons/free-green.png' alt='Free' style='width: 5rem'>
|
||||
<h2 class='h4 color-accent'>It's free!</h2>
|
||||
<p>
|
||||
<a href='https://waha.devlike.pro/docs/how-to/plus-version/#tiers' target='_blank'>
|
||||
<b>WAHA Core</b>
|
||||
</a>
|
||||
version is always free!
|
||||
version is always free, <b>no limits in messages</b> or time!
|
||||
<br>
|
||||
Even
|
||||
<a href='https://waha.devlike.pro/docs/how-to/plus-version/#tiers' target='_blank'>
|
||||
<b>WAHA Plus</b>
|
||||
</a>
|
||||
version have no licence expiration!
|
||||
</p>
|
||||
</div>
|
||||
<div class='col-lg-5'>
|
||||
<img src='/images/icons/api.png' alt='API' style='width: 5rem'>
|
||||
<h2 class='h4'>Language agnostic</h2>
|
||||
<p>
|
||||
Use your own favorite language - Python, JavaScript, PHP, C#, Clojure, or PowerShell.
|
||||
<br />
|
||||
<small class='text-muted'>
|
||||
PowerShell, really? Are you insane?! Choose another language, dude.
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
<div class='col-lg-5'>
|
||||
<img src='/images/icons/document.png' alt='Document' style='width: 5rem'>
|
||||
<h2 class='h4'>Well documented</h2>
|
||||
<p>
|
||||
<a href='https://waha.devlike.pro/docs/overview/introduction/' target='_blank'>
|
||||
Documentation
|
||||
</a>
|
||||
has a lof examples and how-to guides.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row justify-content-center text-center'>
|
||||
<div class='col-lg-5'>
|
||||
<img src='/images/icons/servers.png' alt='Servers' style='width: 5rem'>
|
||||
<div class='col-12 col-lg-4 pros-card'>
|
||||
<img src='/images/icons/servers-green.png' alt='Servers' style='width: 5rem'>
|
||||
<h2 class='h4'>Self-hosted solution</h2>
|
||||
<p>
|
||||
<a href='https://waha.devlike.pro/docs/how-to/plus-version/#why-waha' target='_blank'>
|
||||
@@ -75,8 +55,30 @@
|
||||
Install it on your own server!
|
||||
</p>
|
||||
</div>
|
||||
<div class='col-lg-5'>
|
||||
<img src='/images/icons/easy.png' alt='Easy' style='width: 5rem'>
|
||||
<div class='col-12 col-lg-4 pros-card'>
|
||||
<img src='/images/icons/api-green.png' alt='API' style='width: 5rem'>
|
||||
<h2 class='h4'>HTTP API</h2>
|
||||
<p>
|
||||
Use your own favorite language - Python, JavaScript, PHP, C#, Clojure, or PowerShell.
|
||||
<br />
|
||||
<small class='text-muted'>
|
||||
PowerShell, really? Are you insane?! Choose another language, dude.
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row justify-content-center text-center'>
|
||||
<div class='col-12 col-lg-4 pros-card'>
|
||||
<img src='/images/icons/document-green.png' alt='Document' style='width: 5rem'>
|
||||
<h2 class='h4'>Well documented</h2>
|
||||
<p>
|
||||
<a href='https://waha.devlike.pro/docs/overview/introduction/' target='_blank'>
|
||||
Documentation
|
||||
</a>
|
||||
has a lof examples and how-to guides.</p>
|
||||
</div>
|
||||
<div class='col-12 col-lg-4 pros-card'>
|
||||
<img src='/images/icons/easy-green.png' alt='Easy' style='width: 5rem'>
|
||||
<h2 class='h4'>Quick installation</h2>
|
||||
<p>
|
||||
You need to install Docker and
|
||||
@@ -89,8 +91,8 @@
|
||||
</small>
|
||||
</p>
|
||||
</div>
|
||||
<div class='col-lg-5'>
|
||||
<img src='/images/icons/checked.png' alt='Checked' style='width: 5rem'>
|
||||
<div class='col-12 col-lg-4 pros-card'>
|
||||
<img src='/images/icons/checked-green.png' alt='Checked' style='width: 5rem'>
|
||||
<h2 class='h4'>No blocking</h2>
|
||||
<p>
|
||||
<a href='https://waha.devlike.pro/docs/how-to/engines/' target='_blank'>
|
||||
|
||||
@@ -1,17 +1,63 @@
|
||||
<!-- Yandex.Metrika counter -->
|
||||
<script type="text/javascript" >
|
||||
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
||||
m[i].l=1*new Date();
|
||||
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
||||
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
|
||||
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
|
||||
<script type='text/javascript'>
|
||||
(function(m, e, t, r, i, k, a) {
|
||||
m[i] = m[i] || function() {
|
||||
(m[i].a = m[i].a || []).push(arguments);
|
||||
};
|
||||
m[i].l = 1 * new Date();
|
||||
for (var j = 0; j < document.scripts.length; j++) {
|
||||
if (document.scripts[j].src === r) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
k = e.createElement(t), a = e.getElementsByTagName(t)[0], k.async = 1, k.src = r, a.parentNode.insertBefore(k, a);
|
||||
})
|
||||
(window, document, 'script', 'https://mc.yandex.ru/metrika/tag.js', 'ym');
|
||||
|
||||
ym(91185978, "init", {
|
||||
clickmap:true,
|
||||
trackLinks:true,
|
||||
accurateTrackBounce:true,
|
||||
webvisor:true
|
||||
});
|
||||
ym(91185978, 'init', {
|
||||
clickmap: true,
|
||||
trackLinks: true,
|
||||
accurateTrackBounce: true,
|
||||
webvisor: true,
|
||||
});
|
||||
</script>
|
||||
<noscript><div><img src="https://mc.yandex.ru/watch/91185978" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
||||
<noscript>
|
||||
<div><img src='https://mc.yandex.ru/watch/91185978' style='position:absolute; left:-9999px;' alt='' /></div>
|
||||
</noscript>
|
||||
<!-- /Yandex.Metrika counter -->
|
||||
|
||||
<!-- Google tag (gtag.js) -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-2XLLXRJ1KF"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'G-2XLLXRJ1KF');
|
||||
</script>
|
||||
<!-- /Google tag (gtag.js) -->
|
||||
|
||||
<!-- Main page cards -->
|
||||
<style>
|
||||
.pros-card {
|
||||
border: 1px solid #e9ecef;
|
||||
border-radius: 0.5rem;
|
||||
padding: 1.5rem;
|
||||
margin: 1rem;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 1rem 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.article-card {
|
||||
border: 1px solid #e9ecef;
|
||||
border-radius: 0.5rem;
|
||||
padding: 1.5rem;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 0 1rem 0 #4aae2050;
|
||||
}
|
||||
|
||||
.hr {
|
||||
border-top: 1px solid #e9ecef;
|
||||
}
|
||||
</style>
|
||||
<!-- /Main page cards -->
|
||||
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 61 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 77 KiB |
|
After Width: | Height: | Size: 90 KiB |
@@ -1 +1 @@
|
||||
{"openapi":"3.1.0","paths":{"/api/{session}/auth/qr":{"get":{"operationId":"AuthController_getQR","summary":"Get QR code for pairing WhatsApp Web.","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"},{"name":"format","required":true,"in":"query","schema":{"default":"image","enum":["image","raw"],"type":"string"}}],"responses":{"200":{"content":{"image/png":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Base64File"},{"$ref":"#/components/schemas/QRCodeValue"}]}}},"description":""}},"tags":["auth"],"security":[{"api_key":[]}]}},"/api/{session}/auth/request-code":{"post":{"operationId":"AuthController_requestCode","summary":"Request authentication code.","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestCodeRequest"}}}},"responses":{"201":{"description":""}},"tags":["auth"],"security":[{"api_key":[]}]}},"/api/{session}/auth/authorize-code":{"post":{"operationId":"AuthController_authorizeCode","summary":"Send OTP authentication code.","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OTPRequest"}}}},"responses":{"201":{"description":""}},"tags":["auth"],"security":[{"api_key":[]}]}},"/api/sessions/start":{"post":{"operationId":"SessionsController_start","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStartRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionDTO"}}}}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions/stop":{"post":{"operationId":"SessionsController_stop","summary":"Stop session","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStopRequest"}}}},"responses":{"201":{"description":""}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions/logout":{"post":{"operationId":"SessionsController_clean","summary":"Logout from session.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionLogoutRequest"}}}},"responses":{"201":{"description":""}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions":{"get":{"operationId":"SessionsController_list","parameters":[{"name":"all","required":false,"in":"query","example":false,"description":"Return all sessions, including those that are in the STOPPED state.","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SessionInfo"}}}}}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions/{session}/me":{"get":{"operationId":"SessionController_getMe","summary":"Get information about the authenticated account","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeInfo"}}}}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/checkNumberStatus":{"get":{"operationId":"ChattingController_checkNumberStatus","summary":"Check number status","parameters":[{"name":"phone","required":true,"in":"query","schema":{"type":"string"}},{"name":"session","required":true,"in":"query","schema":{"default":"default","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WANumberExistResult"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendContactVcard":{"post":{"operationId":"ChattingController_sendContactVcard","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageContactVcardRequest"}}}},"responses":{"201":{"description":""}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendText":{"get":{"operationId":"ChattingController_sendTextGet","summary":"Send a text message","parameters":[{"name":"phone","required":true,"in":"query","schema":{"type":"string"}},{"name":"text","required":true,"in":"query","schema":{"type":"string"}},{"name":"session","required":true,"in":"query","schema":{"default":"default","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]},"post":{"operationId":"ChattingController_sendText","summary":"Send a text message","parameters":[],"requestBody":{"required":true,Line truncated
|
||||
{"openapi":"3.1.0","paths":{"/api/{session}/auth/qr":{"get":{"operationId":"AuthController_getQR","summary":"Get QR code for pairing WhatsApp Web.","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"},{"name":"format","required":true,"in":"query","schema":{"default":"image","enum":["image","raw"],"type":"string"}}],"responses":{"200":{"content":{"image/png":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Base64File"},{"$ref":"#/components/schemas/QRCodeValue"}]}}},"description":""}},"tags":["auth"],"security":[{"api_key":[]}]}},"/api/{session}/auth/request-code":{"post":{"operationId":"AuthController_requestCode","summary":"Request authentication code.","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestCodeRequest"}}}},"responses":{"201":{"description":""}},"tags":["auth"],"security":[{"api_key":[]}]}},"/api/{session}/auth/authorize-code":{"post":{"operationId":"AuthController_authorizeCode","summary":"Send OTP authentication code.","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OTPRequest"}}}},"responses":{"201":{"description":""}},"tags":["auth"],"security":[{"api_key":[]}]}},"/api/{session}/auth/captcha":{"get":{"operationId":"AuthController_getCaptcha","summary":"Get captcha image.","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"}],"responses":{"200":{"content":{"image/png":{"schema":{"type":"string","format":"binary"}},"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Base64File"}]}}},"description":""}},"tags":["auth"],"security":[{"api_key":[]}]},"post":{"operationId":"AuthController_saveCaptcha","summary":"Enter captcha code.","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptchaBody"}}}},"responses":{"201":{"description":""}},"tags":["auth"],"security":[{"api_key":[]}]}},"/api/sessions/start":{"post":{"operationId":"SessionsController_start","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStartRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionDTO"}}}}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions/stop":{"post":{"operationId":"SessionsController_stop","summary":"Stop session","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStopRequest"}}}},"responses":{"201":{"description":""}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions/logout":{"post":{"operationId":"SessionsController_clean","summary":"Logout from session.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionLogoutRequest"}}}},"responses":{"201":{"description":""}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions":{"get":{"operationId":"SessionsController_list","parameters":[{"name":"all","required":false,"in":"query","example":false,"description":"Return all sessions, including those that are in the STOPPED state.","schema":{"type":"boolean"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SessionInfo"}}}}}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions/{session}/me":{"get":{"operationId":"SessionController_getMe","summary":"Get information about the authenticated account","parameters":[{"name":"session","required":true,"in":"path","schema":{"default":"default"},"description":"WhatsApp session name"}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MeInfo"}}}}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/checkNumberStatus":{"get":{"operationId":"ChattingController_checkNumberStatus","summary":"Check number status","parameters":[{"name":"phone","required":true,"in":"query","schema":{"type":"string"}},{"name":"session","required":true,"in":"query","schema":{"default":"default","type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WANumberExistResult"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendContactVcard":{"post":{"operationId":"ChattingContrLine truncated
|
||||
@@ -1,11 +1,26 @@
|
||||
import { Controller, Delete, Get, Param, Post, Query } from '@nestjs/common';
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
Delete,
|
||||
Get,
|
||||
Param,
|
||||
Post,
|
||||
Put,
|
||||
Query,
|
||||
} from '@nestjs/common';
|
||||
import { ApiOperation, ApiSecurity, ApiTags } from '@nestjs/swagger';
|
||||
|
||||
import { SessionManager } from '../core/abc/manager.abc';
|
||||
import { WhatsappSession } from '../core/abc/session.abc';
|
||||
import { parseBool } from '../helpers';
|
||||
import { GetChatMessagesQuery } from '../structures/chats.dto';
|
||||
import { SessionApiParam, SessionParam } from './helpers';
|
||||
import { EditMessageRequest } from '../structures/chatting.dto';
|
||||
import {
|
||||
ChatIdApiParam,
|
||||
MessageIdApiParam,
|
||||
SessionApiParam,
|
||||
SessionParam,
|
||||
} from './helpers';
|
||||
|
||||
@ApiSecurity('api_key')
|
||||
@Controller('api/:session/chats')
|
||||
@@ -51,6 +66,33 @@ class ChatsController {
|
||||
) {
|
||||
return session.clearMessages(chatId);
|
||||
}
|
||||
|
||||
@Delete(':chatId/messages/:messageId')
|
||||
@SessionApiParam
|
||||
@ChatIdApiParam
|
||||
@MessageIdApiParam
|
||||
@ApiOperation({ summary: 'Deletes a message from the chat' })
|
||||
deleteMessage(
|
||||
@SessionParam session: WhatsappSession,
|
||||
@Param('chatId') chatId: string,
|
||||
@Param('messageId') messageId: string,
|
||||
) {
|
||||
return session.deleteMessage(chatId, messageId);
|
||||
}
|
||||
|
||||
@Put(':chatId/messages/:messageId')
|
||||
@SessionApiParam
|
||||
@ChatIdApiParam
|
||||
@MessageIdApiParam
|
||||
@ApiOperation({ summary: 'Edits a message in the chat' })
|
||||
editMessage(
|
||||
@SessionParam session: WhatsappSession,
|
||||
@Param('chatId') chatId: string,
|
||||
@Param('messageId') messageId: string,
|
||||
@Body() body: EditMessageRequest,
|
||||
) {
|
||||
return session.editMessage(chatId, messageId, body);
|
||||
}
|
||||
}
|
||||
|
||||
export { ChatsController };
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
MessagePollRequest,
|
||||
MessageReactionRequest,
|
||||
MessageReplyRequest,
|
||||
MessageStarRequest,
|
||||
MessageTextQuery,
|
||||
MessageTextRequest,
|
||||
MessageVideoRequest,
|
||||
@@ -157,6 +158,14 @@ export class ChattingController {
|
||||
return whatsapp.setReaction(request);
|
||||
}
|
||||
|
||||
@Put('/star')
|
||||
@ApiOperation({ summary: 'Star or unstar a message' })
|
||||
async setStar(@Body() request: MessageStarRequest) {
|
||||
const whatsapp = this.manager.getSession(request.session);
|
||||
await whatsapp.setStar(request);
|
||||
return;
|
||||
}
|
||||
|
||||
@Get('/messages')
|
||||
@ApiOperation({ summary: 'Get messages in a chat' })
|
||||
getMessages(@Query() query: GetMessageQuery) {
|
||||
|
||||
@@ -56,11 +56,12 @@ export class GroupsController {
|
||||
summary:
|
||||
'Updates the group settings to only allow admins to edit group info (title, description, photo).',
|
||||
})
|
||||
setGroupAdminOnly(
|
||||
setInfoAdminOnly(
|
||||
@SessionParam session: WhatsappSession,
|
||||
@Param('id') id: string,
|
||||
@Body() request: SettingsSecurityChangeInfo,
|
||||
) {
|
||||
return session.setInfoAdminsOnly(id, true);
|
||||
return session.setInfoAdminsOnly(id, request.adminsOnly);
|
||||
}
|
||||
|
||||
@Get(':id/settings/security/info-admin-only')
|
||||
@@ -76,6 +77,32 @@ export class GroupsController {
|
||||
return session.getInfoAdminsOnly(id);
|
||||
}
|
||||
|
||||
@Put(':id/settings/security/messages-admin-only')
|
||||
@SessionApiParam
|
||||
@ApiOperation({
|
||||
summary:
|
||||
'Updates the group settings to only allow admins to send messages.',
|
||||
})
|
||||
setMessagesAdminOnly(
|
||||
@SessionParam session: WhatsappSession,
|
||||
@Param('id') id: string,
|
||||
@Body() request: SettingsSecurityChangeInfo,
|
||||
) {
|
||||
return session.setMessagesAdminsOnly(id, request.adminsOnly);
|
||||
}
|
||||
|
||||
@Get(':id/settings/security/messages-admin-only')
|
||||
@SessionApiParam
|
||||
@ApiOperation({
|
||||
summary: 'Gets the group settings to only allow admins to send messages.',
|
||||
})
|
||||
getMessagesAdminOnly(
|
||||
@SessionParam session: WhatsappSession,
|
||||
@Param('id') id: string,
|
||||
): Promise<SettingsSecurityChangeInfo> {
|
||||
return session.getMessagesAdminsOnly(id);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
@SessionApiParam
|
||||
@ApiOperation({ summary: 'Delete the group.' })
|
||||
|
||||
@@ -48,6 +48,22 @@ export const SessionApiParam = ApiParam({
|
||||
*/
|
||||
export const SessionParam = Param('session', SessionPipe);
|
||||
|
||||
export const ChatIdApiParam = ApiParam({
|
||||
name: 'chatId',
|
||||
required: true,
|
||||
type: 'string',
|
||||
description: 'Chat ID',
|
||||
example: '123456789@c.us',
|
||||
});
|
||||
|
||||
export const MessageIdApiParam = ApiParam({
|
||||
name: 'messageId',
|
||||
required: true,
|
||||
type: 'string',
|
||||
description: 'Message ID',
|
||||
example: 'true_123456789@c.us_BAE6A33293978B16',
|
||||
});
|
||||
|
||||
function getRefSchemaPaths(models) {
|
||||
return models.map((model) => {
|
||||
return { $ref: getSchemaPath(model) };
|
||||
|
||||
@@ -6,6 +6,7 @@ import { MessageId } from 'whatsapp-web.js';
|
||||
import {
|
||||
ChatRequest,
|
||||
CheckNumberStatusQuery,
|
||||
EditMessageRequest,
|
||||
GetMessageQuery,
|
||||
MessageContactVcardRequest,
|
||||
MessageFileRequest,
|
||||
@@ -15,6 +16,7 @@ import {
|
||||
MessagePollRequest,
|
||||
MessageReactionRequest,
|
||||
MessageReplyRequest,
|
||||
MessageStarRequest,
|
||||
MessageTextRequest,
|
||||
MessageVideoRequest,
|
||||
MessageVoiceRequest,
|
||||
@@ -265,6 +267,10 @@ export abstract class WhatsappSession {
|
||||
|
||||
abstract setReaction(request: MessageReactionRequest);
|
||||
|
||||
setStar(request: MessageStarRequest): Promise<void> {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
/**
|
||||
* Chats methods
|
||||
*/
|
||||
@@ -284,6 +290,18 @@ export abstract class WhatsappSession {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
public deleteMessage(chatId: string, messageId: string) {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
public editMessage(
|
||||
chatId: string,
|
||||
messageId: string,
|
||||
request: EditMessageRequest,
|
||||
) {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
public clearMessages(chatId) {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
@@ -338,6 +356,14 @@ export abstract class WhatsappSession {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
public getMessagesAdminsOnly(id): Promise<SettingsSecurityChangeInfo> {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
public setMessagesAdminsOnly(id, value) {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
public deleteGroup(id) {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
@@ -417,6 +443,10 @@ export abstract class WhatsappSession {
|
||||
throw new NotImplementedByEngineError();
|
||||
}
|
||||
|
||||
public async getEngineInfo(): Promise<any> {
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
* END - Methods for API
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@ import makeWASocket, {
|
||||
} from '@adiwajshing/baileys';
|
||||
import { UnprocessableEntityException } from '@nestjs/common';
|
||||
import * as Buffer from 'buffer';
|
||||
import { request } from 'express';
|
||||
import * as fs from 'fs/promises';
|
||||
import { Agent } from 'https';
|
||||
import * as lodash from 'lodash';
|
||||
@@ -24,6 +25,8 @@ import { flipObject, splitAt } from '../../../helpers';
|
||||
import {
|
||||
ChatRequest,
|
||||
CheckNumberStatusQuery,
|
||||
EditMessageRequest,
|
||||
MessageContactVcardRequest,
|
||||
MessageDestination,
|
||||
MessageFileRequest,
|
||||
MessageImageRequest,
|
||||
@@ -32,6 +35,7 @@ import {
|
||||
MessagePollRequest,
|
||||
MessageReactionRequest,
|
||||
MessageReplyRequest,
|
||||
MessageStarRequest,
|
||||
MessageTextRequest,
|
||||
MessageVoiceRequest,
|
||||
SendSeenRequest,
|
||||
@@ -55,7 +59,10 @@ import {
|
||||
WAHAChatPresences,
|
||||
WAHAPresenceData,
|
||||
} from '../../../structures/presence.dto';
|
||||
import { WAMessage } from '../../../structures/responses.dto';
|
||||
import {
|
||||
WAMessage,
|
||||
WAMessageReaction,
|
||||
} from '../../../structures/responses.dto';
|
||||
import { MeInfo } from '../../../structures/sessions.dto';
|
||||
import { BROADCAST_ID, TextStatus } from '../../../structures/status.dto';
|
||||
import {
|
||||
@@ -73,6 +80,7 @@ import {
|
||||
AvailableInPlusVersion,
|
||||
NotImplementedByEngineError,
|
||||
} from '../../exceptions';
|
||||
import { toVcard } from '../../helpers';
|
||||
import { createAgentProxy } from '../../helpers.proxy';
|
||||
import { QR } from '../../QR';
|
||||
import { NowebAuthFactoryCore } from './NowebAuthFactoryCore';
|
||||
@@ -133,7 +141,7 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
keys: makeCacheableSignalKeyStore(state.keys, logger),
|
||||
},
|
||||
printQRInTerminal: true,
|
||||
browser: Browsers.macOS('Chrome'),
|
||||
browser: Browsers.ubuntu('Chrome'),
|
||||
logger: logger,
|
||||
mobile: false,
|
||||
defaultQueryTimeoutMs: undefined,
|
||||
@@ -200,7 +208,7 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
|
||||
protected listenEngineEventsInDebugMode() {
|
||||
this.sock.ev.process((events) => {
|
||||
this.log.debug(`Received NOWEB events`, events);
|
||||
this.log.debug(`NOWEB events: ${JSON.stringify(events)}`);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -345,6 +353,37 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
return this.sock.sendMessage(chatId, message);
|
||||
}
|
||||
|
||||
public deleteMessage(chatId: string, messageId: string) {
|
||||
const jid = toJID(this.ensureSuffix(chatId));
|
||||
const key = parseMessageId(messageId);
|
||||
return this.sock.sendMessage(jid, { delete: key });
|
||||
}
|
||||
|
||||
public editMessage(
|
||||
chatId: string,
|
||||
messageId: string,
|
||||
request: EditMessageRequest,
|
||||
) {
|
||||
const jid = toJID(this.ensureSuffix(chatId));
|
||||
const key = parseMessageId(messageId);
|
||||
const message = {
|
||||
text: request.text,
|
||||
mentions: request.mentions?.map(toJID),
|
||||
edit: key,
|
||||
};
|
||||
return this.sock.sendMessage(jid, message);
|
||||
}
|
||||
|
||||
async sendContactVCard(request: MessageContactVcardRequest) {
|
||||
const chatId = this.ensureSuffix(request.chatId);
|
||||
const contacts = request.contacts.map((el) => ({ vcard: toVcard(el) }));
|
||||
await this.sock.sendMessage(chatId, {
|
||||
contacts: {
|
||||
contacts: contacts,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async sendPoll(request: MessagePollRequest) {
|
||||
const requestPoll = request.poll;
|
||||
const poll = {
|
||||
@@ -431,6 +470,19 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
return this.sock.sendMessage(key.remoteJid, reactionMessage);
|
||||
}
|
||||
|
||||
async setStar(request: MessageStarRequest) {
|
||||
const key = parseMessageId(request.messageId);
|
||||
await this.sock.chatModify(
|
||||
{
|
||||
star: {
|
||||
messages: [{ id: key.id, fromMe: key.fromMe }],
|
||||
star: request.star,
|
||||
},
|
||||
},
|
||||
toJID(request.chatId),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Contacts methods
|
||||
*/
|
||||
@@ -585,6 +637,12 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
this.handleIncomingMessages(messages, handler, false);
|
||||
});
|
||||
return true;
|
||||
case WAHAEvents.MESSAGE_REACTION:
|
||||
this.sock.ev.on(BaileysEvents.MESSAGES_UPSERT, ({ messages }) => {
|
||||
const reactions = this.processMessageReaction(messages);
|
||||
reactions.map(handler);
|
||||
});
|
||||
return true;
|
||||
case WAHAEvents.MESSAGE_ANY:
|
||||
this.sock.ev.on(BaileysEvents.MESSAGES_UPSERT, ({ messages }) =>
|
||||
this.handleIncomingMessages(messages, handler, true),
|
||||
@@ -641,6 +699,8 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
// if there is no text or media message
|
||||
if (!message) return;
|
||||
if (!message.message) return;
|
||||
// Ignore reactions, we have dedicated handler for that
|
||||
if (message.message.reactionMessage) return;
|
||||
// Ignore poll votes, we have dedicated handler for that
|
||||
if (message.message.pollUpdateMessage) return;
|
||||
// Do not include my messages
|
||||
@@ -651,6 +711,34 @@ export class WhatsappSessionNoWebCore extends WhatsappSession {
|
||||
}
|
||||
}
|
||||
|
||||
private processMessageReaction(messages: any[]): WAMessageReaction[] {
|
||||
const reactions = [];
|
||||
for (const message of messages) {
|
||||
if (!message) return [];
|
||||
if (!message.message) return [];
|
||||
if (!message.message.reactionMessage) return [];
|
||||
|
||||
const id = buildMessageId(message.key);
|
||||
const fromToParticipant = getFromToParticipant(message);
|
||||
const reactionMessage = message.message.reactionMessage;
|
||||
const messageId = buildMessageId(reactionMessage.key);
|
||||
const reaction: WAMessageReaction = {
|
||||
id: id,
|
||||
timestamp: message.messageTimestamp,
|
||||
from: toCusFormat(fromToParticipant.from),
|
||||
fromMe: message.key.fromMe,
|
||||
to: toCusFormat(fromToParticipant.to),
|
||||
participant: toCusFormat(fromToParticipant.participant),
|
||||
reaction: {
|
||||
text: reactionMessage.text,
|
||||
messageId: messageId,
|
||||
},
|
||||
};
|
||||
reactions.push(reaction);
|
||||
}
|
||||
return reactions;
|
||||
}
|
||||
|
||||
private processIncomingMessage(message) {
|
||||
return this.downloadMedia(message)
|
||||
.then(this.toWAMessage)
|
||||
|
||||
@@ -6,7 +6,6 @@ import {
|
||||
ChatRequest,
|
||||
CheckNumberStatusQuery,
|
||||
GetMessageQuery,
|
||||
MessageContactVcardRequest,
|
||||
MessageFileRequest,
|
||||
MessageImageRequest,
|
||||
MessageLinkPreviewRequest,
|
||||
@@ -164,14 +163,6 @@ export class WhatsappSessionVenomCore extends WhatsappSession {
|
||||
}
|
||||
}
|
||||
|
||||
sendContactVCard(request: MessageContactVcardRequest) {
|
||||
return this.whatsapp.sendContactVcard(
|
||||
request.chatId,
|
||||
request.contactsId,
|
||||
request.name,
|
||||
);
|
||||
}
|
||||
|
||||
sendText(request: MessageTextRequest) {
|
||||
return this.whatsapp.sendText(
|
||||
this.ensureSuffix(request.chatId),
|
||||
|
||||
@@ -8,18 +8,21 @@ import {
|
||||
GroupChat,
|
||||
Location,
|
||||
Message,
|
||||
Reaction,
|
||||
} from 'whatsapp-web.js';
|
||||
import { Message as MessageInstance } from 'whatsapp-web.js/src/structures';
|
||||
|
||||
import {
|
||||
ChatRequest,
|
||||
CheckNumberStatusQuery,
|
||||
EditMessageRequest,
|
||||
GetMessageQuery,
|
||||
MessageFileRequest,
|
||||
MessageImageRequest,
|
||||
MessageLocationRequest,
|
||||
MessageReactionRequest,
|
||||
MessageReplyRequest,
|
||||
MessageStarRequest,
|
||||
MessageTextRequest,
|
||||
MessageVoiceRequest,
|
||||
SendSeenRequest,
|
||||
@@ -39,7 +42,10 @@ import {
|
||||
ParticipantsRequest,
|
||||
SettingsSecurityChangeInfo,
|
||||
} from '../../../structures/groups.dto';
|
||||
import { WAMessage } from '../../../structures/responses.dto';
|
||||
import {
|
||||
WAMessage,
|
||||
WAMessageReaction,
|
||||
} from '../../../structures/responses.dto';
|
||||
import { MeInfo } from '../../../structures/sessions.dto';
|
||||
import { WAMessageRevokedBody } from '../../../structures/webhooks.dto';
|
||||
import { IEngineMediaProcessor } from '../../abc/media.abc';
|
||||
@@ -67,14 +73,24 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
this.qr = new QR();
|
||||
}
|
||||
|
||||
protected async buildClient() {
|
||||
const clientOptions: ClientOptions = {
|
||||
protected getClientOptions(): ClientOptions {
|
||||
return {
|
||||
puppeteer: {
|
||||
headless: true,
|
||||
executablePath: this.getBrowserExecutablePath(),
|
||||
args: this.getBrowserArgsForPuppeteer(),
|
||||
},
|
||||
webVersion: '2.2411.2',
|
||||
webVersionCache: {
|
||||
type: 'remote',
|
||||
remotePath:
|
||||
'https://raw.githubusercontent.com/wppconnect-team/wa-version/main/html/{version}.html',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected async buildClient() {
|
||||
const clientOptions = this.getClientOptions();
|
||||
this.addProxyConfig(clientOptions);
|
||||
return new Client(clientOptions);
|
||||
}
|
||||
@@ -112,6 +128,15 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
this.status = WAHASessionStatus.FAILED;
|
||||
this.log.error('The WhatsApp Web page has been closed');
|
||||
});
|
||||
if (this.isDebugEnabled()) {
|
||||
this.log.debug("Logging 'console' event for web page");
|
||||
this.whatsapp.pupPage.on('console', (msg) =>
|
||||
this.log.debug(`WEBJS page log: ${msg.text()}`),
|
||||
);
|
||||
this.whatsapp.pupPage.evaluate(() =>
|
||||
console.log(`url is ${location.href}`),
|
||||
);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.status = WAHASessionStatus.FAILED;
|
||||
@@ -150,7 +175,8 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
for (const key in Events) {
|
||||
const event = Events[key];
|
||||
this.whatsapp.on(event, (...data: any[]) => {
|
||||
this.log.debug(`Received WEBJS event`, { event: event, data: data });
|
||||
const log = { event: event, data: data };
|
||||
this.log.debug(`WEBJS event: ${JSON.stringify(log)}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -231,6 +257,24 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
);
|
||||
}
|
||||
|
||||
public deleteMessage(chatId: string, messageId: string) {
|
||||
const message = this.recreateMessage(messageId);
|
||||
return message.delete(true);
|
||||
}
|
||||
|
||||
public editMessage(
|
||||
chatId: string,
|
||||
messageId: string,
|
||||
request: EditMessageRequest,
|
||||
) {
|
||||
const message = this.recreateMessage(messageId);
|
||||
const options = {
|
||||
// It's fine to sent just ids instead of Contact object
|
||||
mentions: request.mentions as unknown as string[],
|
||||
};
|
||||
return message.edit(request.text, options);
|
||||
}
|
||||
|
||||
reply(request: MessageReplyRequest) {
|
||||
const options = {
|
||||
quotedMessageId: request.reply_to,
|
||||
@@ -279,15 +323,30 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
}
|
||||
|
||||
async setReaction(request: MessageReactionRequest) {
|
||||
const messageId = this.deserializeId(request.messageId);
|
||||
// Recreate instance to react on it
|
||||
const message = new MessageInstance(this.whatsapp);
|
||||
message.id = messageId;
|
||||
message._data = { id: messageId };
|
||||
|
||||
const message = this.recreateMessage(request.messageId);
|
||||
return message.react(request.reaction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recreate message instance from id
|
||||
*/
|
||||
private recreateMessage(msgId: string): MessageInstance {
|
||||
const messageId = this.deserializeId(msgId);
|
||||
const data = {
|
||||
id: messageId,
|
||||
};
|
||||
return new MessageInstance(this.whatsapp, data);
|
||||
}
|
||||
|
||||
async setStar(request: MessageStarRequest) {
|
||||
const message = this.recreateMessage(request.messageId);
|
||||
if (request.star) {
|
||||
await message.star();
|
||||
} else {
|
||||
await message.unstar();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Chats methods
|
||||
*/
|
||||
@@ -377,6 +436,7 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
public async getInfoAdminsOnly(id): Promise<SettingsSecurityChangeInfo> {
|
||||
const groupChat = (await this.whatsapp.getChatById(id)) as GroupChat;
|
||||
return {
|
||||
// Undocumented property, can be changed in the future
|
||||
// @ts-ignore
|
||||
adminsOnly: groupChat.groupMetadata.restrict,
|
||||
};
|
||||
@@ -387,6 +447,21 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
return groupChat.setInfoAdminsOnly(value);
|
||||
}
|
||||
|
||||
public async getMessagesAdminsOnly(id): Promise<SettingsSecurityChangeInfo> {
|
||||
const groupChat = (await this.whatsapp.getChatById(id)) as GroupChat;
|
||||
// @ts-ignore
|
||||
return {
|
||||
// Undocumented property, can be changed in the future
|
||||
// @ts-ignore
|
||||
adminsOnly: groupChat.groupMetadata.announce,
|
||||
};
|
||||
}
|
||||
|
||||
public async setMessagesAdminsOnly(id, value) {
|
||||
const groupChat = (await this.whatsapp.getChatById(id)) as GroupChat;
|
||||
return groupChat.setMessagesAdminsOnly(value);
|
||||
}
|
||||
|
||||
public getGroups() {
|
||||
return this.whatsapp
|
||||
.getChats()
|
||||
@@ -520,6 +595,11 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
},
|
||||
);
|
||||
return true;
|
||||
case WAHAEvents.MESSAGE_REACTION:
|
||||
this.whatsapp.on('message_reaction', (message) =>
|
||||
handler(this.processMessageReaction(message)),
|
||||
);
|
||||
return true;
|
||||
case WAHAEvents.MESSAGE_ANY:
|
||||
this.whatsapp.on(Events.MESSAGE_CREATE, (message) =>
|
||||
this.processIncomingMessage(message).then(handler),
|
||||
@@ -557,6 +637,21 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
return await this.toWAMessage(message);
|
||||
}
|
||||
|
||||
private processMessageReaction(reaction: Reaction): WAMessageReaction {
|
||||
return {
|
||||
id: reaction.id._serialized,
|
||||
from: reaction.senderId,
|
||||
fromMe: reaction.id.fromMe,
|
||||
participant: reaction.senderId,
|
||||
to: reaction.id.remote,
|
||||
timestamp: reaction.timestamp,
|
||||
reaction: {
|
||||
text: reaction.reaction,
|
||||
messageId: reaction.msgId._serialized,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected toWAMessage(message: Message): Promise<WAMessage> {
|
||||
// @ts-ignore
|
||||
return Promise.resolve({
|
||||
@@ -582,6 +677,13 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
|
||||
});
|
||||
}
|
||||
|
||||
public async getEngineInfo() {
|
||||
return {
|
||||
WWebVersion: await this.whatsapp?.getWWebVersion(),
|
||||
state: await this.whatsapp?.getState(),
|
||||
};
|
||||
}
|
||||
|
||||
protected toWAContact(contact: Contact) {
|
||||
// @ts-ignore
|
||||
contact.id = contact.id._serialized;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
export function toVcard(data): string {
|
||||
if (data.vcard) {
|
||||
return data.vcard;
|
||||
}
|
||||
const parts = [];
|
||||
parts.push('BEGIN:VCARD');
|
||||
parts.push('VERSION:3.0');
|
||||
parts.push(`FN:${data.fullName}`);
|
||||
if (data.organization) {
|
||||
parts.push(`ORG:${data.organization};`);
|
||||
}
|
||||
if (data.whatsappId) {
|
||||
parts.push(
|
||||
`TEL;type=CELL;type=VOICE;waid=${data.whatsappId}:${data.phoneNumber}`,
|
||||
);
|
||||
} else {
|
||||
parts.push(`TEL;type=CELL;type=VOICE:${data.phoneNumber}`);
|
||||
}
|
||||
parts.push('END:VCARD');
|
||||
return parts.join('\n');
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
ConsoleLogger,
|
||||
Injectable,
|
||||
LogLevel,
|
||||
NotFoundException,
|
||||
UnprocessableEntityException,
|
||||
} from '@nestjs/common';
|
||||
@@ -38,8 +39,8 @@ export class OnlyDefaultSessionIsAllowed extends UnprocessableEntityException {
|
||||
}
|
||||
}
|
||||
|
||||
export function buildLogger(name) {
|
||||
return new ConsoleLogger(name, { logLevels: getLogLevels() });
|
||||
export function buildLogger(name: string, levels: LogLevel[]) {
|
||||
return new ConsoleLogger(name, { logLevels: levels });
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
@@ -107,12 +108,13 @@ export class SessionManagerCore extends SessionManager {
|
||||
|
||||
const name = request.name;
|
||||
this.log.log(`'${name}' - starting session...`);
|
||||
const log = buildLogger(`WhatsappSession - ${name}`);
|
||||
const levels = getLogLevels(request.config?.debug);
|
||||
const log = buildLogger(`WhatsappSession - ${name}`, levels);
|
||||
const mediaManager = new CoreMediaManager(
|
||||
new MediaStorageCore(),
|
||||
this.config.mimetypes,
|
||||
);
|
||||
const webhookLog = buildLogger(`Webhook - ${name}`);
|
||||
const webhookLog = buildLogger(`Webhook - ${name}`, levels);
|
||||
const webhook = new this.WebhookConductorClass(webhookLog);
|
||||
const proxyConfig = this.getProxyConfig(request);
|
||||
const sessionConfig: SessionParams = {
|
||||
@@ -213,12 +215,17 @@ export class SessionManagerCore extends SessionManager {
|
||||
];
|
||||
}
|
||||
const me = await this.session.getSessionMeInfo().catch((err) => null);
|
||||
const engine = {
|
||||
engine: this.session?.engine,
|
||||
...(await this.session?.getEngineInfo().catch((err) => ({}))),
|
||||
};
|
||||
return [
|
||||
{
|
||||
name: this.session.name,
|
||||
status: this.session.status,
|
||||
config: this.session.sessionConfig,
|
||||
me: me,
|
||||
engine: engine,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export class WebhookSenderCore extends WebhookSender {
|
||||
return;
|
||||
}
|
||||
this.log.log(`POST request was sent with status code: ${res.statusCode}`);
|
||||
this.log.verbose(`Response: ${JSON.stringify(body)}`);
|
||||
this.log.debug(`Response: ${body}`);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,10 +33,11 @@ function splitAt(str: string, index) {
|
||||
return [fst.join(''), snd.join('')];
|
||||
}
|
||||
|
||||
function getLogLevels(): LogLevel[] {
|
||||
return process.env.DEBUG != undefined
|
||||
? ['log', 'debug', 'error', 'verbose', 'warn']
|
||||
: ['log', 'error', 'warn', 'verbose'];
|
||||
function getLogLevels(debug: boolean): LogLevel[] {
|
||||
const enableDebug = process.env.DEBUG != undefined || debug;
|
||||
return enableDebug
|
||||
? ['log', 'error', 'warn', 'debug', 'verbose']
|
||||
: ['log', 'error', 'warn'];
|
||||
}
|
||||
|
||||
export { flipObject, getLogLevels, parseBool, splitAt };
|
||||
@@ -31,7 +31,7 @@ async function loadModules(): Promise<
|
||||
async function bootstrap() {
|
||||
const [AppModule, SwaggerModule] = await loadModules();
|
||||
const app = await NestFactory.create(AppModule, {
|
||||
logger: getLogLevels(),
|
||||
logger: getLogLevels(false),
|
||||
});
|
||||
|
||||
app.enableShutdownHooks();
|
||||
|
||||
@@ -85,9 +85,59 @@ export class MessageRequest extends SessionBaseRequest {
|
||||
messageId: string;
|
||||
}
|
||||
|
||||
export class VCardContact {
|
||||
@ApiProperty({
|
||||
example:
|
||||
'BEGIN:VCARD\nVERSION:3.0\nFN:Jane Doe\nORG:Company Name;\nTEL;type=CELL;type=VOICE;waid=911111111111:+91 11111 11111\nEND:VCARD',
|
||||
description: 'The vcard string',
|
||||
})
|
||||
vcard: string;
|
||||
}
|
||||
|
||||
export class Contact {
|
||||
@ApiProperty({
|
||||
example: 'John Doe',
|
||||
description: 'The full name of the contact',
|
||||
})
|
||||
fullName: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: 'Company Name',
|
||||
description: 'The organization of the contact',
|
||||
required: false,
|
||||
})
|
||||
organization: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: '+91 11111 11111',
|
||||
description: 'The phone number of the contact',
|
||||
})
|
||||
phoneNumber: string;
|
||||
|
||||
@ApiProperty({
|
||||
example: '911111111111',
|
||||
description: 'The whatsapp id of the contact. DO NOT add + or @c.us',
|
||||
required: false,
|
||||
})
|
||||
whatsappId: string;
|
||||
|
||||
vcard: string = null;
|
||||
}
|
||||
|
||||
@ApiExtraModels(Contact, VCardContact)
|
||||
export class MessageContactVcardRequest extends ChatRequest {
|
||||
contactsId: string;
|
||||
name: string;
|
||||
@ApiProperty({
|
||||
type: 'array',
|
||||
oneOf: [
|
||||
{
|
||||
$ref: getSchemaPath(VCardContact),
|
||||
},
|
||||
{
|
||||
$ref: getSchemaPath(Contact),
|
||||
},
|
||||
],
|
||||
})
|
||||
contacts: (VCardContact | Contact)[];
|
||||
}
|
||||
|
||||
export class MessageTextRequest extends ChatRequest {
|
||||
@@ -96,6 +146,13 @@ export class MessageTextRequest extends ChatRequest {
|
||||
mentions?: string[];
|
||||
}
|
||||
|
||||
export class EditMessageRequest {
|
||||
text = 'Hello, world!';
|
||||
|
||||
@ApiHideProperty()
|
||||
mentions?: string[];
|
||||
}
|
||||
|
||||
export class MessageReplyRequest extends MessageTextRequest {
|
||||
text = 'Reply text';
|
||||
@ApiProperty({
|
||||
@@ -167,6 +224,13 @@ export class MessageReactionRequest extends MessageRequest {
|
||||
reaction: string;
|
||||
}
|
||||
|
||||
export class MessageStarRequest extends MessageRequest {
|
||||
@ChatIdProperty()
|
||||
chatId: string;
|
||||
|
||||
star: boolean;
|
||||
}
|
||||
|
||||
export class WANumberExistResult {
|
||||
numberExists: boolean;
|
||||
@ApiProperty({
|
||||
|
||||
@@ -3,6 +3,7 @@ export const SECOND = 1000;
|
||||
export enum WAHAEvents {
|
||||
SESSION_STATUS = 'session.status',
|
||||
MESSAGE = 'message',
|
||||
MESSAGE_REACTION = 'message.reaction',
|
||||
MESSAGE_ANY = 'message.any',
|
||||
MESSAGE_ACK = 'message.ack',
|
||||
MESSAGE_REVOKED = 'message.revoked',
|
||||
|
||||
@@ -9,7 +9,7 @@ export class Participant {
|
||||
}
|
||||
|
||||
export class SettingsSecurityChangeInfo {
|
||||
adminsOnly: boolean;
|
||||
adminsOnly: boolean = true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,7 +30,7 @@ export class WAMedia {
|
||||
filename?: string;
|
||||
}
|
||||
|
||||
export class WAMessage {
|
||||
class WAMessageBase {
|
||||
@MessageIdProperty()
|
||||
id: string;
|
||||
|
||||
@@ -65,7 +65,9 @@ export class WAMessage {
|
||||
description: 'For groups - participant who sent the message',
|
||||
})
|
||||
participant: string;
|
||||
}
|
||||
|
||||
export class WAMessage extends WAMessageBase {
|
||||
@ApiProperty({
|
||||
description: 'Message content',
|
||||
})
|
||||
@@ -121,3 +123,25 @@ export class WAMessage {
|
||||
})
|
||||
_data?: any;
|
||||
}
|
||||
|
||||
export class WAReaction {
|
||||
@ApiProperty({
|
||||
description:
|
||||
'Reaction to the message. Either the reaction (emoji) or empty string to remove the reaction',
|
||||
})
|
||||
text: string;
|
||||
|
||||
@ApiProperty({
|
||||
description: 'Message ID for the message to react to',
|
||||
example: 'false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA',
|
||||
})
|
||||
messageId: string;
|
||||
}
|
||||
|
||||
export class WAMessageReaction extends WAMessageBase {
|
||||
@ApiProperty({
|
||||
description:
|
||||
'Reaction to the message. Either the reaction (emoji) or empty string to remove the reaction',
|
||||
})
|
||||
reaction: WAReaction;
|
||||
}
|
||||
@@ -39,10 +39,13 @@ export class ProxyConfig {
|
||||
|
||||
export class SessionConfig {
|
||||
webhooks?: WebhookConfig[];
|
||||
|
||||
@ApiProperty({
|
||||
example: null,
|
||||
})
|
||||
proxy?: ProxyConfig;
|
||||
|
||||
debug: boolean = false;
|
||||
}
|
||||
|
||||
export class SessionStartRequest {
|
||||
@@ -79,4 +82,5 @@ export class MeInfo {
|
||||
|
||||
export class SessionInfo extends SessionDTO {
|
||||
me?: MeInfo;
|
||||
engine?: any;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import { WAHAEnvironment } from './environment.dto';
|
||||
import { WAHAChatPresences } from './presence.dto';
|
||||
import { ChatIdProperty, MessageIdProperty } from './properties.dto';
|
||||
import { WAMessage } from './responses.dto';
|
||||
import { WAMessage, WAMessageReaction } from './responses.dto';
|
||||
import { MeInfo } from './sessions.dto';
|
||||
|
||||
export class WAMessageAckBody {
|
||||
@@ -134,6 +134,16 @@ class WAHAWebhookMessage extends WAHAWebhook {
|
||||
payload: WAMessage;
|
||||
}
|
||||
|
||||
class WAHAWebhookMessageReaction extends WAHAWebhook {
|
||||
@ApiProperty({
|
||||
description:
|
||||
'The event is triggered when a user reacts or removes a reaction.',
|
||||
})
|
||||
event = WAHAEvents.MESSAGE_REACTION;
|
||||
|
||||
payload: WAMessageReaction;
|
||||
}
|
||||
|
||||
class WAHAWebhookMessageAny extends WAHAWebhook {
|
||||
@ApiProperty({
|
||||
description: 'Fired on all message creations, including your own.',
|
||||
@@ -223,6 +233,7 @@ class WAHAWebhookPollVoteFailed extends WAHAWebhook {
|
||||
const WAHA_WEBHOOKS = [
|
||||
WAHAWebhookSessionStatus,
|
||||
WAHAWebhookMessage,
|
||||
WAHAWebhookMessageReaction,
|
||||
WAHAWebhookMessageAny,
|
||||
WAHAWebhookMessageAck,
|
||||
WAHAWebhookMessageRevoked,
|
||||
|
||||
@@ -33,7 +33,7 @@ export function getEngineName(): string {
|
||||
}
|
||||
|
||||
export const VERSION: WAHAEnvironment = {
|
||||
version: '2024.3.1',
|
||||
version: '2024.3.14',
|
||||
engine: getEngineName(),
|
||||
tier: getWAHAVersion(),
|
||||
browser: getBrowserExecutablePath(),
|
||||
|
||||
@@ -14,7 +14,7 @@ __metadata:
|
||||
|
||||
"@adiwajshing/baileys@github:WhiskeySockets/Baileys":
|
||||
version: 6.6.0
|
||||
resolution: "@adiwajshing/baileys@https://github.com/WhiskeySockets/Baileys.git#commit=8ae00256166b72e4d758aae2dfd25c0f92d98f3f"
|
||||
resolution: "@adiwajshing/baileys@https://github.com/WhiskeySockets/Baileys.git#commit=1896ebe0ea524c617ad5a5dbdb2e7e1a6f18978a"
|
||||
dependencies:
|
||||
"@adiwajshing/keyed-db": ^0.2.4
|
||||
"@hapi/boom": ^9.1.3
|
||||
@@ -44,7 +44,7 @@ __metadata:
|
||||
optional: true
|
||||
sharp:
|
||||
optional: true
|
||||
checksum: 044127289093597df1c7cf11bd2634b8fc7a1a5313c44bebe25e952407c3b84b65ee250b21b1ad353811c561a30a5f69c5b8882d458525d8a8d8b91cb260c74a
|
||||
checksum: d52ffc8fadadf62c7ded2ede480ccc5a73fdebefadacfcb581f80a18562b3236bdce6a44aa1c3ff8e9e66f30e404a55155d7a4507ad1e88ee69c0acfc8c8163d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1300,10 +1300,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@pedroslopez/moduleraid@npm:^5.0.2":
|
||||
version: 5.0.2
|
||||
resolution: "@pedroslopez/moduleraid@npm:5.0.2"
|
||||
checksum: b5668cb8d602e3fae0bcd75172f53b301814582ec288f4413127377a8be007aafc63846855431b6096a70dc9f113b059f6286bbc254f3bdbec435ba517dae36f
|
||||
"@pedroslopez/moduleraid@github:wwebjs/moduleRaid":
|
||||
version: 6.0.2
|
||||
resolution: "@pedroslopez/moduleraid@https://github.com/wwebjs/moduleRaid.git#commit=2ba8baadbc2a73305775ca72325102ed2c629f89"
|
||||
checksum: 399d08f1bc7703f73f7ec5e80618139f6ed4a95cd05baa87a9c6c69d8cd0fbd299e1c757414fed2e160c9ec6dfb0f4b8e5fc08261b97bfb7f248dc16c28e9f83
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -13349,9 +13349,9 @@ __metadata:
|
||||
|
||||
"whatsapp-web.js@https://github.com/devlikeapro/whatsapp-web.js#main-fork":
|
||||
version: 1.23.1-alpha.5
|
||||
resolution: "whatsapp-web.js@https://github.com/devlikeapro/whatsapp-web.js.git#commit=9587dc75e22e30bceb87e0cde4bd46ea7674d0d4"
|
||||
resolution: "whatsapp-web.js@https://github.com/devlikeapro/whatsapp-web.js.git#commit=1f9c956cd13cc75c211d14e82cf9b5fd665f9b03"
|
||||
dependencies:
|
||||
"@pedroslopez/moduleraid": ^5.0.2
|
||||
"@pedroslopez/moduleraid": "github:wwebjs/moduleRaid"
|
||||
adm-zip: ^0.5.10
|
||||
archiver: ^5.3.1
|
||||
fluent-ffmpeg: 2.1.2
|
||||
@@ -13368,7 +13368,7 @@ __metadata:
|
||||
optional: true
|
||||
unzipper:
|
||||
optional: true
|
||||
checksum: 9be4cefbf1c3eea3e7dbdaf681cd6588665e18a536b455b562fd5155d011e46039f646e87d76e434107d7e0de61c6a3772b07da62dc4b449043f59bbc011f32a
|
||||
checksum: 03894e8cf847876aac6a543aada3cccce2010069231fb2165d5895598a32f883d5269f5593afa0b369b2bb93a9399a5214d582b3a37b6cf5bda804edf07912d0
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
||||