A unjs/nitro server to send and receive Whatsapp chat messages.
- Create a Telegram Bot where you will receive the qr code to authenticate the whatsapp session.
- Set the env variables as explained in
.env.example
. - Deploy on Digital Ocean app platform (more details at the bottom of this page).
Any request must contain a 'authorization' header with token $TELEGRAM_TOKEN
from the env variables.
-
GET
/state
:
It returns the status of the server. If the propertystate
is equal toCONNECTED
means that the server is authenticated and ready to receive requests. Any otherstate
means the opposite. -
POST
/message/$PHONE_NUMBER
:
To post a message send aPOST
request to this endpoint where$PHONE_NUMBER
is the recipient of the message and themessage
property of the body is the content of the message to send.
To do
Ready for production.
Whatsapp authentication breaks often due to changes in the Whatsapp Web code. I will try to keep the code updated because I use this server in production for some of my project.
Only message (with emoji) are supported because this is all I need. Support for media can be easily added I guess.
It must be deployed anywhere Dockerfile
is supported.
On Digital Ocean it can run on a Basic Plan with 512 MB RAM and 1 vCPU (the cheapest plan for 5 USD/month).
MIT