# Send Message
pay attention
You can use the "Send Message" API in one case only:
You reply to a message that the client sent, within 24 hours since the client sent his last message.
If you send a message to a new client, or try to send a message to an old client (old client means that 24 hours since client's last message has passed), you must use the "Send Template Message" API instead.
If you send a template message to the client, and the client did not reply yet, and you want to send another message to him, you must use the template message again.
billing
After the first 1,000 messages each month, every additional message is billed at 0.5 credits.
# Remarks
- You can use the "Send Message" API in one case only - for reply to a message that the client sent, within 24 hours since the client sent his last message. If you send a message to a new client, or try to send a message to an old client (old client means that 24 hours since client's last message has passed), you must use the "Send Template Message" API instead. If you send a template message to the client, and the client did not reply yet, and you want to send another message to him, you must use the template message again.
- You can only send a message to private people, not groups.
- 24 hours session conversation starts when you send a message to the client.
- Every time the user replies, the template message session resets. which means that you don't have to use template message during this 24 hours template message session.
# Endpoint
POST https://019sms.co.il/whatsapp-api/send-whatsapp-message
# Header
| Name | Type | Required |
|---|---|---|
| Authorization | Bearer authentication | ✔️ |
| Content-Type | application/json | ✔️ |
# Request parameters
| Name | Type | Description | Required |
|---|---|---|---|
| source | string | Your WhatsApp account. international number without +. for example: 972771234567 | ✔️ |
| destination | string | The number you want to send the message to. for example: 972501234567 | ✔️ |
| message | string | Your message goes here \n for new line text for bold text for italic ~text~ for strike through | ✔️ |
| replyTo | string | In case you want to reply to a message that the end user has sent (quoted message), here you can provide the unique ID of that message | ➖ |
# Request example
json
Copy code
POST whatsapp-api/send-whatsapp-message HTTPS/1.1
Content-Type: application/json
{
"source": 972555555555,
"destination": 972550000000,
"message": "freestyle message",
"replyTo": ""
}
# Response example
json
Copy code
Content-Type: application/json
{
"success": true,
"ans": {
"status": "OK",
"unique": "HBgMOTcyNTI2ODkzMjQ1FQIAERgSRdDU4RjIyQjY2MEI5NUVEMUM4AA==",
"timestamp": 1735648695,
"from": 972555555555,
"to": "972550000000",
"body": "Hi dana , thank you for calling",
"templateTimeLeft": 0,
"conversationTimeLeft": 0,
"reason": 1
}
}
# Response parameters
| Name | Type | Description | Options |
|---|---|---|---|
| success | boolean | The status of request. | true/false |
| ans | object | The response object | |
| ans -> status | string | Status of sending the message | OK / FAIL |
| ans -> unique | string | Unique ID for any message | |
| ans -> timestamp | timestamp | Time stamp | |
| ans -> from | string | Your WhatsApp account | |
| ans -> to | string | The number that the message was sent to | |
| ans -> templateTimeLeft | number | Amount of minutes left since client's last message. if passed, you must use Template Message. This value resets every time the client is sending you a message. | |
| ans -> reason | string | The status explanation in case of FAIL | see the table below |
# Reason explanation
| Reason | Description |
|---|---|
| 1 | Not FAIL. the status is OK |
| 2 | Your "from" number account does not exist, or JSON syntax error |
| 3 | General error |
| 4 | 'to' is either empty or wrong number format or WhatsApp number does not exist |
| 5 | 'body' can't be empty |
| 6 | WhatsApp error |
| 7 | You are trying to send a message but it has been more than 24 hours since client's last message. please use 'Send Template' instead |
| 8 | You are trying to send a message for first time to a contact. please use 'Send Template' message instead |
| 9 | Rate limit error, try again |