Skip to main content

Overview

Returns an async function that sends a message to a conversation. An optimistic entry is inserted into Redux immediately — with a temporary ID — and replaced by the server-confirmed message on success. If the request fails, the optimistic message is flagged with sendFailed: true.
Requires ChatProvider in the component tree.

Usage Example

Props

conversationId
string
required
The ID of the conversation to send the message to.

Parameters

The hook returns a function. That function accepts:
content
string
Plain text content of the message.
gif
GifData
GIF attachment data.
mentions
Mention[]
User mentions to embed in the message.
metadata
Record<string, any>
Arbitrary key-value data attached to the message.
quotedMessageId
string | null
ID of the message being quoted. Populates quotedMessage on the stored message.
parentMessageId
string | null
ID of the parent message when sending a thread reply.
files
File[]
File attachments. When provided, the request is sent as multipart/form-data.

Returns

ChatMessage
ChatMessage
The server-confirmed ChatMessage object. When spaceReputation is requested, its embedded sender carries an added spaceReputation number. See Reputation.

Notes

  • At least one of content, gif, files, or non-empty metadata should be provided for a meaningful message.
  • For integration guidance, see Chat: Messages.