Skip to main content

Embedded Messaging API

Use the embedded messaging API to apply and manage message filters independently of the built-in components.

Using Built-In Components for Filtering

The following components include built-in filter controls for read/unread state and categories:

  • Android / KMP: EmbeddedMessagingView with showFilters = true
  • iOS: ViewController with showFilters = true
  • Web: <ec-embedded-messaging>

These controls are connected to the component's internal state and update the message list automatically.

Filter by Unread State

Filter the message list to show only unread messages.

// Show only unread messages
EngagementCloud.embeddedMessaging.filterUnreadOnly(true)

// Show all messages
EngagementCloud.embeddedMessaging.filterUnreadOnly(false)

// Check if unread filter is active
val isFilteringUnread = EngagementCloud.embeddedMessaging.isUnreadFilterActive

Filter by Category

Filter the message list by specific categories.

// Get available categories
val categories = EngagementCloud.embeddedMessaging.categories

// Filter by specific categories
EngagementCloud.embeddedMessaging.filterByCategories(listOf(category1, category2))

// Clear category filter and show all categories
EngagementCloud.embeddedMessaging.filterByCategories(emptyList())

// Get currently active category filters
val activeFilters = EngagementCloud.embeddedMessaging.activeCategoryFilters

API Reference

Category Model

Each category has the following properties:

PropertyTypeDescription
idStringUnique identifier for the category
textStringDisplay text of the category

Properties

PropertyTypeDescription
categoriesList<Category>All available categories for filtering
isUnreadFilterActiveBooleantrue if showing only unread messages
activeCategoryFiltersList<Category>Currently selected categories

Methods

MethodParametersDescription
filterUnreadOnlyfilterUnreadOnly: BooleanEnable or disable the unread-only filter
filterByCategoriescategories: List<Category>Filter by categories, or pass an empty list to clear

Combining Filters

Filters can be combined. For example, you can show only unread messages in a specific category:

// Show only unread messages in category1
EngagementCloud.embeddedMessaging.filterUnreadOnly(true)
EngagementCloud.embeddedMessaging.filterByCategories(listOf(category1))