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