For AI agents: Find a documentation index at https://talkjs.com/llms.txt (full content at https://talkjs.com/llms-full.txt). Get a markdown version of any page by appending .md to its URL path.

getConversationBuilder

Get a builder to create or update a conversation.

View as Markdown

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',
  email: 'alice@example.com',
  photoUrl: 'https://talkjs.com/images/avatar-1.jpg',
  welcomeMessage: 'Hey there! How are you? :-)',
};

const other: TalkRn.User = {
  id: '432156789',
  name: 'Sebastian',
  email: 'Sebastian@example.com',
  photoUrl: 'https://talkjs.com/images/avatar-5.jpg',
  welcomeMessage: 'Hey, how can I help? https://google.com',
};

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' });