Fix port
Browse files- Makefile +1 -1
- docs/site/content/en/docs/examples/kotlin/index.md +3 -3
- docs/site/content/en/docs/examples/python/index.md +3 -3
- docs/site/content/en/docs/how-to/config/index.md +1 -1
- docs/site/content/en/docs/how-to/deploy/index.md +1 -1
- docs/site/content/en/docs/how-to/install/index.md +6 -6
- docs/site/content/en/docs/how-to/receive-messages/index.md +4 -4
- docs/site/content/en/docs/how-to/security/index.md +2 -2
- docs/site/content/en/docs/how-to/storages/index.md +2 -2
- docs/site/content/en/docs/how-to/webhooks/index.md +1 -1
- docs/site/content/en/docs/overview/changelog.md +1 -1
- docs/site/content/en/docs/overview/quick-start/index.md +5 -5
- docs/site/layouts/index.html +1 -1
- docs/site/static/swagger/openapi.json +0 -0
- docs/site/static/swagger/swagger-ui-bundle.js +0 -0
- docs/site/static/swagger/swagger-ui-es-bundle.js +0 -0
- docs/site/static/swagger/swagger-ui-standalone-preset.js +0 -0
- examples/python/README.md +3 -3
- examples/python/whatsapp_download_files_bot.py +2 -2
- examples/python/whatsapp_echo_bot.py +5 -5
- src/config.service.ts +2 -2
- src/structures/responses.dto.ts +2 -2
Makefile
CHANGED
|
@@ -32,7 +32,7 @@ for-swagger:
|
|
| 32 |
WHATSAPP_SWAGGER_CONFIG_ADVANCED=true npm run start
|
| 33 |
|
| 34 |
update-swagger:
|
| 35 |
-
wget http://localhost:
|
| 36 |
|
| 37 |
update-dependencies:
|
| 38 |
. ${NVM_DIR}/nvm.sh && nvm exec yarn up whatsapp-web.js@https://github.com/devlikeapro/whatsapp-web.js#main-fork
|
|
|
|
| 32 |
WHATSAPP_SWAGGER_CONFIG_ADVANCED=true npm run start
|
| 33 |
|
| 34 |
update-swagger:
|
| 35 |
+
wget http://localhost:7860/-json -O ./docs/site/static/swagger/openapi.json
|
| 36 |
|
| 37 |
update-dependencies:
|
| 38 |
. ${NVM_DIR}/nvm.sh && nvm exec yarn up whatsapp-web.js@https://github.com/devlikeapro/whatsapp-web.js#main-fork
|
docs/site/content/en/docs/examples/kotlin/index.md
CHANGED
|
@@ -44,7 +44,7 @@ docker pull devlikeapro/whatsapp-http-api
|
|
| 44 |
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
|
| 45 |
|
| 46 |
# It prints logs and the last line must be
|
| 47 |
-
# WhatsApp HTTP API is running on: http://[::1]:
|
| 48 |
```
|
| 49 |
|
| 50 |
#### Download image - ARM
|
|
@@ -63,12 +63,12 @@ docker tag devlikeapro/whatsapp-http-api:arm devlikeapro/whatsapp-http-api
|
|
| 63 |
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
|
| 64 |
|
| 65 |
# It prints logs and the last line must be
|
| 66 |
-
# WhatsApp HTTP API is running on: http://[::1]:
|
| 67 |
```
|
| 68 |
|
| 69 |
### Start session and scan QR
|
| 70 |
|
| 71 |
-
2. Open Swagger API in the browser http://localhost:
|
| 72 |
3. Start session and scan QR code in swagger
|
| 73 |
1. Find `POST /api/session/start` request press **Try it out** and
|
| 74 |
**Execute** it with `default` session name
|
|
|
|
| 44 |
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
|
| 45 |
|
| 46 |
# It prints logs and the last line must be
|
| 47 |
+
# WhatsApp HTTP API is running on: http://[::1]:7860
|
| 48 |
```
|
| 49 |
|
| 50 |
#### Download image - ARM
|
|
|
|
| 63 |
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
|
| 64 |
|
| 65 |
# It prints logs and the last line must be
|
| 66 |
+
# WhatsApp HTTP API is running on: http://[::1]:7860
|
| 67 |
```
|
| 68 |
|
| 69 |
### Start session and scan QR
|
| 70 |
|
| 71 |
+
2. Open Swagger API in the browser http://localhost:7860/
|
| 72 |
3. Start session and scan QR code in swagger
|
| 73 |
1. Find `POST /api/session/start` request press **Try it out** and
|
| 74 |
**Execute** it with `default` session name
|
docs/site/content/en/docs/examples/python/index.md
CHANGED
|
@@ -43,7 +43,7 @@ docker pull devlikeapro/whatsapp-http-api
|
|
| 43 |
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
|
| 44 |
|
| 45 |
# It prints logs and the last line must be
|
| 46 |
-
# WhatsApp HTTP API is running on: http://[::1]:
|
| 47 |
```
|
| 48 |
|
| 49 |
#### Download image - ARM
|
|
@@ -62,12 +62,12 @@ docker tag devlikeapro/whatsapp-http-api:arm devlikeapro/whatsapp-http-api
|
|
| 62 |
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
|
| 63 |
|
| 64 |
# It prints logs and the last line must be
|
| 65 |
-
# WhatsApp HTTP API is running on: http://[::1]:
|
| 66 |
```
|
| 67 |
|
| 68 |
### Start session and scan QR
|
| 69 |
|
| 70 |
-
2. Open Swagger API in the browser http://localhost:
|
| 71 |
3. Start session and scan QR code in swagger
|
| 72 |
1. Find `POST /api/session/start` request press **Try it out** and
|
| 73 |
**Execute** it with `default` session name
|
|
|
|
| 43 |
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
|
| 44 |
|
| 45 |
# It prints logs and the last line must be
|
| 46 |
+
# WhatsApp HTTP API is running on: http://[::1]:7860
|
| 47 |
```
|
| 48 |
|
| 49 |
#### Download image - ARM
|
|
|
|
| 62 |
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
|
| 63 |
|
| 64 |
# It prints logs and the last line must be
|
| 65 |
+
# WhatsApp HTTP API is running on: http://[::1]:7860
|
| 66 |
```
|
| 67 |
|
| 68 |
### Start session and scan QR
|
| 69 |
|
| 70 |
+
2. Open Swagger API in the browser http://localhost:7860/
|
| 71 |
3. Start session and scan QR code in swagger
|
| 72 |
1. Find `POST /api/session/start` request press **Try it out** and
|
| 73 |
**Execute** it with `default` session name
|
docs/site/content/en/docs/how-to/config/index.md
CHANGED
|
@@ -27,7 +27,7 @@ The following environment variables can be used to configure the WAHA.
|
|
| 27 |
### Common
|
| 28 |
- `DEBUG=1`: Set this variable to any value to enable debug and verbose logs.
|
| 29 |
- You can also do it for a **specific session** by setting `config.debug` field to `true` when starting a session.
|
| 30 |
-
- `WHATSAPP_API_PORT=
|
| 31 |
- `WHATSAPP_API_HOSTNAME=localhost`: The hostname for the HTTP server. The default value is `localhost`.
|
| 32 |
|
| 33 |
### Sessions
|
|
|
|
| 27 |
### Common
|
| 28 |
- `DEBUG=1`: Set this variable to any value to enable debug and verbose logs.
|
| 29 |
- You can also do it for a **specific session** by setting `config.debug` field to `true` when starting a session.
|
| 30 |
+
- `WHATSAPP_API_PORT=7860`: The port number that the HTTP server will listen on. The default value is `7860`.
|
| 31 |
- `WHATSAPP_API_HOSTNAME=localhost`: The hostname for the HTTP server. The default value is `localhost`.
|
| 32 |
|
| 33 |
### Sessions
|
docs/site/content/en/docs/how-to/deploy/index.md
CHANGED
|
@@ -42,7 +42,7 @@ To start the `whatsapp-http-api` service, run the following command:
|
|
| 42 |
docker-compose up -d whatsapp-http-api
|
| 43 |
```
|
| 44 |
|
| 45 |
-
This will start the container in detached mode and map port
|
| 46 |
|
| 47 |
To stop the service, run the command:
|
| 48 |
|
|
|
|
| 42 |
docker-compose up -d whatsapp-http-api
|
| 43 |
```
|
| 44 |
|
| 45 |
+
This will start the container in detached mode and map port 7860 to 7860 on the host machine.
|
| 46 |
|
| 47 |
To stop the service, run the command:
|
| 48 |
|
docs/site/content/en/docs/how-to/install/index.md
CHANGED
|
@@ -38,10 +38,10 @@ docker pull devlikeapro/whatsapp-http-api
|
|
| 38 |
|
| 39 |
Run the container:
|
| 40 |
```bash
|
| 41 |
-
docker run -it -p
|
| 42 |
```
|
| 43 |
|
| 44 |
-
Open API documentation [http://localhost:
|
| 45 |
|
| 46 |
## WAHA Plus
|
| 47 |
Before installing WAHA Plus version you need to get a key, `{KEY}` in below commands, in format `dckr_pat_1111`
|
|
@@ -63,10 +63,10 @@ docker logout
|
|
| 63 |
|
| 64 |
Run the container:
|
| 65 |
```bash
|
| 66 |
-
docker run -it -p
|
| 67 |
```
|
| 68 |
|
| 69 |
-
Open API documentation [http://localhost:
|
| 70 |
|
| 71 |
## ARM
|
| 72 |
If you’re using **ARM** processor (like Apple Silicon, Apple M1, etc.) - add `:arm` tag at the end of the image name in the above commands.
|
|
@@ -97,7 +97,7 @@ docker pull devlikeapro/whatsapp-http-api
|
|
| 97 |
# Restart all containers
|
| 98 |
docker stop whatsapp-http-api
|
| 99 |
docker rm whatsapp-http-api
|
| 100 |
-
docker run -it --rm -p
|
| 101 |
```
|
| 102 |
|
| 103 |
**WAHA Plus** - download new image (please use **the latest key** from Boosty or Patreon)
|
|
@@ -111,5 +111,5 @@ docker stop whatsapp-http-api
|
|
| 111 |
# Restart all containers
|
| 112 |
docker stop whatsapp-http-api
|
| 113 |
docker rm whatsapp-http-api
|
| 114 |
-
docker run -it --rm -p
|
| 115 |
```
|
|
|
|
| 38 |
|
| 39 |
Run the container:
|
| 40 |
```bash
|
| 41 |
+
docker run -it -p 7860:7860/tcp devlikeapro/whatsapp-http-api
|
| 42 |
```
|
| 43 |
|
| 44 |
+
Open API documentation [http://localhost:7860](http://localhost:7860).
|
| 45 |
|
| 46 |
## WAHA Plus
|
| 47 |
Before installing WAHA Plus version you need to get a key, `{KEY}` in below commands, in format `dckr_pat_1111`
|
|
|
|
| 63 |
|
| 64 |
Run the container:
|
| 65 |
```bash
|
| 66 |
+
docker run -it -p 7860:7860/tcp devlikeapro/whatsapp-http-api-plus
|
| 67 |
```
|
| 68 |
|
| 69 |
+
Open API documentation [http://localhost:7860](http://localhost:7860).
|
| 70 |
|
| 71 |
## ARM
|
| 72 |
If you’re using **ARM** processor (like Apple Silicon, Apple M1, etc.) - add `:arm` tag at the end of the image name in the above commands.
|
|
|
|
| 97 |
# Restart all containers
|
| 98 |
docker stop whatsapp-http-api
|
| 99 |
docker rm whatsapp-http-api
|
| 100 |
+
docker run -it --rm -p 7860:7860/tcp --name whatsapp-http-api devlikeapro/whatsapp-http-api
|
| 101 |
```
|
| 102 |
|
| 103 |
**WAHA Plus** - download new image (please use **the latest key** from Boosty or Patreon)
|
|
|
|
| 111 |
# Restart all containers
|
| 112 |
docker stop whatsapp-http-api
|
| 113 |
docker rm whatsapp-http-api
|
| 114 |
+
docker run -it --rm -p 7860:7860/tcp --name whatsapp-http-api devlikeapro/whatsapp-http-api
|
| 115 |
```
|
docs/site/content/en/docs/how-to/receive-messages/index.md
CHANGED
|
@@ -206,14 +206,14 @@ For example, you can get the webhook like this with `media` value (we've skipped
|
|
| 206 |
"from": "11111111111@c.us",
|
| 207 |
"hasMedia": true,
|
| 208 |
"media": {
|
| 209 |
-
"url": "http://localhost:
|
| 210 |
"mimetype": "image/jpeg",
|
| 211 |
"filename": null
|
| 212 |
}
|
| 213 |
}
|
| 214 |
}
|
| 215 |
```
|
| 216 |
-
Then you can use the link to download the file `http://localhost:
|
| 217 |
|
| 218 |
For documents (file attachments) there's also `filename` field with the original file name.
|
| 219 |
```json
|
|
@@ -225,7 +225,7 @@ For documents (file attachments) there's also `filename` field with the original
|
|
| 225 |
"timestamp": 1667561485,
|
| 226 |
"from": "11111111111@c.us",
|
| 227 |
"media": {
|
| 228 |
-
"url": "http://localhost:
|
| 229 |
"filename": "some-file.pdf",
|
| 230 |
"mimetype": "application/pdf"
|
| 231 |
}
|
|
@@ -252,7 +252,7 @@ You also can get messages for chats by using
|
|
| 252 |
|
| 253 |
```bash
|
| 254 |
curl -X 'GET' \
|
| 255 |
-
'http://localhost:
|
| 256 |
-H 'accept: application/json'
|
| 257 |
```
|
| 258 |
|
|
|
|
| 206 |
"from": "11111111111@c.us",
|
| 207 |
"hasMedia": true,
|
| 208 |
"media": {
|
| 209 |
+
"url": "http://localhost:7860/api/files/true_11111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.jpg",
|
| 210 |
"mimetype": "image/jpeg",
|
| 211 |
"filename": null
|
| 212 |
}
|
| 213 |
}
|
| 214 |
}
|
| 215 |
```
|
| 216 |
+
Then you can use the link to download the file `http://localhost:7860/api/files/true_11111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.jpg`.
|
| 217 |
|
| 218 |
For documents (file attachments) there's also `filename` field with the original file name.
|
| 219 |
```json
|
|
|
|
| 225 |
"timestamp": 1667561485,
|
| 226 |
"from": "11111111111@c.us",
|
| 227 |
"media": {
|
| 228 |
+
"url": "http://localhost:7860/api/files/true_11111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.pdf",
|
| 229 |
"filename": "some-file.pdf",
|
| 230 |
"mimetype": "application/pdf"
|
| 231 |
}
|
|
|
|
| 252 |
|
| 253 |
```bash
|
| 254 |
curl -X 'GET' \
|
| 255 |
+
'http://localhost:7860/api/messages?chatId=11111111111%40c.us&limit=1000&session=default' \
|
| 256 |
-H 'accept: application/json'
|
| 257 |
```
|
| 258 |
|
docs/site/content/en/docs/how-to/security/index.md
CHANGED
|
@@ -24,7 +24,7 @@ login and password.
|
|
| 24 |
docker run -it -e WHATSAPP_SWAGGER_USERNAME=admin -eWHATSAPP_SWAGGER_PASSWORD=admin devlikeapro/whatsapp-http-api-plus
|
| 25 |
```
|
| 26 |
|
| 27 |
-
Open http://localhost:
|
| 28 |
|
| 29 |

