Media messages

In WhatsApp the following media types are supported:

TypeSupported file typesMax. sizeContent-Type
image
  • jpeg
  • png
5 MB
  • image/jpeg
  • image/png
video
  • mpeg4 (see notes)
16 MB
  • video/mp4
audio
  • AAC
  • M4A
  • AMR
  • MP3
  • OGG-OPUS
16 MB
  • audio/aac
  • audio/m4a
  • audio/amr
  • audio/mpeg
  • audio/ogg; codecs=opus
document
  • Plain text
  • pdf
  • MS Word
  • MS Powerpoint
  • MS Excel
100 MB
  • text/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.sheet
sticker
  • Static sticker
  • Dynamic sticker
  • Static - 100 KB
  • Dynamic - 500 KB
  • image/webp

Notes:

  • File uploads should not be larger than the specified maximum file size.
  • For video, only H.264 video codec and AAC audio codec is supported.
  • Video files are required to have an audio track.
  • Voice messages, gif animations, and stickers are not supported.
  • The file should be hosted on a publicly accessible URI using port 80 (HTTP) or 443 (HTTPS).
  • The file must be served with the correct Content-Type header.
  • For both dynamic and static stickers, the size must be 512 x 512 pixels.

As data usage costs might apply when the end user is not on Wifi, please be considerate when sending media messages. We strongly advise not to send files larger than 1 MB, and for a conversation not to exceed 20Mb.

Media object contains the following fields:

TermDescription
MediaNameThe filename for a document, or the caption of the image or video (not supported for audio and sticker).
MediaUriThe location of the image, audio, or video.
MimeTypeThe mime type of the image, audio, or video.

Image

In the example below, we send an image message that contains both text and an image. The media name will be used as text.

{
    "messages": {
        "msg": [
            {
                "body": {
                    "type": "auto",
                    "content": "Fallback Text"
                },
                "to": [
                    {
                        "number": "00316012345678"
                    }
                ],
                "from": "00316098765432",
                "allowedChannels": ["WhatsApp"],
                "richContent": {
                    "conversation": [
                        {
                            "media": {
                                "mediaName": "CM.com and the WhatsApp Business Platform",
                                "mediaUri": "https://www.cm.com/cdn/web/logo/whatsapp-business-platform-download-logo.jpg",
                                "mimeType": "image/jpeg"
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Media message containing an image.

Media message containing an image


Video

In the example below, we send a video message that contains both text and a video. The media name will be used as text.

{
    "messages": {
        "msg": [
            {
                "body": {
                    "type": "auto",
                    "content": "Fallback Text"
                },
                "to": [
                    {
                        "number": "00316012345678"
                    }
                ],
                "from": "00316098765432",
                "allowedChannels": ["WhatsApp"],
                "richContent": {
                    "conversation": [
                        {
                            "media": {
                                "mediaName": "CM.com - Be part of it.",
                                "mediaUri": "https://your-company.com/your-video.mp4",
                                "mimeType": "video/mp4"
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Media message containing a video.

Media message containing a video.

Audio

In the example below, we send an audio message.

{
    "messages": {
        "msg": [
            {
                "body": {
                    "type": "auto",
                    "content": "Fallback Text"
                },
                "to": [
                    {
                        "number": "00316012345678"
                    }
                ],
                "from": "00316098765432",
                "allowedChannels": ["WhatsApp"],
                "richContent": {
                    "conversation": [
                        {
                            "media": {
                                "mediaUri": "https://your-company.com/your-audio.mp3",
                                "mimeType": "audio/mpeg"
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Document

In the example below, we send a document message.

{
    "messages": {
        "msg": [
            {
                "body": {
                    "type": "auto",
                    "content": "Fallback Text"
                },
                "to": [
                    {
                        "number": "00316012345678"
                    }
                ],
                "from": "00316098765432",
                "allowedChannels": ["WhatsApp"],
                "richContent": {
                    "conversation": [
                        {
                            "media": {
                                "mediaName": "CM.com - Be part of it.",
                                "mediaUri": "https://your-company.com/your-document.pdf",
                                "mimeType": "application/pdf"
                            }
                        }
                    ]
                }
            }
        ]
    }
}

Sticker

In the example below, we send a sticker message.

{
    "messages": {
        "msg": [
            {
                "body": {
                    "type": "auto",
                    "content": "Fallback Text"
                },
                "to": [
                    {
                        "number": "00316012345678"
                    }
                ],
                "from": "00316098765432",
                "allowedChannels": ["WhatsApp"],
                "richContent": {
                    "conversation": [
                        {
                            "media": {
                                "mediaUri": "https://your-company.com/your-sticker.webp",
                                "mimeType": "image/webp"
                            }
                        }
                    ]
                }
            }
        ]
    }
}