Skip to content
Menu

Content cards

Content cards overview

Markdown version

What content cards are, how they reach the device, the three card types and every field in the card data model.

Content cards are persistent messages that live inside your app, in a feed or any other place you choose, until they expire or the user dismisses them. Unlike a push notification, a card waits for the user: it is there the next time they open the screen.

Who it's for

  • Lifecycle teams who want a message channel that does not depend on push permission and does not interrupt the user.
  • Mobile engineers who need a list of cards to render, either with the ready-made feed or in their own views.

How it works

  1. A Herald agent decides to send a user a message on the content card channel of a Herald sending connection.
  2. Herald stores the card for that user. Nothing is sent to the device yet.
  3. The SDK fetches the user's cards at the start of each session, when a user is first identified, and whenever you call refreshContentCards(). The request carries an ETag, so an unchanged list costs one small response.
  4. Your app shows the cards with the default feed or your own UI.
  5. Impressions, clicks and dismissals go back to Herald and are credited to the decision that produced the card, so the agent learns which messages work.

Cards are fetched for identified users only. An anonymous device gets an empty list. With identity verification set to Required or Optional, the user also needs a valid user token; see Users and identity.

Card types

TypeWire valueWhat it shows
ClassicclassicTitle, body and an optional call to action
Captioned imagecaptioned_imageAn image (16:9 in the default feed) above the title, body and call to action
Image onlyimage_onlyAn image (2:1 in the default feed), with no text. Screen readers read the title, or extras["alt"] when the card has no title

A card whose type the SDK does not recognize is skipped, and the rest of the list still loads.

Card data model

ContentCard has the same fields on both platforms. Swift types are on the left, Kotlin types on the right.

FieldiOSAndroidMeaning
idStringStringUnique card ID. Interactions are logged under it.
typeContentCard.CardTypeContentCardTypeclassic, captionedImage / CAPTIONED_IMAGE, imageOnly / IMAGE_ONLY
titleString?String?Headline
bodyString?String?Body text
imageUrlURL?String?Image for captioned and image-only cards. For a video, its poster.
videoUrl, videoPosterUrlURL?String?A video for captioned-image cards (0.6.0), and its poster, the same as imageUrl. See Video.
videoAutoplayBoolBooleanPlay muted and looped in the default feed while half visible (0.6.0). false by default.
creditMediaCredit?MediaCredit?name, profileUrl and sourceUrl of a stock photo or video's creator (0.6.0)
ctaString?String?Call-to-action label, such as "Try Plus"
urlURL?String?Deep link or web URL opened on click. A card without a URL is not tappable in the default feed.
extras[String: HeraldValue]Map<String, Any?>Free-form key-value data for your own UI
pinnedBoolBooleanPinned cards sort first in the default feed
dismissibleBoolBooleanWhether the user may dismiss the card
categories[String]List<String>Labels you can filter on
createdAtDateLong (epoch ms)When Herald created the card
expiresAtDate?Long? (epoch ms)After this time the card is no longer shown. Null means no expiry.
viewedBoolBooleanAn impression was logged for this card
clickedBoolBooleanA click was logged for this card
dismissedBoolBooleanThe card was dismissed
decisionIdString?String?The Herald decision the card came from. The SDK sends it back with each interaction.

viewed and clicked come from Herald on every sync and are updated on the device as soon as you log an impression or click, so you can use them for an unread badge.

What the SDK keeps on the device

  • The card list is stored with the rest of the SDK state, so cards show offline and at launch, before the first sync finishes.
  • The list you read contains only cards that are unexpired and not dismissed, in the order Herald returns them: newest first.
  • Herald returns at most the 100 newest active cards for a user.
  • reset() and switching users clear the list. The next user's cards arrive with their first sync.

What an agent sends

A card sent by a Herald agent carries the variant's title, body, call to action and deep link. By default it is a captioned_image card when the message variant has an image and a classic card otherwise, dismissible, not pinned, with no categories, no extras and no expiry.

You change the card type, pinning, dismissal, categories, extras and expiry per variant in Delivery options (mobile SDK). See Create cards in Herald.

Next

See Herald decide live →