getConversationBuilder

A factory function used to retrieve a ConversationBuilder object based on the conversationId given.

The ConversationBuilder object encapsulates a conversation between 2 or more participants. Use the methods, setParticipant and setAttributes on the returned object to further set up your conversation.

getConversationBuilder(conversationId: string): ConversationBuilder

Parameters

NameTypeDescription
conversationId RequiredstringThe conversation ID

Returns

ConversationBuilder

Example

TypeScript
import * as TalkRn from '@talkjs/react-native';
const me: TalkRn.User = {
id: '123456789',
name: 'Alice',
photoUrl: 'https://talkjs.com/images/avatar-1.jpg',
welcomeMessage: 'Hey there! How are you? :-)',
role: 'default',
};
const other: TalkRn.User = {
id: '432156789',
name: 'Sebastian',
photoUrl: 'https://talkjs.com/images/avatar-5.jpg',
welcomeMessage: 'Hey, how can I help? https://google.com',
role: 'default',
};
const conversationId = TalkRn.oneOnOneId(me.id, other.id);
const conversationBuilder = TalkRn.getConversationBuilder(conversationId);
conversationBuilder.setParticipant(me);
conversationBuilder.setParticipant(other, { notify: false });
conversationBuilder.setAttributes({ subject: 'Random conversation' });