Call this API to send a pre-defined WhatsApp message to specific phone number
If you need to send same WhatsApp message to 3 different number, call this API 3 times with different "to" parameter.
https://api.esms.com.my/whatsapp/send
POST, supported content-type is JSON:
* charset behind is necessary when you're sending in Unicode messages, such as Chinese characters.
Name | Type | Required | Description |
---|---|---|---|
user | String | Mandatory | This would be your account's api key. |
pass | String | Mandatory | This would be your account's api secret. |
to | String | Mandatory |
The phone number of target recipient you'd like to send SMS to. Phone number must be supplied along with country code. Do not include any non-numeric character, eg: - ( ) or space. Example: 60123456789 |
type | String | Mandatory |
The type of predefined template. Example: otp, feedback, eventConfirmation, eventReminder, shipment, or paymentDue |
dlr | Numeric | Optional |
Set to "1" if you'd like to receive DR report. Any other value would be ignored. Example: 1 |
dlr-url | String | Optional |
Specify your own DLR receiving endpoint to receive our DR report. Parameter dlr must be set to 1 for this to take effect. Example: https://www.yourownsite.com/dlrreceiver |
[ number, code, name, action, event, brand, date, time, venue, amount, link ] |
String | Optional |
These are optional depending on the type field, at least a field is mandatory for each type, refer to request sample for details. |
Response would be returned in application/json format.
An example of Successful response would be:
{"status":0,"creditDeducted":1,"message":"ok","id":"88ce9c6e-1707-41b8-95a2-91d228001fc7","parts":1,"type":9}
An example of Failed response would be:
{"status":9,"message":"Invalid phone number, please do not include any non-numeric character","id":"c8d6bb1c-bff6-47d5-9e01-dc2596bbdbe7"}
Name | Type | Description |
---|---|---|
status | Numeric | Status code of the request, kindly refer to below Status mapping table for more details |
message | String | A short description of given status, for more information you may contact our support team at support@esms.com.my |
id | String | ID of this particular request, you may want to keep this ID in your own table for future reference, our DR would be based on this ID. |
creditDeducted | Numeric | The total credit amount deducted from your account. |
parts | Numeric | To show how many parts of WhatsApp this message requires, its usually 1 for WhatsApp. |
type | Numeric |
Type of this message, its usually 9 for WhatsApp. |
Status Code | Description |
---|---|
0 | Success. |
1 | Insufficient parameters Please make sure all mandatory parameter exists. |
2 | Invalid calling IP You are getting this error because you've previously requested your account to be able to call only from certain IP, and you're not calling from the designated IP. |
3 | Invalid username/password combination. If you believe this is an error, kindly contact our support team at support@esms.com.my. |
4 | Invalid country code The country code of the phone number you provides is not recognized. For Malaysia recipients, do remember to send to 60123456789 instead of 0123456789. |
5 | Insufficient credits Contact your account manager for reload procedures. |
6 | Internal error You may retry again shortly. |
9 | Invalid "to" parameter Please include only numeric in "to" parameter For example, please send 60123456789 instead of 60-12 345 6789 |
Type and Request Body | Sample of received content |
---|---|
Authentication OTP
|
|
Feedback Survey Form
|
|
Event RSVP Confirmation
|
|
Event Reminder
|
|
Shipment Update
|
|
Payment Due
|