WhatsApp Media API

The Notifly WhatsApp Media API makes it easy to send any WhatsApp-supported media. With this API, you can quickly obtain the media_id and send media via the WhatsApp Sending API.

Method Type and API End Point

The Method Type and API Endpoint are as follows:

POST: /api/notifications/whatsapp/media

The Header for WhatsApp Media api is:

{

"Authorization": "YOUR_TOKEN_HERE"

}

API request

To send a request to the API, the following parameters must be included in the payload.

fieldData typeDescriptionRequired
filebinaryMedia type supported by whatsapp.Yes
curl --location 'https://api.getnotifly.io/api/notifications/whatsapp/media' \  
--header 'Authorization: "YOUR_TOKEN_HERE" \  
--form 'file="video_file_example.mp4"'

Media Supported Types

MediaSupported TypesRequired
audioaudio/aac, audio/mp4, audio/mpeg, audio/amr, audio/ogg (only opus codecs, base audio/ogg is not supported)16MB
documenttext/plain, application/pdf, application/vnd.ms-powerpoint, application/msword, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet100MB
imageimage/jpeg, image/png

Note: Images must be 8-bit, RGB or RGBA
5MB
videovideo/mp4, video/3gp

Note:

- Only H.264 video codec and AAC audio codec is supported.

- We support videos with a single audio stream or no audio stream.
16MB
stickerimage/webpstatic sticker- 100KB, Animated sticker- 500KB

API response

When making a request, replace value with your token. If the request is successful, you will get a JSON response containing the access token.

Success response use case

If the API receives a successful request, it will typically return specific parameters as part of the response:

Response_payload :
{
  "success": true,
  "message": false,
  "data": {
    "id": "273478495851191"
  }
}
fieldData typeDescriptionRequired
successbooleanIndicating whether the request was successful or not.Yes
messageboolean/stringInforms of additional value if sent along with the response, which can be either false or a string that defines the action done by the API caller.Yes
dataobjectA JSON object containing information related to the requestYes
idintegerA media_id generated after making an API call.Yes

Failure response use case

If the media request fails, the API will return specific parameters (HTTP errors) as part of the response:

Error CodeHTTP StatusCauseSolution
1319400invalid fileProvide a valid file (supported on WhatsApp)
1354400invalid WhatsApp configurationConfigure a valid WhatsApp platform setting on Advantus