conversations.findAll()

The conversations.findAll() method retrieves the roster, which is a list of all Conversations that the current user is a part of.

Calling this method automatically loads any User and Group models that are part of these conversations.

The roster should usually be narrowed according to Organization, and to this effect each organization has a conversations field which contains their part of the roster.

Definition

client.conversations.findAll():Promise<Conversation[],Error>

Returns

An error will be thrown if any of the arguments are invalid.

Otherwise, once the returned Promise is resolved, you will have access to the array of Conversations.

Examples

const conversations = await client.conversations.findAll();
console.log('found', conversations.length, 'conversations');
conversations.forEach(function(conversation) {
if (
conversation.counterPartyType === 'user' ||
conversation.counterPartyType === 'distributionList'
) {
console.log(conversation.counterParty.displayName);
} else if (conversation.counterPartyType == 'group') {
console.log(
conversation.counterParty.displayName,
'group, members:',
conversation.counterParty.members
.map(function(user) {
return user.displayName;
})
.join(', ')
);
}
});