Skip to main content

Overview

Returns an async function that submits a moderation report for a chat message. The report is visible to space moderators and admins in the dashboard.
Requires ChatProvider in the component tree.

Usage Example

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

function MessageContextMenu({
  conversationId,
  messageId,
}: {
  conversationId: string;
  messageId: string;
}) {
  const report = useReportMessage();

  const handleReport = async () => {
    await report({
      conversationId,
      messageId,
      reason: "spam",
      details: "This message is advertising unrelated products.",
    });
    alert("Report submitted.");
  };

  return <button onClick={handleReport}>Report message</button>;
}

Parameters

The hook returns a function. That function accepts:
conversationId
string
required
The ID of the conversation that contains the message.
messageId
string
required
The ID of the message to report.
reason
string
A short reason for the report (e.g. "spam", "harassment").
details
string
Additional context or description of the issue.

Returns

Promise<void>

Notes