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
Exemple de code
// 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
Exemple de code
// 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).
Exemple de code
// markMessageRead() marks the message as read
bird?.appInbox?.markMessageRead(message)