Media Message

Media messages are messages that include multimedia content, such as images, audio files, videos, and documents.

The next table summarizes each component you can include in the media messages and their different options.

OptionsDescription
ImageIt must be less than 5MB and the format .jpg or .png.
VideoIt must be less than 5MB and the format .mp4, .3gpp (Only H.264 video codec and AAC audio codec are supported).
DocumentIt must be less than 5MB and in the format .pdf.

HTTP Request : POST / notification

The following Session Media message example includes only an image:

{
  "channel": "WHATSAPP",
  "request": {
    "from": "1000000001",
    "to": "1000000002",
    "message": "https://<URL_IMAGE>",
    "type": "image",
    "caption": "The best coffee in the town!",
  }
}

The parameters presented in the request body example when creating the Session Media message are the following:

Parameter Required Description
channel Yes

Specifies the type of delivery channel which the notification message will be sent: "SMS", "EMAIL", "PUSH", "RCS", "WHATSAPP".

In this case, we enter the "WHATSAPP" value to send the WhatsApp message.

request Yes Message content.
request.from Yes

Phone number of the sender.

Phone number provided during the WABA account setup will be used as the sender of the notification message.

Only accepts numeric characters. Do not include the "+" sign.

request.to Yes Determines the destination phone number for your session message. Numbers are specified in E.164 format → (‘+’ and a country code).
request.message Yes

Only applies to the "image" type, "audio" type, "document" type.

For Media messages, enter the URL of the chosen media file (image, video and document). The URL must be a valid URL that starts with "http://…" or "https://…" and provides a direct download. Redirects are not supported.

request.type Yes

Type of message you want to send.

Supported options:

  • "text": Sends a plain text message.
  • "image": Sends an image file (.jpeg, .png).
  • "audio": Sends an audio file (.acc, .mp3, .amr, .mpeg).
  • "video": Sends a video file (.mp4, .3gpp.)
  • "document": Sends a document file (.pdf).
  • "contacts": Sends contact information.
  • "location": Sends a location with latitude and longitude.
  • "interactive": Sends an interactive message with reply buttons or list .

In this example, we set the "image" parameter.

request.caption No

Only applies to the "image" type.

Image caption text.

request.fileName No

Only applies to the "document" type.

Enter the name and file extension (.pdf) of the document to be sent.

request.externalId No

Alphanumeric identifier used for reporting purposes.

request.clientId No Unique user identifier that can be used for reporting purposes. This is an identifier you can use to uniquely identify the destination address in your systems. This is similar to the externalId and will be sent back to you if you are requesting callbacks that contain status changes of the messages you send.
callbacks No

Indicate one or more (separated by comma) webhook URLs to notify about the status of the message delivery.That is, If you want to receive the status of the message you've sent to your subscribers, you need to specify your endpoint.

Your endpoint must have a HTTP POST access method and receive a JSON body.

The URL is the external callback where the events of the Email will be registered and published. Once an email is processed, its status will be posted to your callback URL.

To view the full list and meaning of each status, please refer to the WhatsApp Status section.

When you send a Session Media Message, the response body contains the following data:

{
  "meta": {
    "timestamp": 1642531254980,
    "transactionId": "077da1d0-e089-487e-aed0-59534ba2d9f5",
    "explain": "Send Notification"
  }
}

Parameters presented in the response body example when sending the Session Media Message are the following:

Parameter Description
meta "meta" segment is dedicated to metadata regarding the call itself.
meta.timestamp

Call’s time mark.

Sequence of characters identifying when the message has been sent.

meta.transactionId Call’s transaction ID, this will help our teams to locate issues faster if arose.
meta.explain Useful message regarding the operation or the call.