Send File
You can use the "Send File" 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 more than 24 hours has passed since his last message), you must use the "Send Template Message" API instead. Sending contact is not available for template message, therefore, sending a contact message can only be when replying to a client. 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.
Files you can send:
Media Type | Supported Format | Maximum file size |
|---|---|---|
image | png, jpg, gif, jpeg | 5 MB |
video | mp4, avi, 3gpp | 16 MB |
audio | mp3, ogg (PTT only), amr, aac | 16 MB |
document | pdf,doc,docx,xls,xlsx,ppt,ppts,zip,txt,rar | 100 MB |
More Remarks
You can only send a file to private people, not groups.
The billing is per "conversation". conversation means a 24 hours session between you and the client (this 24 hours conversation session is unrelated to the 24 hours timer for template message)
You can send unlimited messages within the 24 hours session time of a conversation.
24 hours session conversation starts when you send a message to the client.
Settings:
URL | |
Method | JSON via POST |
Body:
Parameter | Description / Example | Mandatory |
|---|---|---|
apiKey | Your API key for the service | yes |
from | your WhatsApp account. international number without +. for example: 972771234567 | yes |
to | The number you want to send the message to. for example: 972501234567 | yes |
body | https link to the file. for example: | yes |
caption | The caption text that will be sent with the file. | no |
replyTo | 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 | no |
showRequest | You can get back in the response an object with all the request you sent (without the 'apiKey') default is off (0) 1 - enable | no |
localStorage | Whenever you provide body url, we deliver this URL to WhatsApp. They download the link in order to deliver it with your message. If for any reason your file link is not accessible by WhatsApp and open to the internet, you can request us to download the image and provide Meta with alternative url to use, and not your own. default value is - 0 (disable) enable - 1 ** please note that using this feature may delay the response back from our server due to the operation described above. | no |
Response:
{
"status": "OK",
"unique": "65dfd4r4dref34rdfxd34r",
"body": "Your link",
"caption": "The text you sent",
"timestamp": 1600115719,
"from": "972507654321",
"to": "972501234567",
"templateTimeLeft": "400",
"reason": 1
}
Response-Explain:
Parameter | Description | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
status | OK or FAIL **Note: OK status doesn't mean the message arrived to the end user. it only means that the system received your request. You should listen to webhooks to see the status of your message. | ||||||||||||||||||||
unique | unique ID for any message | ||||||||||||||||||||
body | the link you sent | ||||||||||||||||||||
caption | the caption you sent | ||||||||||||||||||||
timestamp | time stamp | ||||||||||||||||||||
from | your WhatsApp account | ||||||||||||||||||||
to | the number that the message was sent to | ||||||||||||||||||||
templateTimeLeft | 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. | ||||||||||||||||||||
originalRequest | Original request object, if you enabled this in 'showRequest' when sending the request. | ||||||||||||||||||||
reason | 'reason' is the status explanation in case of FAIL
|