API Endpoint Documentation
Use this API endpoint to send WhatsApp messages programmatically:
Endpoint:
GET http://localhost:3000/api/send
Query Parameters:
number : Phone number (e.g., 917201000220 or 7201000220)
type : Message type (default: text)
message : Your message text (URL encoded)
instance_id : 688C218ABF0A1 (Authentication)
access_token : 685694fd67a5b (Authentication)
Example URL:
http://localhost:3000/api/send?number=917201000220&type=text&message=Hello+World&instance_id=688C218ABF0A1&access_token=685694fd67a5b
Example cURL:
curl "http://localhost:3000/api/send?number=917201000220&type=text&message=Hello+from+API&instance_id=688C218ABF0A1&access_token=685694fd67a5b"
Response (Success):
{
"success": true,
"message": "Message sent successfully",
"to": "917201000220",
"type": "text"
}
Response (Error):
{
"success": false,
"error": "Error description"
}
Alternative POST Endpoint:
POST http://localhost:3000/api/send-message
Headers: Content-Type: application/json
Body: {"number": "+917201000220", "message": "Your message"}
Authentication:
Change instance_id and access_token in server.js or use environment variables (.env file)