false
, making it non-visible.false
, making it non-visible.You're right, when using a custom chat launch button with the embedded code approach for the Omnichannel widget in mobile apps, you lose the out-of-the-box unread message count indicator. The Live Agent SDK, at the time of writing, doesn't directly expose an API to fetch this unread message count for custom UI elements.
However, you can achieve this functionality by leveraging the events provided by the Live Agent SDK and managing the unread message count within your mobile application's state. Here's a potential approach:
Leveraging SDK Events and Managing State in Your Mobile App:
newMessage
: This event is triggered whenever a new message is received in the conversation. You'll need to filter these messages to identify those sent by the agent (as opposed to the customer).useState
, Vue's ref
, or similar mechanisms in other frameworks) to keep track of the number of unread agent messages. Initialize this counter to zero.newMessage
Event Handler:
newMessage
event is triggered:
message.sender
or a similar property of the message object to determine if the message was sent by an agent.Example (Conceptual React-like Implementation):
Key Considerations:
message
object emitted by the newMessage
event to reliably identify messages sent by agents. The property name might vary slightly depending on the SDK version.chatVisible
event of the SDK for this purpose.Limitations of This Approach:
In summary, while the Live Agent SDK doesn't offer a direct API to retrieve the unread message count, you can effectively implement this functionality for your custom button by subscribing to the newMessage
event, maintaining an unread message counter in your app's state, and updating your custom button's UI accordingly. Remember to reset the counter when the chat window is opened.
André Arnaud de Cal...
294,273
Super User 2025 Season 1
Martin Dráb
233,019
Most Valuable Professional
nmaenpaa
101,158
Moderator