Compare commits

...
39 Commits
Author SHA1 Message Date
allburov 65d0f87eeb Use -plus docker image in security
Release / deploy-docker (push) Waiting to run
2022-12-11 17:01:47 +07:00
allburov 488868d80e Add WHATSAPP_SWAGGER_USERNAME, WHATSAPP_SWAGGER_PASSWORD to config.md 2022-12-11 16:58:12 +07:00
allburov 154965efcb [core] bump version to 2022.12.11 2022-12-11 16:52:36 +07:00
allburov f364f0b495 [core] Authentication for swagger panel (available in plus only) 2022-12-11 16:52:34 +07:00
allburov 82e2f5bcb9 [core] Authentication for swagger panel (available in plus only) 2022-12-11 16:52:28 +07:00
dependabot[bot] f7a2228925 Bump venom-bot from 4.3.6 to 4.3.7
Bumps [venom-bot](https://github.com/orkestral/venom) from 4.3.6 to 4.3.7.
- [Release notes](https://github.com/orkestral/venom/releases)
- [Changelog](https://github.com/orkestral/venom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/orkestral/venom/compare/v4.3.6...v4.3.7)

---
updated-dependencies:
- dependency-name: venom-bot
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-11 16:52:17 +07:00
allburov dadc9d4efd Up version 2022-12-11 16:52:11 +07:00
allburov df59867431 Up dependencies 2022-12-11 16:52:11 +07:00
dependabot[bot] a7c6e9dc00 Bump whatsapp-web.js from 1.18.3 to 1.18.4
Bumps [whatsapp-web.js](https://github.com/pedroslopez/whatsapp-web.js) from 1.18.3 to 1.18.4.
- [Release notes](https://github.com/pedroslopez/whatsapp-web.js/releases)
- [Commits](https://github.com/pedroslopez/whatsapp-web.js/compare/v1.18.3...v1.18.4)

---
updated-dependencies:
- dependency-name: whatsapp-web.js
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-11 16:52:11 +07:00
allburov 6b51cfd448 Bump version to 2022.11.20
Release / deploy-docker (push) Waiting to run
2022-11-20 16:31:12 +07:00
allburov 98b86ca527 [core] Fix checkNumberStatus issue #26 2022-11-20 16:30:56 +07:00
allburov 9a2ef4c52a [core] Use session instead of sessionName 2022-11-20 16:30:56 +07:00
allburov d69d4bd29d [core] update venom to 4.3.5 2022-11-20 16:30:56 +07:00
allburov 97cdc56c26 [core] Update dependencies script 2022-11-20 16:30:56 +07:00
allburov c2440b9c79 Rearange blocks a little 2022-11-20 15:55:04 +07:00
allburov f0b69d089a No tokens folder 2022-11-20 15:32:41 +07:00
allburov ac79549934 Add link to example for python 2022-11-20 15:09:37 +07:00
allburov e6b8b5e904 examples not draft 2022-11-20 15:03:03 +07:00
allburov 5a22e5b2b2 Typo 2022-11-20 14:58:13 +07:00
allburov 431d7bf9d9 Add CPU and memory to Faq 2022-11-20 14:56:30 +07:00
allburov 865ea6e66b Set Plus subscription to $19 always 2022-11-20 14:28:07 +07:00
allburov 2f787d6a53 Add quick start to readme 2022-11-20 14:20:04 +07:00
allburov 939ac28d00 Remove nl language 2022-11-20 14:13:16 +07:00
allburov 76068add09 [core] Add chrome optimization arguments 2022-11-19 13:26:03 +07:00
allburov 0730dd6756 Add api key to run command 2022-11-19 13:25:59 +07:00
allburov 64cce8e8be Fix few mistakes on index 2022-11-16 14:51:34 +07:00
allburov 2d12dc0f3e How to guides 2022-11-16 14:50:42 +07:00
allburov 82a60e99cc Ignore tokens too 2022-11-16 14:49:26 +07:00
allburov 1cbd18db76 Mark faq as draft 2022-11-15 14:18:04 +07:00
allburov 48ccd636cd Add yandex metrics 2022-11-15 10:22:46 +07:00
allburov 573dd0da7e Special new year offer 2022-11-15 10:18:28 +07:00
allburov df8583801f Add engines info 2022-11-15 10:08:15 +07:00
allburov ff2b434133 Add run commands 2022-11-15 10:00:22 +07:00
allburov 30cae74d50 Update webjs to 1.18.3 2022-11-15 10:00:18 +07:00
allburov a896d32d37 Update venom to 4.3.3 2022-11-15 10:00:17 +07:00
allburov d9d4527894 add functions for getCatchQR and buildClient 2022-11-15 10:00:08 +07:00
allburov e93caac34b Do not use toWAMessage 2022-11-15 09:59:26 +07:00
allburov cd5182f8ee Set waha site base url 2022-11-11 12:48:08 +07:00
allburov b185c02252 Publish right path 2022-11-11 12:41:42 +07:00
46 changed files with 835 additions and 818 deletions

No files matched your search

+1 -1
View File
@@ -29,8 +29,8 @@ jobs:
- name: Upload folder
uses: actions/upload-artifact@v2
with:
path: docs/site/public
name: public
path: public
deploy-github-pages:
needs: build
+1
View File
@@ -1,4 +1,5 @@
.sessions
tokens
files
venv
.wwebjs_auth
+6
View File
@@ -1,4 +1,10 @@
repos:
- repo: https://github.com/Lucas-C/pre-commit-hooks-nodejs
rev: v1.1.2
hooks:
- id: markdown-toc
name: README.md
files: ^README.md$
- repo: local
hooks:
- id: no-plus-in-core
+16 -1
View File
@@ -1,13 +1,25 @@
build:
docker build . -t devlikeapro/whatsapp-http-api
run:
run-webjs:
docker run \
--rm -d \
-p 127.0.0.1:3000:3000/tcp \
-v `pwd`/.sessions:/app/.sessions \
-e WHATSAPP_HOOK_URL=https://httpbin.org/post \
-e WHATSAPP_HOOK_EVENTS=* \
-e WHATSAPP_API_KEY=321 \
--name whatsapp-http-api devlikeapro/whatsapp-http-api
run-venom:
docker run \
--rm -d \
-p 127.0.0.1:3000:3000/tcp \
-v `pwd`/.sessions:/app/.sessions \
-e WHATSAPP_HOOK_URL=https://httpbin.org/post \
-e WHATSAPP_HOOK_EVENTS=* \
-e WHATSAPP_DEFAULT_ENGINE=VENOM \
-e WHATSAPP_API_KEY=321 \
--name whatsapp-http-api devlikeapro/whatsapp-http-api
stop:
@@ -21,3 +33,6 @@ push:
update-swagger:
wget http://localhost:3000/-json -O ./docs/site/static/swagger/openapi.json
update-dependencies:
. ${NVM_DIR}/nvm.sh && nvm exec npm install venom-bot whatsapp-web.js --save
+160 -7
View File
@@ -9,9 +9,33 @@
- Documentation: [https://waha.devlike.pro/](https://waha.devlike.pro/)
- Swagger Example: [https://waha.devlike.pro/swagger](https://waha.devlike.pro/swagger)
## Features
# Tables of Contents
### Messages
<!-- toc -->
- [Features](#features)
* [Messages](#messages)
* [Sessions](#sessions)
* [Security](#security)
* [Updates](#updates)
* [Groups [soon]](#groups-soon)
* [Contacts [soon]](#contacts-soon)
- [Quick start](#quick-start)
* [Requirements](#requirements)
* [Send your first message](#send-your-first-message)
+ [1. Download image](#1-download-image)
+ [2. Run WhatsApp HTTP API](#2-run-whatsapp-http-api)
+ [3. Start a new session](#3-start-a-new-session)
+ [4. Get and scan QR](#4-get-and-scan-qr)
+ [5. Get the screenshot](#5-get-the-screenshot)
+ [6. Send a text message](#6-send-a-text-message)
* [What is next?](#what-is-next)
<!-- tocstop -->
# Features
## Messages
- Send messages
- Receive messages
- Message replies
@@ -24,22 +48,22 @@
- Receive media (images/audio/video/documents)
- Receive messages - webhook retries
### Sessions
## Sessions
- Multi Device
- Get the screenshot
- Session saving (don't have to scan QR on every restart)
- Single WhatsApp account running inside one container
- Multiple WhatsApp account running inside one container
### Security
## Security
- API authentication
### Updates
## Updates
- Bug fixes and updates come as soon as they are implemented.
- One month delay in bug fixes and updates.
### Groups [soon]
## Groups [soon]
- Join groups by invite
- Get invite for group
- Modify group info (subject, description)
@@ -48,10 +72,139 @@
- Kick group participants
- Promote/demote group participants
### Contacts [soon]
## Contacts [soon]
- Mention users
- Mute/unmute chats
- Block/unblock contacts
- Get contact info
- Get profile pictures
- Set user status message
# Quick start
## Requirements
Only thing that you must have - installed docker. Please follow the original
instruction <a href="https://docs.docker.com/get-docker/" target="_blank" rel="noopener">how to install docker -></a>.
When you are ready - come back and follows the below steps to send the first text message to WhatsApp via HTTP API!
{{< details "Why Docker?" >}}
Docker makes it easy to ship all-in-one solution with the runtime and dependencies. You don't have to worry about
language-specific libraries or chrome installation.
Also Docker makes installation and update processes so simple, just one command!
{{< /details >}}
## Send your first message
Let's go over steps that allow you to send your first text message via WhatsApp HTTP API!
### 1. Download image
Assuming you have installed [Docker](https://docs.docker.com/get-docker/), let's download the image.
![](./docs/site/content/en/docs/overview/quick-start//images/versions/core.png) For Core version the command is
```bash
docker pull devlikeapro/whatsapp-http-api
```
![](./docs/site/content/en/docs/overview/quick-start//images/versions/plus.png) For Plus version, we use login to get the image before:
```bash
docker login -u devlikeapro -p {PASSWORD}
docker pull devlikeapro/whatsapp-http-api-plus
docker logout
```
Read more about how to get `PASSWORD` for [Plus Version →]({{< relref "plus-version" >}})
### 2. Run WhatsApp HTTP API
Run WhatsApp HTTP API:
```bash
docker run -it --rm -p 127.0.0.1:3000:3000/tcp --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
```
Open the link in your browser [http://localhost:3000/](http://localhost:3000/) and you'll see API documentation
(Swagger).
![](./docs/site/content/en/docs/overview/quick-start/swagger.png)
### 3. Start a new session
To start a new session you should have your mobile phone with installed WhatsApp application close to you.
Please go and read how what we'll need to a bit
later:
<a href="https://faq.whatsapp.com/381777293328336/?helpref=hc_fnav" target="_blank">
How to log in - the instruction on WhatsApp site
</a>
When your ready - find `POST /api/session/start`, click on **Try it out**, then **Execute** a bit below.
The example payload:
```json
{
"name": "default"
}
```
![](./docs/site/content/en/docs/overview/quick-start/session-start.png)
By using the request with `name` values you can start multiple session (WhatsApp accounts) inside the single docker container in Plus
![](./docs/site/content/en/docs/overview/quick-start//images/versions/plus.png) version and only one account in Core ![](./docs/site/content/en/docs/overview/quick-start//images/versions/core.png) version.
Read more about [multiple sessions →]({{< relref "/docs/how-to/sessions" >}})
### 4. Get and scan QR
Find `GET /api/screenshot` and execute it, it shows you QR code.
![](./docs/site/content/en/docs/overview/quick-start/qr.png)
**Scan the QR with your cell phone's WhatsApp app.**
![](./docs/site/content/en/docs/overview/quick-start/scan-qr-phone.png)
### 5. Get the screenshot
Execute `GET /api/screenshot` after a few seconds after scanning the QR - it'll show you the screenshot of you Whatsapp
instance. If you can get the actual screenshot - then you're ready to start sending messages!
![](./docs/site/content/en/docs/overview/quick-start/screenshot.png)
### 6. Send a text message
Let's send a text message - find `POST /api/sendText` in [swagger](http://localhost:3000/) and change `chatId` this
way: use a phone international phone number without `+` symbol and add `@c.us` at the end.
For phone number `12132132131` the `chatId` is `12132132131@c.us`.
The example payload:
```json
{
"chatId": "12132132130@c.us",
"text": "Hi there!",
"session": "default"
}
```
![](./docs/site/content/en/docs/overview/quick-start/send-text.png)
Also, you can use `curl` and send POST request like this:
```bash
# Phone without +
export PHONE=12132132130
curl -d "{\"chatId\": \"${PHONE}@c.us\", \"text\": \"Hello from WhatsApp HTTP API\" }" -H "Content-Type: application/json" -X POST http://localhost:3000/api/sendText
```
## What is next?
[Go and read the full documentation!](https://waha.devlike.pro/docs/overview/introduction/)
+1 -1
View File
@@ -1,4 +1,4 @@
baseurl = "https://doks-child-theme.netlify.app/"
baseurl = "https://waha.devlike.pro/"
canonifyURLs = false
disableAliases = true
disableHugoGeneratorInject = true
+3 -3
View File
@@ -71,10 +71,10 @@ footer = 'This project is not affiliated, associated, authorized, endorsed by, o
copyRight = "Copyright (c) 2021-2023 Dev Like A Pro"
# Alert
alert = false
alertDismissable = true
alert = true
alertDismissable = false
# alertText = "Introducing the Doks child theme, several DX + UX updates, and more! <a class=\"alert-link stretched-link\" href=\"https://getdoks.org/blog/doks-v0.2/\" target=\"_blank\" rel=\"noopener\">Check out Doks v0.2</a>"
alertText = "Introducing the Doks child theme, several DX + UX updates, and more! <a class=\"alert-link stretched-link\" href=\"https://getdoks.org/blog/doks-v0.2/\">Check out Doks v0.2</a>"
alertText = "Enjoy Core version or want to get WAHA Plus verison? You can <a class=\"alert-link stretched-link\" href=\"https://waha.devlike.pro/docs/how-to/plus-version/\">support the project -></a>"
# Edit Page
# repoHost [Github | Gitea | GitLab | Bitbucket | BitbucketServer ] is used for building the edit link based on git hoster
+1 -1
View File
@@ -4,7 +4,7 @@ description: "Examples for different languages."
lead: "Examples for different languages."
date: 2020-10-06T08:49:15+00:00
lastmod: 2020-10-06T08:49:15+00:00
draft: true
draft: false
images: []
weight: 900
---
+5 -3
View File
@@ -14,11 +14,13 @@ toc: true
---
## 2022.11
### Engine ![](/images/versions/core.png) ![](/images/versions/plus.png)
WAHA has changed its underlying engine from Venom to Whatsapp Web.JS. It might change the response and webhook's payloads.
**Please test changes in test environment before update production!!**
### Engine ![](/images/versions/core.png) ![](/images/versions/plus.png)
1. WAHA has changed its underlying engine from Venom to Whatsapp Web.JS. It might change the response and webhook's payloads.
2. Optimize CPU and memory consumption.
### Requests ![](/images/versions/core.png) ![](/images/versions/plus.png)
- For all `/api/session/` requests use `name` field instead of `sessionName`.
- For all "chatting" requests use `session` field instead of `sessionName`.
+11 -11
View File
@@ -7,21 +7,21 @@ lastmod: 2020-10-06T08:49:31+00:00
draft: false
images: []
menu:
docs:
parent: "help"
docs:
parent: "help"
weight: 630
toc: true
---
## How much CPU and Memory does WhatsApp HTTP API consume?
The benchmark has been made on **Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz**.
It may differ from case to case, it depends on usage pattern - how many messages you get, how many send, etc.
## How to build the newest Docker image locally
If the changes haven't been released yet from `main` branch - you can build your own version from the git repository
```bash
git clone https://github.com/devlikeapro/whatsapp-http-api.git
cd whatsapp-http-api
docker build . -t devlikeapro/whatsapp-http-api
```
| Accounts (sessions) in the container | CPU | Memory |
|--------------------------------------|------|--------|
| 1 | 30% | 400MB |
| 10 | 270% | 1.5GB |
The nature of WhatsApp HTTP API and its underlying engines - is to run **real** WhatsApp Web version in Chrome and
communicate with it to prevent blocking from WhatsApp. It's the reason why it's so demanding on resources.
@@ -24,6 +24,7 @@ docker run -it -e WHATSAPP_HOOK_EVENTS=* -e WHATSAPP_HOOK_URL=https://httpbin.or
- `WHATSAPP_API_HOSTNAME=localhost` - Hostname for HTTP server (default: `localhost`)
- `WHATSAPP_API_KEY=mysecret` - protect the api with a secret code. If you set it - add `X-Api-Key: mysecret` to all
requests.
- `WHATSAPP_SWAGGER_USERNAME=admin` + `WHATSAPP_SWAGGER_PASSWORD=admin` - protect the Swagger panel with `admin / admin` credentials. It doesn't affect api access!
- `WHATSAPP_START_SESSION=default` - start session with the name right after launching the app
-
@@ -0,0 +1,27 @@
---
title : "Engines"
description: "Engines"
lead: ""
date: 2020-10-06T08:48:45+00:00
lastmod: 2020-10-06T08:48:45+00:00
draft: false
images: []
weight: 700
---
Under the hood **WAHA** allows you to use two different engines. You can control what you want to run by settings
`WHATSAPP_DEFAULT_ENGINE` environment variables.
If you have any problems with one engine - try another!
{{< alert icon="👉" text="API responses and webhook payloads may differ significantly! We do our best to keep requests body stable between engines." />}}
## WhatsApp WebJS ![](/images/versions/core.png)
**WAHA** uses **WhatsApp WebJS** engine by default
- https://github.com/pedroslopez/whatsapp-web.js
- `WHATSAPP_DEFAULT_ENGINE=WEBJS`
## Venom ![](/images/versions/core.png)
- https://github.com/orkestral/venom
- `WHATSAPP_DEFAULT_ENGINE=VENOM`
@@ -9,28 +9,18 @@ images: []
weight: 900
---
## Overview
**WAHA** is distributed in two versions:
1. Core ![](/images/versions/core.png) the basic version that meet almost 80% people’s needs. 100% free and open source.
2. Plus ![](/images/versions/plus.png) the version with advanced messages, security, and reliability features.
Plus version - available through **donations** - either one time or subscription.
**If you enjoy Core ![](/images/versions/core.png) version and would like to support the project** - you can subscribe on Core level.
It's not expensive, but it supports the project a lot!
- [Boosty ->](https://boosty.to/wa-http-api)
- [Patreon ->](https://patreon.com/wa_http_api)
**It doesn't require monthly subscriptions, once installed on your server - it always works!**
{{< alert icon="💡" text="No licence checks or expiration on already installed instances!" />}}
## Donations
We do not sell **WAHA**, it's not a purchase. It's a donation.
We treat our projects like art. You donate to the project and get a bit more from it as a thank-you. 😊
Treat **WAHA Plus** it as an additional episode, behind-the-scenes videos, our nude photos 😊
{{< alert icon="💡" text="WAHA does not have license checks and expiration - because art can not expire! Enjoy it till it works!" />}}
We donate most of the donations down to the stream to the underlying libraries and tools - JS-community, Node, other libraries authors, personal contributors.
By donating to the **WAHA** you donate to the Open Source world!
## Features
@@ -56,11 +46,29 @@ What is the difference between **WAHA Plus** and other SaaS solutions for WhatsA
| **Security** | ✔️ No data leaks! | ➖ You have to give access to customers' data - phone number, name, your messages. |
| **License Term** | ✔️ No license checks! | ➖ One month |
| **Message price** | ✔️ All messages are Free! | ➖ Some solutions have a price for messages - $1/100 messages. |
| **Expenses** | ✔️ one-time $69 **donation**! | ➖ Monthly payment starts from $50 |
| **Expenses** | ✔️ one-time $19 **donation**! | ➖ Monthly payment starts from $50 |
## Donations
WAHA Plus version is available through **donations** - either one time or subscription.
**It doesn't require monthly subscriptions, once installed on your server - it always works!**
{{< alert icon="💡" text="No licence checks or expiration on already installed instances!" />}}
We do not sell **WAHA**, it's not a purchase. It's a donation.
We treat our projects like art. You donate to the project and get a bit more from it as a thank-you. 😊
Treat **WAHA Plus** it as an additional episode, behind-the-scenes videos, our nude photos 😊
{{< alert icon="💡" text="WAHA does not have license checks and expiration - because art can not expire! Enjoy it till it works!" />}}
We donate most of the donations down to the stream to the underlying libraries and tools - JS-community, Node, other libraries authors, personal contributors.
By donating to the **WAHA** you donate to the Open Source world!
## Get Plus ![](/images/versions/plus.png)
For $69 one-time donation you get:
For $19 one-time donation you get:
1. **Secret password** for Docker Hub to download Plus image: `devlikeapro/whatsapp-http-api-plus`.
2. **All updates for one month** for the Plus image.
3. **NO LICENSE CHECKS** on installed instances!
@@ -73,7 +81,7 @@ We use Boosty to get donations (Patreon analogue) - [https://boosty.to/wa-http-a
Go ahead and get your monthly password to get no license expiration WhatsApp HTTP API - either subscribe or use one time donation!
{{< alert icon="💡" text="If you stay subscribed - the donation amount will never change for you and always be $69 to get monthly updates!" />}}
{{< alert icon="💡" text="If you stay subscribed - the donation amount will never change for you and always be $19 to get monthly updates!" />}}
![](boosty.png)
@@ -37,10 +37,23 @@ Below the list of all events that WhatsApp HTTP API sends to your.
{{< alert icon="👉" text="If you want to look at a webhook body - use the url `https://httpbin.org/post`" />}}
Run the bellow command and see look at the logs - it prints body request for all events that happen in your WhatsApp!
```bash
docker run -it -e WHATSAPP_HOOK_EVENTS=* -e WHATSAPP_HOOK_URL=https://httpbin.org/post devlikeapro/whatsapp-http-api
```
### Examples
Here's few examples of how to handle webhook in different languages:
1. [Python guide]({{< relref "/docs/examples/python" >}})
**Do you use another language?**
Please create a short guide how to handle webhook and send message after you finish your setup!
You can create a pull request with your favorite language in the [GitHub, in examples folder](https://github.com/devlikeapro/whatsapp-http-api/tree/core/examples).
Just put the code and **README.md** file in the folder - we'll do the rest!
## Events ![](/images/versions/core.png) ![](/images/versions/plus.png)
@@ -179,4 +192,4 @@ To configure the url you can use environment variables `WHATSAPP_API_HOSTNAME` a
## Webhook retries ![](/images/versions/plus.png)
**WAHA** retries to reach your webhook URL 15 times and with 2 seconds.
**WAHA** retries to reach your webhook URL 15 times and with 2 seconds delay between attempts.
@@ -15,19 +15,35 @@ We do not recommend exposing the API on any public networks!
Either protect the API with [Api Key](https://www.fortinet.com/resources/cyberglossary/api-key) or deny access by using
firewalls.
## Swagger Security ![](/images/versions/plus.png)
If you want to hide the project Swagger panel under the password - run the following command to hide under `admin/admin`
login and password.
```bash
docker run -it -e WHATSAPP_SWAGGER_USERNAME=admin -eWHATSAPP_SWAGGER_PASSWORD=admin devlikeapro/whatsapp-http-api-plus
```
Open http://localhost:3000/ and enter `admin / admin` in the inputs:
![](swagger-basic-auth.png)
{{< alert icon="👉" text="Protecting Swagger under the password does not protect your API from other request! Use both techniques to protect your API and Swagger!" />}}
## API security ![](/images/versions/plus.png)
You can protect the API by requiring Api Key in a request's headers.
{{< alert icon="👉" text="Api Key does not hide your Swagger documentation. Please have a look at the previous section to find how to hide Swagger under the password." />}}
### Set Api Key
Set `WHATSAPP_API_KEY=yoursecretkey` environment variable for that:
```bash
docker run -it -e WHATSAPP_API_KEY=yoursecretkey devlikeapro/whatsapp-http-api
docker run -it -e WHATSAPP_API_KEY=yoursecretkey devlikeapro/whatsapp-http-api-plus
```
### Swagger
### Use Api-Key in Swagger
After you set api key - to authorize on swagger use **Authorize** button at the top:
![](swagger-auth.png)
@@ -49,5 +65,3 @@ headers = {
requests.get("http://localhost:3000/api/sessions", headers=headers)
```
## Swagger Security ![](/images/versions/plus-soon.png)
If you want to hide under a password the swagger UI - please create an issue on GitHub, we'll do it!
Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

@@ -58,7 +58,7 @@ Read more about how to get `PASSWORD` for [Plus Version →]({{< relref "plus-ve
Run WhatsApp HTTP API:
```bash
docker run -it --rm -v `pwd`/tokens:/app/tokens -p 127.0.0.1:3000:3000/tcp --name whatsapp-http-api devlikeapro/whatsapp-http-api
docker run -it --rm -p 127.0.0.1:3000:3000/tcp --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
-10
View File
@@ -1,10 +0,0 @@
---
title : "Modern documentatie-thema"
description: "Doks is een Hugo-thema waarmee je moderne documentatie-websites kunt bouwen die veilig, snel en klaar voor SEO zijn — standaard."
lead: "Doks is een Hugo-thema waarmee je moderne documentatie-websites kunt bouwen die veilig, snel en klaar voor SEO zijn — standaard."
date: 2020-10-06T08:47:36+00:00
lastmod: 2020-10-06T08:47:36+00:00
draft: false
images: []
---
-10
View File
@@ -1,10 +0,0 @@
---
title: "Contact"
description: "Drop us an email."
date: 2020-08-27T19:25:12+02:00
lastmod: 2020-08-27T19:25:12+02:00
draft: true
images: []
---
{{< email user="hello" domain="getdoks.org" >}}
@@ -1,10 +0,0 @@
---
title: "Contributors"
description: "The Doks contributors."
date: 2020-10-06T08:50:29+00:00
lastmod: 2020-10-06T08:50:29+00:00
draft: false
images: []
---
The Doks contributors.
@@ -1,12 +0,0 @@
---
title: "Henk Verlinde"
description: "Creator of Hyas."
date: 2020-10-06T08:50:45+00:00
lastmod: 2020-10-06T08:50:45+00:00
draft: false
images: []
---
Creator of Hyas.
[@HenkVerlinde](https://twitter.com/henkverlinde)
-9
View File
@@ -1,9 +0,0 @@
---
title : "Docs"
description: "Docs Doks."
lead: ""
date: 2020-10-06T08:48:23+00:00
lastmod: 2020-10-06T08:48:23+00:00
draft: false
images: []
---
-9
View File
@@ -1,9 +0,0 @@
---
title: "Help"
description: "Help Doks."
lead: ""
date: 2020-10-06T08:49:15+00:00
lastmod: 2020-10-06T08:49:15+00:00
draft: false
images: []
---
-50
View File
@@ -1,50 +0,0 @@
---
title: "FAQ"
description: "Answers to frequently asked questions."
lead: "Answers to frequently asked questions."
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
---
## Hyas?
Doks is a [Hyas theme](https://gethyas.com/themes/) build by the creator of Hyas.
## Footer notice?
Please keep it in place.
## Keyboard shortcuts for search?
- focus: `Ctrl + /`
- select: `↓` and `↑`
- open: `Enter`
- close: `Esc`
## Other documentation?
- [Netlify](https://docs.netlify.com/)
- [Hugo](https://gohugo.io/documentation/)
## Can I get support?
Create a topic:
- [Netlify Community](https://community.netlify.com/)
- [Hugo Forums](https://discourse.gohugo.io/)
- [Doks Discussions](https://github.com/h-enk/doks/discussions)
## Contact the creator?
Send `h-enk` a message:
- [Netlify Community](https://community.netlify.com/)
- [Hugo Forums](https://discourse.gohugo.io/)
- [Doks Discussions](https://github.com/h-enk/doks/discussions)
@@ -1,32 +0,0 @@
---
title: "How to Update"
description: "Regularly update the installed npm packages to keep your Doks website stable, usable, and secure."
lead: "Regularly update the installed npm packages to keep your Doks website stable, usable, and secure."
date: 2020-11-12T13:26:54+01:00
lastmod: 2020-11-12T13:26:54+01:00
draft: false
images: []
menu:
docs:
parent: "help"
weight: 610
toc: true
---
{{< alert icon="💡" text="Learn more about <a href=\"https://docs.npmjs.com/about-semantic-versioning\">semantic versioning</a> and <a href=\"https://docs.npmjs.com/cli/v6/using-npm/semver#advanced-range-syntax\">advanced range syntax</a>." />}}
## Check for outdated packages
The [`npm outdated`](https://docs.npmjs.com/cli/v7/commands/npm-outdated) command will check the registry to see if any (or, specific) installed packages are currently outdated:
```bash
npm outdated [[<@scope>/]<pkg> ...]
```
## Update packages
The [`npm update`](https://docs.npmjs.com/cli/v7/commands/npm-update) command will update all the packages listed to the latest version (specified by the tag config), respecting semver:
```bash
npm update [<pkg>...]
```
@@ -1,30 +0,0 @@
---
title: "Troubleshooting"
description: "Solutions to common problems."
lead: "Solutions to common problems."
date: 2020-11-12T15:22:20+01:00
lastmod: 2020-11-12T15:22:20+01:00
draft: false
images: []
menu:
docs:
parent: "help"
weight: 620
toc: true
---
## Problems updating npm packages
Delete the `./node_modules` folder, and run again:
```bash
npm install
```
## Problems with cache
Delete the temporary directories:
```bash
npm run clean
```
@@ -1,9 +0,0 @@
---
title : "Overview"
description: "Overview Doks."
lead: ""
date: 2020-10-06T08:48:45+00:00
lastmod: 2020-10-06T08:48:45+00:00
draft: false
images: []
---
@@ -1,98 +0,0 @@
---
title: "Commands"
description: "Doks comes with commands for common tasks."
lead: "Doks comes with commands for common tasks."
date: 2020-10-13T15:21:01+02:00
lastmod: 2020-10-13T15:21:01+02:00
draft: false
images: []
menu:
docs:
parent: "overview"
weight: 130
toc: true
---
{{< alert icon="💡" text="You can change the commands in the scripts section of `./package.json`." />}}
## create
Create new content for your site:
```bash
npm run create [path] [flags]
```
See also the Hugo docs: [hugo new](https://gohugo.io/commands/hugo_new/).
## lint
Check scripts, styles, and markdown for errors:
```bash
npm run lint
```
### scripts
Check scripts for errors:
```bash
npm run lint:scripts [-- --fix]
```
### styles
Check styles for errors:
```bash
npm run lint:styles [-- --fix]
```
### markdown
Check markdown for errors:
```bash
npm run lint:markdown [-- --fix]
```
## clean
Delete temporary directories:
```bash
npm run clean
```
## start
Start local development server:
```bash
npm run start
```
## build
Build production website:
```bash
npm run build
```
### functions
Build Lambda functions:
```bash
npm run build:functions
```
### preview
Build production website including draft and future content:
```bash
npm run build:preview
```
@@ -1,58 +0,0 @@
---
title: "Introduction"
description: "Doks is a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default."
lead: "Doks is a Hugo theme helping you build modern documentation websites that are secure, fast, and SEO-ready — by default."
date: 2020-10-06T08:48:57+00:00
lastmod: 2020-10-06T08:48:57+00:00
draft: false
images: []
menu:
docs:
parent: "overview"
weight: 100
toc: true
---
## Get started
There are two main ways to get started with Doks:
### Tutorial
{{< alert icon="👉" text="The Tutorial is intended for novice to intermediate users." />}}
Step-by-step instructions on how to start a new Doks project. [Tutorial →](https://getdoks.org/tutorial/introduction/)
### Quick Start
{{< alert icon="👉" text="The Quick Start is intended for intermediate to advanced users." />}}
One page summary of how to start a new Doks project. [Quick Start →]({{< relref "quick-start" >}})
## Go further
Recipes, Reference Guides, Extensions, and Showcase.
### Recipes
Get instructions on how to accomplish common tasks with Doks. [Recipes →](https://getdoks.org/docs/recipes/project-configuration/)
### Reference Guides
Learn how to customize Doks to fully make it your own. [Reference Guides →](https://getdoks.org/docs/reference-guides/security/)
### Extensions
Get instructions on how to add even more to Doks. [Extensions →](https://getdoks.org/docs/extensions/breadcrumb-navigation/)
### Showcase
See what others have build with Doks. [Showcase →](https://getdoks.org/showcase/electric-blocks/)
## Contributing
Find out how to contribute to Doks. [Contributing →](https://getdoks.org/docs/contributing/how-to-contribute/)
## Help
Get help on Doks. [Help →]({{< relref "how-to-update" >}})
@@ -1,69 +0,0 @@
---
title: "Quick Start"
description: "One page summary of how to start a new Doks project."
lead: "One page summary of how to start a new Doks project."
date: 2020-11-16T13:59:39+01:00
lastmod: 2020-11-16T13:59:39+01:00
draft: false
images: []
menu:
docs:
parent: "overview"
weight: 110
toc: true
---
## Requirements
Doks uses npm to centralize dependency management, making it [easy to update]({{< relref "how-to-update" >}}) resources, build tooling, plugins, and build scripts:
- Download and install [Node.js](https://nodejs.org/) (it includes npm) for your platform.
## Start a new Doks project
Create a new site, change directories, install dependencies, and start development server.
### Create a new site
Doks is available as a child theme, and a starter theme:
- Use the Doks child theme, if you do __not__ plan to customize a lot, and/or need future Doks updates.
- Use the Doks starter theme, if you plan to customize a lot, and/or do __not__ need future Doks updates.
Not quite sure? Use the Doks child theme.
#### Doks child theme
```bash
git clone https://github.com/h-enk/doks-child-theme.git my-doks-site
```
#### Doks starter theme
```bash
git clone https://github.com/h-enk/doks.git my-doks-site
```
### Change directories
```bash
cd my-doks-site
```
### Install dependencies
```bash
npm install
```
### Start development server
```bash
npm run start
```
Doks will start the Hugo development webserver accessible by default at `http://localhost:1313`. Saved changes will live reload in the browser.
## Other commands
Doks comes with commands for common tasks. [Commands →]({{< relref "commands" >}})
@@ -1,36 +0,0 @@
---
title: "Privacy Policy"
description: "We do not use cookies and we do not collect any personal data."
date: 2020-08-27T19:23:18+02:00
lastmod: 2020-08-27T19:23:18+02:00
draft: true
images: []
---
__TLDR__: We do not use cookies and we do not collect any personal data.
## Website visitors
- No personal information is collected.
- No information is stored in the browser.
- No information is shared with, sent to or sold to third-parties.
- No information is shared with advertising companies.
- No information is mined and harvested for personal and behavioral trends.
- No information is monetized.
### Information we collect and what we use it for
We run [Plausible](https://plausible.io/) analytics on getdoks.org. The following information is collected:
- __Page URL__. We track the page URL of each page view on this website. We use this to understand which pages have been viewed and how many times a particular page has been viewed. For example: _https://getdoks.org/_.
- __HTTP Referrer__. We use the referrer string to understand the number of visitors referred to this website from links on other sites. For example: _https://github.com/_.
- __Browser__. We use this to understand what browsers people use when visiting this website. This is derived from the User-Agent HTTP header. The full User-Agent is discarded. For example: _Chrome_.
- __Operating system__. We use this to understand what operating systems people use when visiting this website. We only use the brand of the operating system and don’t include the version number or any other details. This is derived from the User-Agent HTTP header. The full User-Agent is discarded. For example: _GNU/Linux_.
- __Device type__. We use this to understand what devices people use when visiting this website. This is derived from window.innerWidth. The actual width of the browser in pixels is discarded. For example: _Desktop_.
- __Visitor Country__. We look up the visitor’s country using the IP address. We do not track anything more granular than the country of origin and the IP address of the visitor is discarded. We never store IP addresses in our database or logs. For example: _Canada_.
## Contact us
[Contact us]({{< relref "contact/index.md" >}}) if you have any questions.
Effective Date: _27th August 2020_
+3 -3
View File
@@ -34,7 +34,7 @@
</div>
<div class="col-lg-5">
<h2 class="h4">Well documented</h2>
<p>Documentation has a lof examples and how to guide.</p>
<p>Documentation has a lof examples and how-to guides.</p>
</div>
<div class="col-lg-5">
<h2 class="h4">No blocking</h2>
@@ -69,9 +69,9 @@
<div class="col-lg-5">
<h2 class="h4">It's free!</h2>
<p>
<img src="/images/versions/core.png"> version is always free!
<b>WAHA Core</b> version is always free!
<br>
Even <img src="/images/versions/plus.png"> version does not require monthly donations and have no licence expiration!
Even <b>WAHA Plus</b> version does not require monthly donations and have no licence expiration!
</p>
</div>
</div>
@@ -1 +1,17 @@
<!-- Custom head -->
<!-- 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");
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>
<!-- /Yandex.Metrika counter -->
+1 -1
View File
@@ -1 +1 @@
{"openapi":"3.0.0","paths":{"/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","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStopRequest"}}}},"responses":{"201":{"description":""}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions":{"get":{"operationId":"SessionsController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SessionDTO"}}}}}},"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":"sessionName","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":"","content":{"application/json":{"schema":{"type":"object"}}}}},"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":"sessionName","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,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageTextRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WAMessage"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendTextButtons":{"post":{"operationId":"ChattingController_sendTextButtons","summary":"Send a text message with buttons","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageTextButtonsRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendLocation":{"post":{"operationId":"ChattingController_sendLocation","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageLocationRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendLinkPreview":{"post":{"operationId":"ChattingController_sendLinkPreview","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageLinkPreviewRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendImage":{"post":{"operationId":"ChattingController_sendImage","summary":"Send an image. Either from an URL or base64 data - look at the request schemas for details.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageImageRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendFile":{"post":{"operationId":"ChattingController_sendFile","summary":"Send a file. Either from an URL or base64 data - look at the request schemas for details.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageFileRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendVoice":{"post":{"operationId":"ChattingController_sendVoice","summary":"Send an voice message. Either from an URL or base64 data - look at the request schemas for details.","parametersLine truncated
{"openapi":"3.0.0","paths":{"/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","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionStopRequest"}}}},"responses":{"201":{"description":""}},"tags":["sessions"],"security":[{"api_key":[]}]}},"/api/sessions":{"get":{"operationId":"SessionsController_list","parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SessionDTO"}}}}}},"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":"","content":{"application/json":{"schema":{"type":"object"}}}}},"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,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageTextRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WAMessage"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendTextButtons":{"post":{"operationId":"ChattingController_sendTextButtons","summary":"Send a text message with buttons","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageTextButtonsRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendLocation":{"post":{"operationId":"ChattingController_sendLocation","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageLocationRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendLinkPreview":{"post":{"operationId":"ChattingController_sendLinkPreview","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageLinkPreviewRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendImage":{"post":{"operationId":"ChattingController_sendImage","summary":"Send an image. Either from an URL or base64 data - look at the request schemas for details.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageImageRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendFile":{"post":{"operationId":"ChattingController_sendFile","summary":"Send a file. Either from an URL or base64 data - look at the request schemas for details.","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageFileRequest"}}}},"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object"}}}}},"tags":["chatting"],"security":[{"api_key":[]}]}},"/api/sendVoice":{"post":{"operationId":"ChattingController_sendVoice","summary":"Send an voice message. Either from an URL or basLine truncated
+378 -250
View File
File diff suppressed because it is too large. Load diff
+3 -2
View File
@@ -31,6 +31,7 @@
"@nestjs/swagger": "^6.0.5",
"class-validator": "^0.12.2",
"del": "^6.0.0",
"express-basic-auth": "^1.2.1",
"mime-types": "^2.1.27",
"passport": "^0.6.0",
"passport-headerapikey": "^1.2.2",
@@ -41,8 +42,8 @@
"rimraf": "^3.0.2",
"rxjs": "^7.1.0",
"swagger-ui-express": "^4.1.4",
"venom-bot": "^4.3.0",
"whatsapp-web.js": "github:mrfelipemartins/whatsapp-web.js#fix-group-module"
"venom-bot": "^4.3.7",
"whatsapp-web.js": "^1.18.4"
},
"devDependencies": {
"@nestjs/cli": "^9.0.0",
+3 -3
View File
@@ -28,7 +28,7 @@ export class ChattingController {
@Get('/checkNumberStatus')
@ApiOperation({summary: 'Check number status'})
async checkNumberStatus(@Query() request: CheckNumberStatusQuery): Promise<WANumberExistResult> {
const whatsapp = this.manager.getSession(request.sessionName)
const whatsapp = this.manager.getSession(request.session)
return whatsapp.checkNumberStatus(request)
}
@@ -43,11 +43,11 @@ export class ChattingController {
sendTextGet(
@Query() query: MessageTextQuery,
) {
const whatsapp = this.manager.getSession(query.sessionName)
const whatsapp = this.manager.getSession(query.session)
const msg = new MessageTextRequest()
msg.chatId = query.phone
msg.text = query.text
return whatsapp.sendText(new MessageTextRequest())
return whatsapp.sendText(msg)
}
@Post('/sendText')
+1 -1
View File
@@ -18,7 +18,7 @@ export class ScreenshotController {
@Res() res: Response,
@Query() sessionQuery: SessionQuery,
) {
const whatsappService = this.manager.getSession(sessionQuery.sessionName)
const whatsappService = this.manager.getSession(sessionQuery.session)
const buffer = await whatsappService.getScreenshot();
const stream = new Readable();
stream.push(buffer);
+11
View File
@@ -76,4 +76,15 @@ export class WhatsappConfigService {
getApiKey(): string | undefined {
return this.configService.get("WHATSAPP_API_KEY", "")
}
getSwaggerUsernamePassword(): [string, string] | undefined {
const user = this.configService.get("WHATSAPP_SWAGGER_USERNAME", undefined)
const password = this.configService.get("WHATSAPP_SWAGGER_PASSWORD", undefined)
if (!user && !password) {
console.log("Please set up both WHATSAPP_SWAGGER_USERNAME and WHATSAPP_SWAGGER_PASSWORD " +
"to enable swagger authentication.")
return undefined
}
return [user, password]
}
}
+34
View File
@@ -26,6 +26,40 @@ export abstract class WhatsappSession {
this.log = log
}
getBrowserExecutablePath(){
return "/usr/bin/google-chrome-stable"
}
getBrowserArgsForPuppeteer() {
// Run optimized version of Chrome
// References:
// https://github.com/pedroslopez/whatsapp-web.js/issues/1420
// https://www.bannerbear.com/blog/ways-to-speed-up-puppeteer-screenshots/
return [
'--no-sandbox',
'--disable-client-side-phishing-detection',
'--disable-setuid-sandbox',
'--disable-component-update',
'--disable-default-apps',
'--disable-popup-blocking',
'--disable-offer-store-unmasked-wallet-cards',
'--disable-speech-api',
'--hide-scrollbars',
'--mute-audio',
'--disable-extensions',
'--disable-dev-shm-usage',
'--disable-accelerated-2d-canvas',
'--no-first-run',
'--no-default-browser-check',
'--no-pings',
'--password-store=basic',
'--use-mock-keychain',
'--no-zygote',
'--single-process',
'--disable-gpu'
]
}
/** Start the session */
abstract start()
+36 -30
View File
@@ -43,31 +43,38 @@ export class WhatsappSessionVenomCore extends WhatsappSession {
this.qr = new QR()
}
protected buildClient() {
return create(this.name,
this.getCatchQR(),
undefined,
{
headless: true,
devtools: false,
useChrome: true,
debug: false,
logQR: true,
browserArgs: this.getBrowserArgsForPuppeteer(),
autoClose: 60000,
puppeteerOptions: {},
multidevice: true,
}
)
}
protected getCatchQR() {
return (base64Qrimg, asciiQR, attempts, urlCode) => {
this.qr.save(base64Qrimg)
this.status = WhatsappStatus.SCAN_QR_CODE
this.log.debug('Number of attempts to read the qrcode: ', attempts);
this.log.log('Terminal qrcode:');
// Log QR image in console without this.log to make it pretty
console.log(asciiQR);
};
}
async start() {
try {
this.whatsapp = await create('sessionName',
(base64Qrimg, asciiQR, attempts, urlCode) => {
this.qr.save(base64Qrimg)
this.status = WhatsappStatus.SCAN_QR_CODE
this.log.debug('Number of attempts to read the qrcode: ', attempts);
this.log.log('Terminal qrcode:');
// Log QR image in console without this.log to make it pretty
console.log(asciiQR);
},
undefined,
{
headless: true,
devtools: false,
useChrome: true,
debug: false,
logQR: true,
browserArgs: ["--no-sandbox"],
autoClose: 60000,
createPathFileToken: true,
puppeteerOptions: {},
multidevice: false,
}
)
this.whatsapp = await this.buildClient()
} catch (error) {
this.status = WhatsappStatus.FAILED
this.log.error(error)
@@ -118,14 +125,13 @@ export class WhatsappSessionVenomCore extends WhatsappSession {
async checkNumberStatus(request: CheckNumberStatusQuery): Promise<WANumberExistResult> {
try {
const result = await this.whatsapp.checkNumberStatus(this.ensureSuffix(request.phone))
return {numberExists: result['numberExists']}
return await this.whatsapp.checkNumberStatus(this.ensureSuffix(request.phone))
} catch (error) {
// We need to "touch" the error in order to get unhandled rejections
// It logs out the session and stop the app
console.log(typeof error)
console.log(error)
return {numberExists: false}
// Catch number doesn't exist error and return it as is
if (error.status === 404 && !error.numberExists){
return error
}
throw error
}
}
+6 -6
View File
@@ -31,8 +31,8 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
return new Client({
puppeteer: {
headless: true,
executablePath: "/usr/bin/google-chrome-stable",
args: ['--no-sandbox', '--disable-setuid-sandbox'],
executablePath: this.getBrowserExecutablePath(),
args: this.getBrowserArgsForPuppeteer(),
}
});
}
@@ -77,13 +77,13 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
throw new NotImplementedByEngineError()
}
sendText(request: MessageTextRequest): Promise<WAMessage> {
return this.whatsapp.sendMessage(this.ensureSuffix(request.chatId), request.text).then(this.toWAMessage)
sendText(request: MessageTextRequest) {
return this.whatsapp.sendMessage(this.ensureSuffix(request.chatId), request.text)
}
sendTextButtons(request: MessageTextButtonsRequest) {
const message = new Buttons("", request.buttons, request.title, request.text)
return this.whatsapp.sendMessage(this.ensureSuffix(request.chatId), message).then(this.toWAMessage)
return this.whatsapp.sendMessage(this.ensureSuffix(request.chatId), message)
}
sendContactVCard(request: MessageContactVcardRequest) {
@@ -94,7 +94,7 @@ export class WhatsappSessionWebJSCore extends WhatsappSession {
const options = {
quotedMessageId: request.reply_to,
};
return this.whatsapp.sendMessage(request.chatId, request.text, options).then(this.toWAMessage)
return this.whatsapp.sendMessage(request.chatId, request.text, options)
}
sendImage(request: MessageImageRequest) {
+33
View File
@@ -0,0 +1,33 @@
import {DocumentBuilder, SwaggerModule} from "@nestjs/swagger";
import {INestApplication} from "@nestjs/common";
import {VERSION} from "../version";
export class SwaggerModuleCore {
configure(app: INestApplication){
this.setUpAuth(app)
const options = new DocumentBuilder()
.setTitle('WAHA - WhatsApp HTTP API')
.setDescription('WhatsApp HTTP API that you can configure in a click!')
.setExternalDoc("Documentation", "https://waha.devlike.pro/")
.setVersion(VERSION.version)
.addTag('sessions', 'Control your WhatsApp sessions')
.addTag('screenshot', 'Get screenshot of WhatsApp and show QR code')
.addTag('chatting', 'Chat methods')
.addTag('other', 'Other endpoints')
.addApiKey({
type: 'apiKey',
description: 'Your secret api key',
name: 'X-Api-Key'
}
)
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('', app, document);
}
protected setUpAuth(app: INestApplication) {
return undefined
}
}
+13 -23
View File
@@ -1,25 +1,29 @@
import {NestFactory} from '@nestjs/core';
import {DocumentBuilder, SwaggerModule} from "@nestjs/swagger";
import {WhatsappConfigService} from "./config.service";
import {AllExceptionsFilter} from "./api/exception.filter";
import {getWAHAVersion, VERSION, WAHAVersion} from "./version";
import {AppModuleCore} from "./core/app.module.core";
import {SwaggerModuleCore} from "./core/swagger.module.core";
async function getAppModule() {
async function loadModules(): Promise<[typeof AppModuleCore, typeof SwaggerModuleCore]> {
const version = getWAHAVersion()
console.log(`WAHA (WhatsApp HTTP API) - Running ${version} version...`)
if (version === WAHAVersion.CORE) {
const {AppModuleCore} = await import("./core/app.module.core")
return AppModuleCore
const {SwaggerModuleCore} = await import("./core/swagger.module.core")
return [AppModuleCore, SwaggerModuleCore]
}
// Ignore if it's core version - there's no plus module
// @ts-ignore
const {AppModulePlus} = await import("./plus/app.module.plus")
return AppModulePlus
// @ts-ignore
const {SwaggerModulePlus} = await import("./plus/swagger.module.plus")
return [AppModulePlus, SwaggerModulePlus]
}
async function bootstrap() {
const AppModule = await getAppModule()
const [AppModule, SwaggerModule] = await loadModules()
const app = await NestFactory.create(AppModule, {
logger: process.env.DEBUG != undefined ? ['log', 'debug', 'error', 'verbose', 'warn'] :
['log', 'error', 'warn'],
@@ -27,24 +31,10 @@ async function bootstrap() {
app.enableShutdownHooks();
app.useGlobalFilters(new AllExceptionsFilter());
const options = new DocumentBuilder()
.setTitle('WAHA - WhatsApp HTTP API')
.setDescription('WhatsApp HTTP API that you can configure in a click!')
.setExternalDoc("Documentation", "https://waha.devlike.pro/")
.setVersion(VERSION.version)
.addTag('sessions', 'Control your WhatsApp sessions')
.addTag('screenshot', 'Get screenshot of WhatsApp and show QR code')
.addTag('chatting', 'Chat methods')
.addTag('other', 'Other endpoints')
.addApiKey({
type: 'apiKey',
description: 'Your secret api key',
name: 'X-Api-Key'
}
)
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('', app, document);
// Configure swagger
const swagger = new SwaggerModule()
swagger.configure(app)
const config = app.get(WhatsappConfigService);
await app.listen(config.port);
+2 -2
View File
@@ -9,7 +9,7 @@ export const WHATSAPP_DEFAULT_SESSION_NAME = "default"
*/
export class SessionQuery {
@IsNotEmpty()
sessionName: string = WHATSAPP_DEFAULT_SESSION_NAME;
session: string = WHATSAPP_DEFAULT_SESSION_NAME;
}
export class CheckNumberStatusQuery extends SessionQuery {
@@ -21,7 +21,7 @@ export class MessageTextQuery extends SessionQuery {
@IsString()
phone: string
@IsString()
text = "Hi there!"
text: string
}
+1 -1
View File
@@ -24,4 +24,4 @@ export function getWAHAVersion(): WAHAVersion {
return WAHAVersion.CORE
}
export const VERSION = {version: "2022.11.11", tier: getWAHAVersion()}
export const VERSION = {version: "2022.12.11", tier: getWAHAVersion()}