Skip to main content
This guide covers working with messages inside a conversation: loading the message history, sending new messages, editing and deleting messages, and toggling emoji reactions.

Loading Messages

useLiveChatMessages fetches paginated messages for a conversation. Messages are stored in Redux and kept in sync by the ChatProvider socket.
useChatMessages was renamed to useLiveChatMessages. The old name still works as a deprecated alias.
Messages are sorted oldest-first in the returned array. loadOlder fetches messages older than the oldest currently loaded. To include attached files in the response, pass includeFiles: true:
See useLiveChatMessages.

Filtered / read-only queries

useLiveChatMessages is the live conversation stream and intentionally takes no filters. To fetch a filtered or read-only list of messages — for example, only messages that have replies — use useFetchManyChatMessagesWrapper, which keeps results in local state and never receives live socket traffic:
See useFetchManyChatMessages.

Sending Messages

useSendMessage returns an async function that sends a message and performs an optimistic insert — the message appears immediately in the UI with a temporary ID, then the temporary entry is replaced by the server-confirmed message.

Message Content Options

useSendMessage accepts a rich set of parameters:

Sending with Files

When files is provided, the hook automatically switches to a multipart form upload:
See useSendMessage.

Editing Messages

useEditMessage returns a function that takes conversationId, messageId, and updated content fields. The Redux store is updated immediately on success.
See useEditMessage.

Deleting Messages

useDeleteMessage performs a soft delete. The message is removed from the local Redux store immediately; on the server, it is soft-deleted (content cleared, userDeletedAt set).
See useDeleteMessage.

Reactions

useToggleReaction adds or removes an emoji reaction on a message. The response includes updated reactionCounts and userReactions:
See useToggleReaction.

Next Steps

Real-time

Typing indicators, unread counts, and read receipts

Threads

Threaded replies on messages