Skip to main content

Overview

Returns an async function that returns the direct (1:1) conversation with a given user, creating it when there is none. A direct conversation between the two users that already exists is returned rather than duplicated. The conversation is also stored in Redux state. Most hooks resolve to the plain record. This one resolves to { conversation, created }, because whether the call created the conversation is part of its answer.
Requires ChatProvider in the component tree.

Usage Example

Parameters

The hook returns a function. That function accepts:
string
required
The ID of the user to start a conversation with.

Returns

Conversation
The direct Conversation, existing or just created.
boolean
true when this call created the conversation (HTTP 201), false when it already existed (HTTP 200).

Notes