|
| 30 |
|
|
@@ -69,7 +69,7 @@ headers = {
|
|
| 69 |
'Content-type': 'application/json',
|
| 70 |
'X-Api-Key': 'yoursecretkey',
|
| 71 |
}
|
| 72 |
-
requests.get("http://localhost:
|
| 73 |
```
|
| 74 |
|
| 75 |
## Webhook security 
|
|
|
|
| 24 |
docker run -it -e WHATSAPP_SWAGGER_USERNAME=admin -eWHATSAPP_SWAGGER_PASSWORD=admin devlikeapro/whatsapp-http-api-plus
|
| 25 |
```
|
| 26 |
|
| 27 |
+
Open http://localhost:7860/ and enter `admin / admin` in the inputs:
|
| 28 |
|
| 29 |

|
| 30 |
|
|
|
|
| 69 |
'Content-type': 'application/json',
|
| 70 |
'X-Api-Key': 'yoursecretkey',
|
| 71 |
}
|
| 72 |
+
requests.get("http://localhost:7860/api/sessions", headers=headers)
|
| 73 |
```
|
| 74 |
|
| 75 |
## Webhook security 
|
docs/site/content/en/docs/how-to/storages/index.md
CHANGED
|
@@ -47,7 +47,7 @@ you need to mount the volume to the `/app/.sessions` directory using the `-v` op
|
|
| 47 |
The full command to run the WAHA with the local storage and save the session data
|
| 48 |
in the current directory and `.sessions` directory:
|
| 49 |
```bash
|
| 50 |
-
docker run -v `pwd`/.sessions:/app/.sessions -p
|
| 51 |
```
|
| 52 |
This is the only action you need to do to use the local storage - all session data will be available between the container restarts.
|
| 53 |
|
|
@@ -138,7 +138,7 @@ Read more about [available configuration options ->]({{<relref "/docs/how-to/con
|
|
| 138 |
|
| 139 |
Here's all the steps in one command:
|
| 140 |
```bash
|
| 141 |
-
docker run -v /path/to/on/host/.media:/app/.media -e WHATSAPP_FILES_FOLDER=/app/.media -e WHATSAPP_FILES_LIFETIME=0 -p
|
| 142 |
```
|
| 143 |
|
| 144 |
### Health Check
|
|
|
|
| 47 |
The full command to run the WAHA with the local storage and save the session data
|
| 48 |
in the current directory and `.sessions` directory:
|
| 49 |
```bash
|
| 50 |
+
docker run -v `pwd`/.sessions:/app/.sessions -p 7860:7860/tcp devlikeapro/whatsapp-http-api-plus
|
| 51 |
```
|
| 52 |
This is the only action you need to do to use the local storage - all session data will be available between the container restarts.
|
| 53 |
|
|
|
|
| 138 |
|
| 139 |
Here's all the steps in one command:
|
| 140 |
```bash
|
| 141 |
+
docker run -v /path/to/on/host/.media:/app/.media -e WHATSAPP_FILES_FOLDER=/app/.media -e WHATSAPP_FILES_LIFETIME=0 -p 7860:7860/tcp devlikeapro/whatsapp-http-api-plus
|
| 142 |
```
|
| 143 |
|
| 144 |
### Health Check
|
docs/site/content/en/docs/how-to/webhooks/index.md
CHANGED
|
@@ -110,7 +110,7 @@ Below the list of all events that WhatsApp HTTP API sends to your.
|
|
| 110 |
Run the bellow command and see look at the logs - it prints body request for all events that happen in your WhatsApp!
|
| 111 |
|
| 112 |
```bash
|
| 113 |
-
docker run -it -e "WHATSAPP_HOOK_EVENTS=*" -e WHATSAPP_HOOK_URL=https://httpbin.org/post -p
|
| 114 |
```
|
| 115 |
|
| 116 |
|
|
|
|
| 110 |
Run the bellow command and see look at the logs - it prints body request for all events that happen in your WhatsApp!
|
| 111 |
|
| 112 |
```bash
|
| 113 |
+
docker run -it -e "WHATSAPP_HOOK_EVENTS=*" -e WHATSAPP_HOOK_URL=https://httpbin.org/post -p 7860:7860 devlikeapro/whatsapp-http-api
|
| 114 |
```
|
| 115 |
|
| 116 |
|
docs/site/content/en/docs/overview/changelog.md
CHANGED
|
@@ -121,7 +121,7 @@ November 2023
|
|
| 121 |
"payload": {
|
| 122 |
"hasMedia": true,
|
| 123 |
"media": {
|
| 124 |
-
"url": "http://localhost:
|
| 125 |
"mimetype": "application/pdf",
|
| 126 |
"filename": "file.pdf"
|
| 127 |
}
|
|
|
|
| 121 |
"payload": {
|
| 122 |
"hasMedia": true,
|
| 123 |
"media": {
|
| 124 |
+
"url": "http://localhost:7860/api/files/true_11111111111@c.us_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.pdf",
|
| 125 |
"mimetype": "application/pdf",
|
| 126 |
"filename": "file.pdf"
|
| 127 |
}
|
docs/site/content/en/docs/overview/quick-start/index.md
CHANGED
|
@@ -100,13 +100,13 @@ docker tag devlikeapro/whatsapp-http-api-plus:arm devlikeapro/whatsapp-http-api-
|
|
| 100 |
Run WhatsApp HTTP API:
|
| 101 |
|
| 102 |
```bash
|
| 103 |
-
docker run -it --rm -p
|
| 104 |
|
| 105 |
# It prints logs and the last line must be
|
| 106 |
-
# WhatsApp HTTP API is running on: http://[::1]:
|
| 107 |
```
|
| 108 |
|
| 109 |
-
Open the link in your browser [http://localhost:
|
| 110 |
(Swagger).
|
| 111 |
|
| 112 |
{{< alert icon="👉" text="We don't recommend expose the API in the internet without authentication!" />}}
|
|
@@ -163,7 +163,7 @@ instance. If you can get the actual screenshot - then you're ready to start send
|
|
| 163 |
|
| 164 |
### 6. Send a text message
|
| 165 |
|
| 166 |
-
Let's send a text message - find `POST /api/sendText` in [swagger](http://localhost:
|
| 167 |
way: use a phone international phone number without `+` symbol and add `@c.us` at the end.
|
| 168 |
|
| 169 |
For phone number `12132132131` the `chatId` is `12132132131@c.us`.
|
|
@@ -185,7 +185,7 @@ Also, you can use `curl` and send POST request like this:
|
|
| 185 |
```bash
|
| 186 |
# Phone without +
|
| 187 |
export PHONE=12132132130
|
| 188 |
-
curl -d "{\"chatId\": \"${PHONE}@c.us\", \"text\": \"Hello from WhatsApp HTTP API\" }" -H "Content-Type: application/json" -X POST http://localhost:
|
| 189 |
```
|
| 190 |
|
| 191 |
## What is next?
|
|
|
|
| 100 |
Run WhatsApp HTTP API:
|
| 101 |
|
| 102 |
```bash
|
| 103 |
+
docker run -it --rm -p 7860:7860/tcp --name whatsapp-http-api devlikeapro/whatsapp-http-api
|
| 104 |
|
| 105 |
# It prints logs and the last line must be
|
| 106 |
+
# WhatsApp HTTP API is running on: http://[::1]:7860
|
| 107 |
```
|
| 108 |
|
| 109 |
+
Open the link in your browser [http://localhost:7860/](http://localhost:7860/) and you'll see API documentation
|
| 110 |
(Swagger).
|
| 111 |
|
| 112 |
{{< alert icon="👉" text="We don't recommend expose the API in the internet without authentication!" />}}
|
|
|
|
| 163 |
|
| 164 |
### 6. Send a text message
|
| 165 |
|
| 166 |
+
Let's send a text message - find `POST /api/sendText` in [swagger](http://localhost:7860/) and change `chatId` this
|
| 167 |
way: use a phone international phone number without `+` symbol and add `@c.us` at the end.
|
| 168 |
|
| 169 |
For phone number `12132132131` the `chatId` is `12132132131@c.us`.
|
|
|
|
| 185 |
```bash
|
| 186 |
# Phone without +
|
| 187 |
export PHONE=12132132130
|
| 188 |
+
curl -d "{\"chatId\": \"${PHONE}@c.us\", \"text\": \"Hello from WhatsApp HTTP API\" }" -H "Content-Type: application/json" -X POST http://localhost:7860/api/sendText
|
| 189 |
```
|
| 190 |
|
| 191 |
## What is next?
|
docs/site/layouts/index.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
| 10 |
</div>
|
| 11 |
<p class='lead'>{{ .Params.lead | safeHTML }}</p>
|
| 12 |
<div class='code-block highlight'>
|
| 13 |
-
<pre tabindex='0' class='chroma'><code class='language-bash' data-lang='bash' style='padding: 0'>docker run -it -p
|
| 14 |
</div>
|
| 15 |
<a class='btn btn-primary btn-lg px-4 mb-2'
|
| 16 |
href='/docs/{{ if .Site.Params.options.docsVersioning }}{{ .Site.Params.docsVersion }}/{{ end }}overview/introduction/'
|
|
|
|
| 10 |
</div>
|
| 11 |
<p class='lead'>{{ .Params.lead | safeHTML }}</p>
|
| 12 |
<div class='code-block highlight'>
|
| 13 |
+
<pre tabindex='0' class='chroma'><code class='language-bash' data-lang='bash' style='padding: 0'>docker run -it -p 7860:7860/tcp devlikeapro/whatsapp-http-api</code></pre>
|
| 14 |
</div>
|
| 15 |
<a class='btn btn-primary btn-lg px-4 mb-2'
|
| 16 |
href='/docs/{{ if .Site.Params.options.docsVersioning }}{{ .Site.Params.docsVersion }}/{{ end }}overview/introduction/'
|
docs/site/static/swagger/openapi.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
docs/site/static/swagger/swagger-ui-bundle.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
docs/site/static/swagger/swagger-ui-es-bundle.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
docs/site/static/swagger/swagger-ui-standalone-preset.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
examples/python/README.md
CHANGED
|
@@ -24,7 +24,7 @@ docker pull devlikeapro/whatsapp-http-api
|
|
| 24 |
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
|
| 25 |
|
| 26 |
# It prints logs and the last line must be
|
| 27 |
-
# WhatsApp HTTP API is running on: http://[::1]:
|
| 28 |
```
|
| 29 |
|
| 30 |
#### Download image - ARM
|
|
@@ -43,12 +43,12 @@ docker tag devlikeapro/whatsapp-http-api:arm devlikeapro/whatsapp-http-api
|
|
| 43 |
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
|
| 44 |
|
| 45 |
# It prints logs and the last line must be
|
| 46 |
-
# WhatsApp HTTP API is running on: http://[::1]:
|
| 47 |
```
|
| 48 |
|
| 49 |
### Start session and scan QR
|
| 50 |
|
| 51 |
-
2. Open Swagger API in the browser http://localhost:
|
| 52 |
3. Start session and scan QR code in swagger
|
| 53 |
1. Find `POST /api/session/start` request press **Try it out** and
|
| 54 |
**Execute** it with `default` session name
|
|
|
|
| 24 |
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
|
| 25 |
|
| 26 |
# It prints logs and the last line must be
|
| 27 |
+
# WhatsApp HTTP API is running on: http://[::1]:7860
|
| 28 |
```
|
| 29 |
|
| 30 |
#### Download image - ARM
|
|
|
|
| 43 |
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
|
| 44 |
|
| 45 |
# It prints logs and the last line must be
|
| 46 |
+
# WhatsApp HTTP API is running on: http://[::1]:7860
|
| 47 |
```
|
| 48 |
|
| 49 |
### Start session and scan QR
|
| 50 |
|
| 51 |
+
2. Open Swagger API in the browser http://localhost:7860/
|
| 52 |
3. Start session and scan QR code in swagger
|
| 53 |
1. Find `POST /api/session/start` request press **Try it out** and
|
| 54 |
**Execute** it with `default` session name
|
examples/python/whatsapp_download_files_bot.py
CHANGED
|
@@ -16,7 +16,7 @@ def send_message(chat_id, text):
|
|
| 16 |
"""
|
| 17 |
# Send a text back via WhatsApp HTTP API
|
| 18 |
response = requests.post(
|
| 19 |
-
"http://localhost:
|
| 20 |
json={
|
| 21 |
"chatId": chat_id,
|
| 22 |
"text": text,
|
|
@@ -27,7 +27,7 @@ def send_message(chat_id, text):
|
|
| 27 |
|
| 28 |
def send_seen(chat_id, message_id, participant):
|
| 29 |
response = requests.post(
|
| 30 |
-
"http://localhost:
|
| 31 |
json={
|
| 32 |
"session": "default",
|
| 33 |
"chatId": chat_id,
|
|
|
|
| 16 |
"""
|
| 17 |
# Send a text back via WhatsApp HTTP API
|
| 18 |
response = requests.post(
|
| 19 |
+
"http://localhost:7860/api/sendText",
|
| 20 |
json={
|
| 21 |
"chatId": chat_id,
|
| 22 |
"text": text,
|
|
|
|
| 27 |
|
| 28 |
def send_seen(chat_id, message_id, participant):
|
| 29 |
response = requests.post(
|
| 30 |
+
"http://localhost:7860/api/sendSeen",
|
| 31 |
json={
|
| 32 |
"session": "default",
|
| 33 |
"chatId": chat_id,
|
examples/python/whatsapp_echo_bot.py
CHANGED
|
@@ -17,7 +17,7 @@ def send_message(chat_id, text):
|
|
| 17 |
"""
|
| 18 |
# Send a text back via WhatsApp HTTP API
|
| 19 |
response = requests.post(
|
| 20 |
-
"http://localhost:
|
| 21 |
json={
|
| 22 |
"chatId": chat_id,
|
| 23 |
"text": text,
|
|
@@ -28,7 +28,7 @@ def send_message(chat_id, text):
|
|
| 28 |
|
| 29 |
def reply(chat_id, message_id, text):
|
| 30 |
response = requests.post(
|
| 31 |
-
"http://localhost:
|
| 32 |
json={
|
| 33 |
"chatId": chat_id,
|
| 34 |
"text": text,
|
|
@@ -41,7 +41,7 @@ def reply(chat_id, message_id, text):
|
|
| 41 |
|
| 42 |
def send_seen(chat_id, message_id, participant):
|
| 43 |
response = requests.post(
|
| 44 |
-
"http://localhost:
|
| 45 |
json={
|
| 46 |
"session": "default",
|
| 47 |
"chatId": chat_id,
|
|
@@ -53,7 +53,7 @@ def send_seen(chat_id, message_id, participant):
|
|
| 53 |
|
| 54 |
def start_typing(chat_id):
|
| 55 |
response = requests.post(
|
| 56 |
-
"http://localhost:
|
| 57 |
json={
|
| 58 |
"session": "default",
|
| 59 |
"chatId": chat_id,
|
|
@@ -63,7 +63,7 @@ def start_typing(chat_id):
|
|
| 63 |
|
| 64 |
def stop_typing(chat_id):
|
| 65 |
response = requests.post(
|
| 66 |
-
"http://localhost:
|
| 67 |
json={
|
| 68 |
"session": "default",
|
| 69 |
"chatId": chat_id,
|
|
|
|
| 17 |
"""
|
| 18 |
# Send a text back via WhatsApp HTTP API
|
| 19 |
response = requests.post(
|
| 20 |
+
"http://localhost:7860/api/sendText",
|
| 21 |
json={
|
| 22 |
"chatId": chat_id,
|
| 23 |
"text": text,
|
|
|
|
| 28 |
|
| 29 |
def reply(chat_id, message_id, text):
|
| 30 |
response = requests.post(
|
| 31 |
+
"http://localhost:7860/api/reply",
|
| 32 |
json={
|
| 33 |
"chatId": chat_id,
|
| 34 |
"text": text,
|
|
|
|
| 41 |
|
| 42 |
def send_seen(chat_id, message_id, participant):
|
| 43 |
response = requests.post(
|
| 44 |
+
"http://localhost:7860/api/sendSeen",
|
| 45 |
json={
|
| 46 |
"session": "default",
|
| 47 |
"chatId": chat_id,
|
|
|
|
| 53 |
|
| 54 |
def start_typing(chat_id):
|
| 55 |
response = requests.post(
|
| 56 |
+
"http://localhost:7860/api/startTyping",
|
| 57 |
json={
|
| 58 |
"session": "default",
|
| 59 |
"chatId": chat_id,
|
|
|
|
| 63 |
|
| 64 |
def stop_typing(chat_id):
|
| 65 |
response = requests.post(
|
| 66 |
+
"http://localhost:7860/api/stopTyping",
|
| 67 |
json={
|
| 68 |
"session": "default",
|
| 69 |
"chatId": chat_id,
|
src/config.service.ts
CHANGED
|
@@ -22,7 +22,7 @@ export class WhatsappConfigService {
|
|
| 22 |
}
|
| 23 |
|
| 24 |
get port(): string {
|
| 25 |
-
return this.configService.get('WHATSAPP_API_PORT', '
|
| 26 |
}
|
| 27 |
|
| 28 |
get filesFolder(): string {
|
|
@@ -173,7 +173,7 @@ export class WhatsappConfigService {
|
|
| 173 |
getHealthMongoTimeout(): number {
|
| 174 |
return this.configService.get<number>(
|
| 175 |
'WHATSAPP_HEALTH_MONGO_TIMEOUT_MS',
|
| 176 |
-
|
| 177 |
);
|
| 178 |
}
|
| 179 |
}
|
|
|
|
| 22 |
}
|
| 23 |
|
| 24 |
get port(): string {
|
| 25 |
+
return this.configService.get('WHATSAPP_API_PORT', '7860');
|
| 26 |
}
|
| 27 |
|
| 28 |
get filesFolder(): string {
|
|
|
|
| 173 |
getHealthMongoTimeout(): number {
|
| 174 |
return this.configService.get<number>(
|
| 175 |
'WHATSAPP_HEALTH_MONGO_TIMEOUT_MS',
|
| 176 |
+
7860,
|
| 177 |
);
|
| 178 |
}
|
| 179 |
}
|
src/structures/responses.dto.ts
CHANGED
|
@@ -13,7 +13,7 @@ export class WAMedia {
|
|
| 13 |
@ApiProperty({
|
| 14 |
description: 'The URL for the media in the message if any',
|
| 15 |
example:
|
| 16 |
-
'http://localhost:
|
| 17 |
})
|
| 18 |
url: string;
|
| 19 |
|
|
@@ -85,7 +85,7 @@ export class WAMessage extends WAMessageBase {
|
|
| 85 |
'Use `media.url` instead! The URL for the media in the message if any',
|
| 86 |
deprecated: true,
|
| 87 |
example:
|
| 88 |
-
'http://localhost:
|
| 89 |
})
|
| 90 |
mediaUrl: string;
|
| 91 |
|
|
|
|
| 13 |
@ApiProperty({
|
| 14 |
description: 'The URL for the media in the message if any',
|
| 15 |
example:
|
| 16 |
+
'http://localhost:7860/api/files/false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA.oga',
|
| 17 |
})
|
| 18 |
url: string;
|
| 19 |
|
|
|
|
| 85 |
'Use `media.url` instead! The URL for the media in the message if any',
|
| 86 |
deprecated: true,
|
| 87 |
example:
|
| 88 |
+
'http://localhost:7860/api/files/false_11111111111@c.us_AAAAAAAAAAAAAAAAAAAA.oga',
|
| 89 |
})
|
| 90 |
mediaUrl: string;
|
| 91 |
|