Messages API
Message types

Message types

This section gives you an overview of how you can structure your Messages API request for different message types and channels and see some example output.

Message types contain a number of sections including a header, body, footer, and buttons depending on the message type you are using for your communication. This structure intuitively follows how the message is rendered on the user's phone. For example, you may want to include some header text when sending an image or as part of a WhatsApp template. This is all possible with Messages API (opens in a new tab).

Not all messaging channels support all message types. For a deeper dive into message types per channel then see the channel pages documentation:

Text

Send a simple text message using Messages API.

Text message types are natively supported by:

  • Apple Messages for Business
  • Instagram DM
  • LINE (LON)
  • Messenger
  • MMS
  • RCS
  • SMS
  • Viber Bots
  • Viber Business Messages
  • WhatsApp

Example

json
{
  "messages": [
    {
      "channel": "SMS",
      "content": {
        "body": {
          "text": "Follow the link athleete.com/event-details for more details. See you next week!",
          "type": "TEXT"
        }
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ]
    }
  ]
}

Output

Message API Unified API text example

Image

Send an image in your message.

Images are natively supported by

  • Apple Messages for Business
  • Instagram DM
  • LINE (LON)
  • Messenger
  • MMS
  • RCS
  • Viber Bots
  • Viber Business Messages
  • WhatsApp
NOTE

Sending an SMS with an image will render the image URL.

Example image

json
{
  "messages": [
    {
      "channel": "WHATSAPP",
      "content": {
        "body": {
          "type": "IMAGE",
          "url": "http://homestore/image.png",
          "text": "Spring is around the corner! Check out what we have in store for you."
        }
      },
      "options": {
        "adaptationMode": true
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ]
    }
  ]
}

Output

Message API Unified API image example

Image with header

Add data such as caption text inside the message header.

Images with headers are natively supported by:

  • Apple Messages for Business
  • Instagram DM
  • LINE (LON)
  • MMS

Example image with header

json
{
  "messages": [
    {
      "channel": "WHATSAPP",
      "content": {
        "header": {
          "text": "Spring is around the corner!"
        },
        "body": {
          "type": "IMAGE",
          "url": "http://homestore/image.png",
          "text": "Check out what we have in store for you."
        }
      },
      "options": {
        "adaptationMode": true
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ]
    }
  ]
}

Output

Message API Unified API image with header example

Document

Send files through your chosen messaging channel.

Document message types are natively supported by:

  • Apple Messages for Business
  • Instagram DM
  • LINE (LON)
  • Messenger
  • MMS
  • Viber Bots
  • Viber Business Messages
  • WhatsApp
NOTE

Channel availability and output depends on the message elements you include in your request. For example, Viber Business Messages does not support documents with filename.

NOTE

If you are using a channel that does not natively support document as a message type then you can use the adaptationMode parameter as part of your API request to remove the unsupported element and deliver the message anyway without throwing an error.

Example document

json
{
  "messages": [
    {
      "channel": "WHATSAPP",
      "content": {
        "body": {
          "type": "DOCUMENT",
          "url": "http://my.domain/document.pdf"
        }
      },
      "options": {
        "adaptationMode": true
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ]
    }
  ]
}

Output

unified-api-document-example

Video

Send video as part of your communication.

Video message types are natively supported by:

  • Apple Messages for Business
  • Instagram DM
  • Messenger
  • MMS
  • RCS
  • Viber Bots
  • Viber Business Messages
  • WhatsApp
NOTE

If you are using a channel that does not natively support videos as a message type then you can use the adaptationMode parameter as part of your API request to remove the unsupported element and deliver the message anyway without throwing an error.

Example video

json
{
  "messages": [
    {
      "channel": "WHATSAPP",
      "content": {
        "body": {
          "type": "VIDEO",
          "url": "http://my.domain/video.mp4"
        }
      },
      "options": {
        "adaptationMode": true
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ]
    }
  ]
}

Output

unified-api-video-example

Buttons

Add buttons to your communication to facilitate interaction.

Buttons are natively supported by:

  • Apple Messages for Business
  • Instagram DM
  • LINE (LON)
  • Messenger
  • RCS
  • Viber Bots
  • Viber Business Messages
  • WhatsApp
NOTE

Viber Business Messages only supports single buttons in messages. This can be achieved by using a single button block in your request rather than multiple button blocks.

NOTE

If you are using a channel that does not support buttons as a message type then you can use the adaptationMode parameter as part of your API request to remove the unsupported element and deliver the message anyway without throwing an error.

Example button

json
{
  "messages": [
    {
      "channel": "WHATSAPP",
      "content": {
        "body": {
          "text": "Thank you for joining us on Athleete Unlocked! Would you like to subscribe for future Athleete events?",
          "type": "TEXT"
        },
        "buttons": [
          {
            "type": "REPLY",
            "text": "Yes",
            "postbackData": "true"
          },
          {
            "type": "REPLY",
            "text": "No",
            "postbackData": "false"
          }
        ]
      },
      "options": {
        "adaptationMode": true
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ]
    }
  ]
}

