Edit in GitHubLog an issue

API Reference

This document lists the public APIs available in the Messaging extension for implementing content card with UI.

getContentCardsUI

The getContentCardsUI method retrieves an array of ContentCardUI objects for the provided surface. These ContentCardUI objects provide the user interface for templated content cards to your application.

Parameters:

  • surface - The Surface for which the content cards should be retrieved.
  • customizer - An optional ContentCardCustomizing object to customize the appearance of the content card template. If you do not need to customize the appearance of the content card template, this parameter can be omitted.
  • listener - An optional ContentCardUIEventListening object to listen to UI events from the content card. If you do not need to listen to UI events from the content card, this parameter can be omitted.
  • completion - A completion handler that is called with a Result containing either:
    • success - An array of ContentCardUI objects representing the content cards to be displayed.
    • failure - An Error object indicating the reason for the failure, if any.

Syntax

Copied to your clipboard
public static func getContentCardsUI(for surface: Surface,
customizer: ContentCardCustomizing? = nil,
listener: ContentCardUIEventListening? = nil,
_ completion: @escaping (Result<[ContentCardUI], Error>) -> Void)

Example

Copied to your clipboard
// Download the content cards for homepage surface using Messaging extension
let homePageSurface = Surface(path: "homepage")
Messaging.updatePropositionsForSurfaces([homePageSurface])
// Get the content card UI for the homepage surface
Messaging.getContentCardsUI(for: homePageSurface) { result in
switch result {
case .success(let contentCards):
// Use the contentCards array to display UI for templated content cards in your application
case .failure(let error):
// Handle the error
}
}
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.