Compare commits

...
5 Commits
Author SHA1 Message Date
Aleksey Burov 983e8dbbd3 Update build.yaml
Release / deploy-docker (push) Waiting to run
2022-10-28 20:20:56 +07:00
Aleksey Burov b2150477d7 Add telegram dm link 2022-10-23 18:05:28 +07:00
Aleksey Burov f83eeac33a Delete docker-compose.yaml
Fix #19
2022-10-23 17:49:44 +07:00
allburov 37c4a85e76 Add httpbin in readme.md
Release / deploy-docker (push) Waiting to run
2022-10-13 10:31:39 +07:00
allburov 8732af0f43 Add onAnyMessage hook 2022-10-13 10:14:43 +07:00
4 changed files with 15 additions and 20 deletions

No files matched your search

+1 -1
View File
@@ -40,5 +40,5 @@ jobs:
push: ${{ github.ref_type == 'tag' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
# cache-from: type=gha
cache-to: type=gha
+9 -1
View File
@@ -5,7 +5,7 @@ WhatsApp HTTP API that you can configure in a click! It's really Free! :)
The project provides you HTTP API for Whatsapp that you can use to send and receive messages. You can
go [through currently supported methods in Swagger](https://allburov.github.io/whatsapp-http-api/)
The project is an HTTP API wrapper around https://github.com/orkestral/venom
> The project is an HTTP API wrapper around https://github.com/orkestral/venom
# Tables of Contents
@@ -144,11 +144,18 @@ The description of [webhooks you can in Venom README.md, section Events](https:/
All webhooks are disabled by default:
- `WHATSAPP_HOOK_ONANYMESSAGE=http://localhost/uri`
- `WHATSAPP_HOOK_ONMESSAGE=http://localhost/uri`
- `WHATSAPP_HOOK_ONSTATECHANGE=http://localhost/uri`
- `WHATSAPP_HOOK_ONACK=http://localhost/uri`
- `WHATSAPP_HOOK_ONADDEDTOGROUP=http://localhost/uri`
If you want to look at the payload of the webhooks - use the url for that `https://httpbin.org/post`.
```bash
docker run -it -v `pwd`/tokens:/app/tokens --network=host -e WHATSAPP_HOOK_ONMESSAGE=https://httpbin.org/post allburov/whatsapp-http-api
```
## File storage
- `WHATSAPP_FILES_FOLDER` - folder where will be stored files from chats (images, voice messages) (
@@ -174,4 +181,5 @@ If you want to support the project - you can either:
1. Create a Pull Request for desired functionality
2. Support [the project one time, every month or get access to telegram channel on Boosty](https://boosty.to/allburov)
3. Looking for the personal support, have an important feature request for your business, need to develop a whatsapp bot? [Reach me out at Telegram](https://t.me/allburov)!
-15
View File
@@ -1,15 +0,0 @@
version: '3.4'
services:
whatsapp-http-api:
build: .
image: allburov/whatsapp-http-api
restart: always
ports:
- 3000:3000
shm_size: "1gb"
environment:
- WHATSAPP_DOWNLOADS_FOLDER=/app/files/downloads
volumes:
- ./tokens:/app/tokens
- ./files:/app/files
+5 -3
View File
@@ -15,9 +15,11 @@ const writeFileAsync = promisify(fs.writeFile)
const SECOND = 1000;
const ONMESSAGE_HOOK = "onMessage"
const ON_ANY_MESSAGE_HOOK = "onAnyMessage"
const ON_MESSAGE_HOOK = "onMessage"
const HOOKS = [
ONMESSAGE_HOOK,
ON_ANY_MESSAGE_HOOK,
ON_MESSAGE_HOOK,
"onStateChange",
"onAck",
// TODO: IMPLEMENTED THESE TOO
@@ -191,7 +193,7 @@ export class WhatsappService {
continue
}
if (hook === ONMESSAGE_HOOK) {
if (hook === ON_MESSAGE_HOOK || hook == ON_ANY_MESSAGE_HOOK) {
this.whatsapp[hook](data => this.onMessageHook(data, url))
} else {
this.whatsapp[hook](data => this.callWebhook(data, url))