Simple API to send messages to WhatsApp using WhatsApp Web.
npm install
npm run start
- Go to
http://localhost:3000/whatsapp/login
- Scan the QR code with your WhatsApp account
- POST:
http://localhost:3000/whatsapp/sendmessage
- Body:
{
"phone": "963957999999", // phone number with country code
"message": "Hello, world!"
}
- Headers:
{
"x-password": "1234567890" // password from .env
}
- The phone number must be in the format of the country code and the phone number without the + sign.
- The message must be in the format of the message to be sent.
- The password is the password from the .env file.
You can use the following code to send a message to WhatsApp using the API.
use Illuminate\Support\Facades\Http;
$response = Http::withHeaders([
'x-password' => '1234567890'
])->post('http://localhost:3000/whatsapp/sendmessage', [
'phone' => '963957999999',
'message' => 'Hello, world!',
]);
- Fork the repository
- Create a new branch
- Make your changes and commit them
- Push to your branch
- Create a pull request
This project is licensed under the MIT License. See the LICENSE file for details.