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.

1oneOnOneId(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

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};
10
11const other: TalkRn.User = {
12 id: '432156789',
13 name: 'Sebastian',
14 email: '[email protected]',
15 photoUrl: 'https://talkjs.com/images/avatar-5.jpg',
16 welcomeMessage: 'Hey, how can I help? https://google.com',
17};
18
19const conversationId = TalkRn.oneOnOneId(other.id, me.id);