Whatsapp Api
Send Message API
Method : POST
| GET
Endpoint: https://whatsapp.msg-box.in/send-message
Request Body : (JSON If POST)
Parameter | Type | Required | Description |
api_key | string | Yes | API Key |
sender | string | Yes | Number of your device |
number | string | Yes | recipient number ex 72888xxxx|62888xxxx |
message | string | Yes | Messsage to be sent |
Example JSON Request
{
"api_key": "1234567890",
"sender": "62888xxxx",
"number": "62888xxxx",
"message": "Hello World"
}
Example URL Request
https://whatsapp.msg-box.in/send-message?api_key=1234567890&sender=62888xxxx&number=62888xxxx&message=Hello World
Send Media API
Method : POST
| GET
Endpoint: https://whatsapp.msg-box.in/send-media
Request Body : (JSON If POST)
Parameter | Type | Required | Description |
api_key | string | Yes | API Key |
sender | string | Yes | Number of your device |
number | string | Yes | recipient number ex 72888xxxx|62888xxxx |
media_type | string | Yes | URL of media must direct link |
caption | string | No | Will show if the type of image or video |
url | string | Yes | required if the type is audio. true = Voice note | false = Audio |
ppt | boolean | No | required if type is audio. true = Voice note | false = Audio |
Example JSON Request
{
"api_key": "1234567890",
"sender": "62888xxxx",
"number": "62888xxxx",
"media_type": "image",
"caption": "Hello World",
"url": "https://example.com/image.jpg"
}
Example URL Request
https://whatsapp.msg-box.in/send-media?api_key=1234567890&sender=62888xxxx&number=62888xxxx&media_type=image&caption=Hello World&url=https://example.com/image.jpg
Send Button API
Method : POST
| GET
Endpoint: https://whatsapp.msg-box.in/send-button
Request Body : (JSON If POST)
Parameter | Type | Required | Description |
api_key | string | Yes | API Key |
sender | string | Yes | Number of your device |
number | string | Yes | recipient number ex 72888xxxx|62888xxxx |
message | string | Yes | Text of message |
button | string | Yes | The footer text of the message |
footer | string | No | Image or video URL |
url | string | No | Image or video url |
Example json
{
"sender" : "6281284838163",
"api_key" : "yourapikey",
"number" : "082298859671",
"url" : null,
"footer" : "optional",
"message" : "Halo,ini pesan button",
"button" : ["button 1","button 2","button 3"]
}
Example URL
https://whatsapp.msg-box.in/send-button?sender=6281284838163&api_key=yourapikey&number=082298859671&url=&footer=optional&message=Halo,ini pesan button&button=button 1,button 2,button 3
The Responses of API for (SEND MESSAGE) | JSON
Response Success
{
"status": true,
"msg": "Message sent successfully!"
}
Response Failed
{
"status": false,
"msg": "Message failed to send!"
}
Response INVALID Data
{
"status": false,
"msg": "Invalid data!",
"errors": { } // list of errors
}
The response failed to access the WhatsApp server
{
"status": false,
"msg": "Failed to send message!",
"errors": "Failed to access whatsapp server"
}
Webhook Example
Webhook is a feature that allows you to receive a callback from our server when a message is incoming to your device. You can use this feature for made a dynamic chatbot or whatever you want.
We will send a POST request to your webhook URL with a JSON body. Here is an example of the JSON body we will send:
{
"message" : "message",
"from" : "the number of the whatsapp sender",
"bufferImage" : "base64 image, null if message not contain image",
}
For example, webhook you can see in Here