> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create direct conversation

> Create or retrieve a 1:1 direct conversation with another user

## Overview

Returns an async function that creates a direct (1:1) conversation with a given user. If a direct conversation between the two users already exists on the server, it is returned rather than creating a duplicate. The conversation is also stored in Redux state.

> [!NOTE]
>
> Requires `ChatProvider` in the component tree.

## Usage Example

```tsx theme={null}
import { useCreateDirectConversation } from "@sublay/react-js";

function UserCard({ userId }: { userId: string }) {
  const createDirect = useCreateDirectConversation();

  const handleMessage = async () => {
    const conversation = await createDirect({ userId });
    // Navigate to the conversation, e.g. router.push(`/chat/${conversation.id}`)
  };

  return <button onClick={handleMessage}>Message</button>;
}
```

## Parameters

The hook returns a function. That function accepts:

**userId** `string` *required*

The ID of the user to start a conversation with.

## Returns

**Conversation** `Conversation`

The created or retrieved direct [Conversation](https://docs.sublay.io/v7/data-models/conversation.md).

## Notes

* For integration guidance, see [Chat: Conversations](https://docs.sublay.io/v7/sdk/chat/conversations.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.