Skip to main content

Overview

Returns an async function that fetches the full details of a single conversation by ID. This is a low-level hook — it makes the API call and returns the result without touching Redux state. Use it when you need to fetch a conversation on demand rather than on mount.
Requires ChatProvider in the component tree.

Usage Example

import { useFetchConversation } from "@replyke/react-js";

function ConversationLoader({ conversationId }: { conversationId: string }) {
  const fetchConversation = useFetchConversation();

  const handleRefresh = async () => {
    const conversation = await fetchConversation({ conversationId });
    console.log(conversation);
  };

  return <button onClick={handleRefresh}>Refresh</button>;
}

Parameters

The hook returns a function. That function accepts:
conversationId
string
required
The ID of the conversation to fetch.

Returns

Conversation
Conversation
The fetched Conversation object.

Notes

  • This hook does not update Redux state. If you want the result stored and reactive, dispatch setConversation manually or use useConversation instead.
  • For integration guidance, see Chat: Conversations.