oneOnOneId

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',
photoUrl: 'https://demo.talkjs.com/img/alice.jpg',
welcomeMessage: 'Hey there! How are you? :-)',
role: 'default',
};
const other: TalkRn.User = {
id: '432156789',
name: 'Sebastian',
photoUrl: 'https://demo.talkjs.com/img/sebastian.jpg',
welcomeMessage: 'Hey, how can I help? https://google.com',
role: 'default',
};
const conversationId = TalkRn.oneOnOneId(other.id, me.id);