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.

1getConversationBuilder(conversationId: string): ConversationBuilder

Parameters

NameTypeDescription
conversationId RequiredstringThe conversation ID

Returns

ConversationBuilder

Example

1import * as TalkRn from '@talkjs/react-native';
2
3const me: TalkRn.User = {
4 id: '123456789',
5 name: 'Alice',
6 email: '[email protected]',
7 photoUrl: 'https://talkjs.com/images/avatar-1.jpg',
8 welcomeMessage: 'Hey there! How are you? :-)',
9 role: 'default',
10};
11
12const other: TalkRn.User = {
13 id: '432156789',
14 name: 'Sebastian',
15 email: '[email protected]',
16 photoUrl: 'https://talkjs.com/images/avatar-5.jpg',
17 welcomeMessage: 'Hey, how can I help? https://google.com',
18 role: 'default',
19};
20
21const conversationId = TalkRn.oneOnOneId(me.id, other.id);
22const conversationBuilder = TalkRn.getConversationBuilder(conversationId);
23
24conversationBuilder.setParticipant(me);
25conversationBuilder.setParticipant(other, { notify: false });
26
27conversationBuilder.setAttributes({ subject: 'Random conversation' });