Tech Blog

Rich cards and carousels: how to format content in RCS

A rich card is a message with an image, a title, text and up to four buttons. A carousel is two to ten of those cards in a row, which the recipient swipes through sideways. Both are sent with the same API call as a plain text message: instead of text, you pass a rich_card object. Add an SMS text to the same call and the message also reaches recipients who don't have RCS.

AndroidA rich card from Kustbanken in Google Messages: a photo of a bank card, the title Your new bank card is on its way, a short text and the button Track delivery
iPhoneThe same rich card in Messages on iPhone: image, title, text and the button
The same rich card on Android and iPhone.

Key points

  • A rich card has an image or video, a title, a description and buttons.
  • A carousel is several cards in a row. Each card has the same parts and the same limits as a single rich card.
  • The image must be a JPEG, PNG or GIF at a public URL, in the aspect ratio that matches the card's height.
  • Android crops the image to the card's height. iPhone always shows the whole image.
  • If the recipient doesn't have RCS, your SMS text is sent instead. The image and buttons are left out, so the text has to work on its own.

What is a rich card?

A rich card puts an image, text and buttons in a single message. The recipient sees it as a box in their messaging app and can act on it straight away with a button: open a link, call, show a place on a map, add an event to their calendar or answer with a preset reply.

A card has four parts. All of them are optional, as long as the card has at least an image, a title or a description:

PartAPI fieldLimit
Image or videomediaImages JPEG, PNG or GIF. Video MP4, M4V, MPEG, WebM or H.263. At most 100 MB per file
Titletitle200 characters
Descriptiondescription2,000 characters
Buttonssuggestions4 per card, 25 characters per button text

All limits are listed in our API documentation.

A card is either vertical, with the image at the top, or horizontal, with the image to the left or right of the text. You set this with card_orientation (VERTICAL or HORIZONTAL) and thumbnail_image_alignment (LEFT or RIGHT, used only for horizontal cards). For a vertical card, you choose the image height with height:

heightHeight on AndroidAspect ratio that fits
SHORT112 dp7:2
MEDIUM168 dp21:9
TALL264 dp3:2

Dp (density-independent pixels) is Android's scale-free unit: the same size on screen whatever the phone's pixel density.

Also set content_description, a description of the image of at most 200 characters. Screen readers read it aloud.

How to send a rich card

The example sends a vertical card with an image, a title, text and one button that opens a web page. sms_fallback is the SMS text that is sent if the recipient can't receive RCS.

The response

The API responds with 202 Accepted and the message's id. The same id comes back in every event sent to your webhook: delivered, read, and when the recipient taps a button.

JSON
{
  "message_id": "550e8400-e29b-41d4-a716-446655440000",
  "client_message_id": null
}

Tapping a button sends the button's postback_data to your webhook, so your system knows which button it was without having to interpret text. The buttons and what they can do are covered in a separate article on suggested replies and actions.

How do you build a carousel?

A carousel is a list of two to ten cards in carousel_card.card_contents. Each card has the same parts and limits as a single rich card, with up to four buttons per card. The cards are always vertical, with the image at the top. You choose the width for the whole carousel with card_width:

card_widthMaximum card height on Android
SMALL542 dp
MEDIUM592 dp

Three things to keep in mind:

  • The same height and image format in every card. All cards are drawn as tall as the tallest one. With the same height and images in the same aspect ratio, the row looks even.
  • Short texts. If the content doesn't fit, it is shortened in this order: the description to one line, the title to one line, the buttons are removed, the description is removed, the title is removed.
  • Most important first. The recipient sees the first card straight away. They have to swipe to see the rest.

The example sends three cards, each with its own image, title, text and button.

The response

JSON
{
  "message_id": "550e8400-e29b-41d4-a716-446655440000",
  "client_message_id": null
}

Rich cards and carousels side by side

Rich cardCarousel
API fieldrich_card.standalone_cardrich_card.carousel_card
Number of cardsOneTwo to ten
LayoutVertical (image at the top) or horizontal (image to the left or right)Vertical only
ImageOne, height SHORT, MEDIUM or TALLOne per card, ideally the same height and format in all of them
Size on AndroidImage height 112, 168 or 264 dpCard width SMALL or MEDIUM
TitleAt most 200 charactersAt most 200 characters per card
DescriptionAt most 2,000 charactersAt most 2,000 characters per card, shortened if the card gets too tall
ButtonsUp to four, 25 characters per button textUp to four per card
Good forA single message with one or a few actions: a delivery, a booking, a reminderA selection to choose from: products, times, offers

What does it look like on Android and iPhone?

Android and iPhone show the same card, with the same title and text, but they handle the image and the buttons differently:

  • Android (Google Messages) draws the image at the height you set with height. If the image has a different aspect ratio, it is zoomed in and cropped from the centre, so the edges may be cut off. The buttons are shown directly on the card.
  • iPhone (Messages) ignores height. Vertical cards and carousels always show the whole image. If a card has two or more buttons that open a link or make a call, they are collected in a menu, Options, that the recipient has to open first. A reply button is shown as a separate bubble below the card instead.

So make the image in the aspect ratio that matches the height, for example 3:2 for TALL as in the example. It then looks the same on both, and nothing important is cropped away on Android. Never put text or a logo close to the edges of the image.

AndroidKustbanken's carousel in Google Messages: cards with an image, a title, text and the button Read more
iPhoneThe same carousel in Messages on iPhone
The same carousel on Android and iPhone.

What happens if the recipient doesn't have RCS?

The text in sms_fallback is then sent as a regular SMS from the sender you specify, and your webhook receives the sms.out.sent event. The image and the buttons are left out. The same applies if you have set timeout_seconds and the RCS message hasn't been delivered before the time runs out.

So write the SMS text to work on its own:

  • The message in plain words, without referring to the image.
  • A link in place of the most important button. The other buttons can live on the web page.
  • The sender is a name of at most 11 characters (letters and digits) or a phone number.
  • At most 1,530 characters.

If you want to know in advance which recipients have RCS, you can ask the API before you send. How fallback works is described in RCS vs SMS.

Frequently asked questions

How large can the image in a rich card be?
At most 100 MB per file. The image must be a JPEG, PNG or GIF at a public URL. Smaller files load faster on the recipient's phone. Choose the aspect ratio to match the card's height: 7:2 for SHORT, 21:9 for MEDIUM and 3:2 for TALL.
Do carousels work on iPhone?
Yes. An iPhone that receives RCS shows the carousel with all its cards, and always shows the whole image in each card. The status page lists which iPhone models and operators support RCS.
How many buttons can a rich card have?
Up to four per card, with at most 25 characters of text per button. Below the card, the message can also have suggested replies, up to eleven in total per message.
What does a recipient without RCS get?
The recipient gets the SMS text you set in sms_fallback, without the image and buttons. If you haven't set an SMS text, the recipient gets no message, and your webhook receives the rcs.out.failed event.
Can a rich card have video?
Yes. Set a video file, such as an MP4, in file_url, at most 100 MB, and ideally a thumbnail in thumbnail_url that is shown before the video plays.
Can I test a card without sending it?
Yes. With "dry_run": true, the API checks the call and responds as usual, but nothing is sent. Errors in the call, such as a button text that is too long, come back straight away with the field that is wrong. To see the card on a real phone, add the phone as a test number.

Get started with rich cards and Spirius

Rich cards and carousels are sent through our RCS API, with a verified sender and SMS fallback in the same call. All fields and limits are described in the API documentation. Read more about what RCS can do on our RCS page.

Sources