Send video, audio, image, document

Endpoint for easy send media-file as message

You can work with different types of files and it makes no difference what extension the document has. WhatsApp limits the sizes of files and its politics constantly changes and because of that we always recommend that you verify directly on WhatsAppโ€™s website. In this link you can find everything that you need to know about formatting and file sizing.

Your file needs to be specified in the mandatory "media" parameter and there are four options here: UPLOAD FROM FILE, UPLOAD FROM URL, UPLOAD FROM BASE64 and send the file by its media id.

If you store the file locally, you will need to either upload it to the server or send it in Base64 format.

If you have a direct link to an image that is posted somewhere on the internet. It is important that it is the file that is accessible via the direct link.

Request Body

{
  "to": "14045648921",
  "media": "https://filesamples.com/samples/image/jpeg/sample_640%C3%97426.jpeg"
}

Sending Media via Base64

In which case you will need to have a method in your application to convert the image to Base64. To make sure the conversion is successful, copy the generated base64 and paste it into your browser's address bar, if it is a valid image the browser will be able to display it, if the browser can't, check your method :)

IMPORTANT if you opt for a base64 before binary you will need to add the following expression data:image/png;base64, * your base64 code *

You can also manually recode the file and specify the result in your application. For this, you will need resources such as: Link 1 ; Link 2

Sending Media by Media ID (Uploading file to our cloud)

Via MediaID, in this case after automatically uploading the file to the cloud, you will get a media ID that you can use in the future.

A single method for any media

The method is intended for sending a file uploaded through a form (form-data):

Send Image (via URL / Base64 / upload to cloud)

Send Document (via URL / Base64 / upload to cloud)

Send Audio (via URL / Base64 / upload to cloud)

Send Voice

You can Send a ppt audio recording to the phone number or group, But WhatsApp is sensitive to this extension, you need to be in OGG format and the codecs should be the opus, For more information, you can check out this article.

Send Video (via URL / Base64 / upload to cloud)

Last updated