2021-01-01 12:54:25 +07:00
2020-12-31 20:29:37 +07:00
2020-10-20 15:55:13 +07:00
2020-10-21 11:03:51 +07:00
2020-10-20 15:55:13 +07:00
2021-01-01 12:34:35 +07:00
2021-01-01 12:34:35 +07:00
2020-10-20 15:49:49 +07:00
2020-10-20 18:02:28 +07:00
2020-12-31 20:29:37 +07:00
2020-12-31 20:29:37 +07:00
2021-01-01 12:54:25 +07:00
2020-10-20 15:55:13 +07:00
2020-10-20 15:55:13 +07:00

WhatsApp HTTP API Free

WhatsApp HTTP API that you can configure in a click! And it's Free! :)

First Steps

We are going to show how to use WhatsApp HTTP API. Only thing that you must have - installed docker. Please follow the original instruction how to install it https://docs.docker.com/get-docker/)

Install and run

docker pull allburov/whatsapp-http-api
docker run -it -v `pwd`/tokens:/app/tokens -p 127.0.0.1:3000:3000/tcp allburov/whatsapp-http-api

A few seconds later you'll see QR code on you console. Do you see? Let's go to WhatsApp application on your mobile phone and scan this code! Follow the instruction

After that open in a browser the link and you'll see API swagger specification for you own WhatsApp HTTP API - http://localhost:3000/#/

TODO: Add GIF here

Get a screenshot

Go to the "screenshot" section and get a screenshot http://localhost:3000/#/screenshot

TODO: Add GIF here

Send a text message

Let's try to send a message:

# Phone without +
export PHONE=79776772457
curl -d "{\"chatId\": \"${PHONE}@c.us\", \"text\": \"Hello from WhatsApp HTTP API Free\" }" -H "Content-Type: application/json" -X POST http://localhost:3000/api/sendText

TODO: Add GIF here

Environment variables

Common

  • DEBUG - show debug and verbose logs, set in any value
  • WHATSAPP_API_PORT - listen port for HTTP server (default: 3000)
  • WHATSAPP_API_HOSTNAME - Hostname for HTTP server (default: localhost)

Webhooks

https://github.com/orkestral/venom#events All webhooks are disabled by default.

  • WHATSAPP_HOOK_ONMESSAGE=http://localhost/uri
  • WHATSAPP_HOOK_ONSTATECHANGE=http://localhost/uri
  • WHATSAPP_HOOK_ONACK=http://localhost/uri
  • WHATSAPP_HOOK_ONADDEDTOGROUP=http://localhost/uri

File storage

  • WHATSAPP_FILES_FOLDER - folder where will be stored files from chats (images, voice messages) (default: /tmp/whatsapp-files)
  • WHATSAPP_FILES_MIMETYPES - download only these mimetypes from messages. Mimetypes must be separated by comma, without spaces: audio,image/png,image/gif. In order to choose type use prefix (like audio,image). Disabled by default, message.clientUrl will be equal emtpy string "".
  • WHATSAPP_FILES_LIFETIME- to keep free space files will be removed after this time (default: 180, in seconds)

Development

Use node 10 version:

$ npm install

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

Test

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov
S
Description
No description provided
Readme Apache-2.0
89 MiB
0 Stars 1 Watchers 0 Forks
Languages
TypeScript 63.5%
JavaScript 31.5%
HTML 4.6%
Dockerfile 0.2%