Output

Message API Unified API Deliver anyway example

Contact message

The Contact message type allows users to send contact details directly to recipients, enabling them to view, message, or save contact information within their app. This feature supports seamless information sharing by allowing users to provide actionable contact details, which recipients can save or use to initiate instant communication.

Contact message types are natively supported by:

  • Viber Bots
  • WhatsApp
MAPI - Contact message

Carousel

Carousel messages allow customers to send multiple rich cards within a single message. Users can scroll horizontally through the rich cards, compare different items, and interact with individual cards by taking specific actions.

Carousel message types are natively supported by:

  • Instagram DM
  • Messenger
  • RCS
  • Viber Bots
Messages API - Carousel

Templates

Send messages from predefined templates.

Template message types are natively supported by:

  • LINE (LON)
  • WhatsApp

Message templates contain various sections including header, body, footer, and buttons. When sending template messages using the Messages API it is optional if you want to include header and button elements in your communication.

Templates with headers represent sending media in a templated message. See Templates with headers below for some example requests.

Example template

json
{
  "messages": [
    {
      "channel": "WHATSAPP",
      "content": {
        "body": {
          "1": "Jane",
          "2": "Doe",
          "type": "TEXT"
        }
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ],
      "template": {
        "templateName": "account_update",
        "language": "en_GB"
      }
    }
  ]
}

Output

unified-api-template-example-whatsapp

Templates with headers

Use Messages API to send template messages that contain data inside the header:

  • Text
  • Image
  • Document
  • Video
  • Location

The below example shows a WhatsApp template with a document header using the Messages API.

You can also adapt the header content to include image, location, and video as needed for your communication scenario.

Example template with header

json
{
  "messages": [
    {
      "channel": "WHATSAPP",
      "content": {
        "header": {
          "url": "https://mydocument.com",
          "filename": "Filename.doc",
          "type": "DOCUMENT"
        },
        "body": {
          "1": "Jane",
          "2": "Doe",
          "type": "TEXT"
        }
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ],
      "template": {
        "templateName": "receipt",
        "language": "en_GB"
      }
    }
  ]
}

Output

unified-api-template-with-headers-combined

Templates with buttons

Templates can also include buttons. The below example shows how you can render templates with buttons using with Messages API.

You can render the following button types:

  • URL - Redirects the user to a specified URL when clicked.
  • Quick reply - Provides predefined quick reply options that users can select.
  • Flow - Directs the user into a predefined interactive flow.
  • Copy code - Allows users to copy a specific code, such as a coupon, directly from the message.
  • Catalog - Displays a product catalog, allowing users to browse through products within the interface.
  • Multi-product - Showcases multiple products in a single template, providing an overview of several items simultaneously.

Example template with buttons

json
{
  "messages": [
    {
      "channel": "WHATSAPP",
      "content": {
        "body": {
          "1": "Jane",
          "2": "Doe",
          "type": "TEXT"
        },
        "buttons": [
          {
            "suffix": "search?q=123456",
            "type": "OPEN_URL"
          }
        ]
      },
      "sender": "441234567890",
      "destinations": [
        {
          "to": "440987654321"
        }
      ],
      "template": {
        "templateName": "appointment_update",
        "language": "en_GB"
      }
    }
  ]
}

Output

unified-api-template-with-buttons-combined

RCS templates (India only)

When communicating with customers in India, utilizing the RCS message templates is essential. This requirement aims to prevent the misuse of anti-spam regulations, however, it still allows you to leverage RCS for customer communications. Learn more about sending RCS messages in India using templates.

Stickers

Send sticker images that add personality and engagement to conversations. Stickers are typically static or animated images that can enhance user interaction, convey emotions, or emphasize branding in a fun, visual format.

Stickers are natively supported by:

  • Viber Bots
  • WhatsApp
Message API - Sticker

Location

Location messages allow you to seamlessly share latitude and longitude coordinates, providing mode contextual and real-time communication with your users. This feature enhances your ability to send location data along with your other messaging content.

Location message types are supported by:

  • Viber Bots
  • WhatsApp
Messages API - Location
Note

Location messages for WhatsApp can only be successfully delivered if the recipient has contacted the business within the last 24 hours. Otherwise, a template message (opens in a new tab) should be used.

Request location button

Use a Request location button to ask users to share their location directly through the message interface. This feature is ideal for cases where location information is necessary, such as coordinating deliveries or assisting users with location-based support. Users can select the button and share their location without manually entering their address or coordinates.

Request location buttons are natively supported by:

  • RCS
  • WhatsApp
Messages API - Location request

Need assistance

Explore Infobip Tutorials

Encountering issues

Contact our support

What's new? Check out

Release Notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Service Terms & ConditionsPrivacy policyTerms of use