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.

oneOnOneId

Generate a conversation ID from two users' IDs.

View as Markdown

Use this helper method to predictably compute a Conversation ID based on participants' ids in the given conversation. Use this method if you want to simply create a conversation between two users, not related to a particular product, order or transaction. The order of the parameters does not matter.

oneOnOneId(me: User | string, other: User | string): string

Parameters

NameTypeDescription
me RequiredUser | stringA TalkJS User or a string containing the User ID.
other RequiredUser | stringA TalkJS User or a string containing the User ID.

Returns

string

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(other.id, me.id);