onUserJoinedConversation
Triggered when one or more new people join a conversation your App is already in.
warning
Invoked also when App itself is added to a conversation.
Received properties
conversationId— Identifier of the conversation the people are added to.members— List of added members, represented byConversationMemberobjects.
Each member includes:userId— Unique user ID (QualifiedId).role— The user’s role in the conversation:ADMINorMEMBER.
Sample usage
Greeting new joiners
- Kotlin
- Typescript
override suspend fun onUserJoinedConversation(
conversationId: QualifiedId,
members: List<ConversationMember>
) {
val users = members.map { manager.getUserSuspending(it.userId) }
val welcomeText = buildString {
append("Welcome ")
append(users.joinToString(" and ") { it.name })
append("!")
}
val message = WireMessage.Text.create(
conversationId = conversationId,
text = welcomeText
)
manager.sendMessageSuspending(message)
}
public override async onUserJoinedConversation(
conversationId: QualifiedId,
members: ConversationMember[]
): Promise<void> {
const users = await this.manager.getUsers(members.map((member) => member.userId))
const welcomeText = `Welcome ${users.map((user) => user.name).join(' and ')}!`
const message = TextMessage.create({
conversationId: conversationId,
text: welcomeText
})
await this.manager.sendMessage(message)
}