Usage
The bird.appinbox
is the main entry point for app inbox in Bird client SDKs. Through which you can do the following:
Get messages
Listen to incoming messages
Mark message as read
Get messages
// getAppInboxMessages() returns a flow which you can gradually consume
bird?.appInbox?.getAppInboxMessages()?.collect { message ->
println("Message: $message")
}
// or you can consume the whole flow into one list
val allMessages = bird?.appInbox?.getAppInboxMessages()?.toList()
Listen to incoming messages
App inbox messages will arrive in real-time when the client application is opened. You can listen to incoming messages as shown in this example
// incoming is a Channel<AppInboxMessage> through which you can
// listen to incoming messages
bird?.appInbox?.incoming?.consumeEach { message ->
println("Message: $message")
}
Mark message as read
Each message has a readAt
field to indicate whether is read or unread and when the message was read. You can mark a message as read by calling bird.appinbox.markMessageRead(message)
.
// markMessageRead() marks the message as read
bird?.appInbox?.markMessageRead(message)
Last updated
Was this helpful?