RCS API - Rich Card Specification

Rich cards allow you to combine media, text, and suggestions in one message. As such, media shouldn't be the only element in a rich card, and suggested replies or suggested actions should always accompany a standalone rich card.

Type of Rich Media Contents

Following type of Rich Media Contents are supported to be sent over RBM.

Media typeDocument typeExtension
application/pdfPDF.pdf
image/jpegJPEG.jpeg, .jpg
image/gifGIF.gif
image/pngPNG.png
video/h263H263 video.h263
video/m4vM4V video.m4v
video/mp4MP4 video.mp4
video/mpeg4MPEG-4 video.mp4, .m4p
video/mpegMPEG video.mpeg
video/webmWEBM video.webm

Note:

  • PDF files can't be used with Rich Card.

Rich Card Definition

JSON Object

{
"title": "{Plain Text}",
"description": "{Plain Text}",
"url": "{https url of media file}",
"id": "{uploaded file-id}",
"thumbnail_url": "{https url of media file}",
"thumbnail_id": "{uploaded file-id}",
"suggestions": [
{ suggestion }
]
}

Explaination:

Key/ObjectData TypeConstraintsDescription
titleStringRequiredTitle or name of the Card or Media
descriptionStringOptionalDescriptive text to follow in the Card
urlStringOptionalPublicly accessible HTTPS hosted URL for the Media File. Can't be used with id
idStringOptionalPre-Uploaded File-ID. Its alternate way to add media to card. Can't be used with url
thumbnail_urlStringOptionalPublicly accessible HTTPS hosted URL for a thubmnail image to be used in against the original larger Media File. Can't be used with thumbnail_id
thumbnail_idStringOptionalPre-Uploaded File-ID. Its alternate way to add thumbnail image to card. Can't be used with thumbnail_url
suggestionsArrayOptionalArray of suggestions. Each card may have one or more suggested actions that the user can interact with.

Read more....

Note

  • A Rich Card must have a media file either using HTTPS Public URL or through uploaded File ID.
  • A Rich Card may have maximum of 4 suggested actions or suggested replies. Suggestions are optional.
  • A card can't contain a combination of suggested actions and suggested replies on a single card.
  • The maximum size of a rich card payload is 250 KB.

Card Height

Cards expand vertically to fit their contents. Rich cards have a minimum height of 112 DP and a maximum height of 344 DP. If the contents of a card are not large enough to fill the minimum card height, the card expands and fills the extra height with whitespace.

Media in rich cards must fit one of three heights:

  • Short: 112 DP
  • Medium: 168 DP
  • Tall: 264 DP

If the media doesn't fit the dimensions within the card given the selected height, the media preview is chosen by zooming and cropping the media.

Card Orientation

Vertical rich cards

  • Aspect Ratio: Vertical rich cards display horizontal media at the top of the card. Horizontal media should have an aspect ratio of 2:1, 16:9, or 7:3.
  • Size & Resolution: When you send media to a user, you should be respectful of the user's resources. With 2:1 Ratio Horizontal media:
    • Optimal resolution for Image: 1440x720px
    • Optimal resolution for Thumbnail: 770x335px
    • Max Image File Size: 2 MB
    • Max Video File Size: 10 MB
    • Recommended Thumbnail File Size: 40-100 KB

Horizontal rich cards

  • Aspect Ratio: Horizontal rich cards display vertical media on the left or right side of the card. Vertical media should have an aspect ratio of 3:4.
  • Size & Resolution: When you send media to a user, you should be respectful of the user's resources. With vertical media has a 3:4 ratio:
    • Optimal resolution for Image: 768x1024px

    • Optimal resolution for Thumbnail: 250x330px

    • Max Image File Size: 2 MB

    • Max Video File Size: 10 MB

    • Recommended Thumbnail File Size: 40-100 KB