HostMentor Docs

Media

Upload images, video, audio and documents for WhatsApp messages, and download the files your customers send you.

Media files are images, videos, audio, documents and stickers. You work with them in two directions.

Sending a file

There are two ways to attach a file to a message:

  • By link. Put a public HTTPS URL in link. WhatsApp downloads the file when it sends the message, so the URL must work without a login. This is the simplest option.
  • By upload. Upload the file first, then send its id. This is better when you send the same file many times, or when it isn't public. Uploaded files are kept for 30 days.

Supported files

TypeFormatsMax size
ImageJPEG, PNG5 MB
VideoMP4, 3GPP (H.264 video, AAC audio)16 MB
AudioAAC, AMR, MP3, M4A, OGG (Opus)16 MB
DocumentPDF, Word, Excel, PowerPoint, plain text100 MB
StickerWebP, 512×512100 KB (500 KB animated)

Receiving a file

When a customer sends a file, your webhook receives an incoming message with a media id, not the file itself. To get the file, do one of these:

  • One step: call Download media with the ID. The response is the file.
  • Two steps: call Retrieve a media URL, then fetch that url with your apikey header. The URL expires after 5 minutes, so fetch it straight away.

Download received files promptly and store them yourself. WhatsApp deletes them after a while.

On this page