convex-chat
Reference

Host API

The public integration surface exposed by actor-scoped host helpers.

exposeChatApi creates Convex functions that resolve the actor in your host application before calling the component.

Conversations and messages

  • listConversations returns conversation summaries for the actor and accepts an optional bounded limit.
  • listMessages returns ordered message projections after membership checks and accepts optional beforeSequence and limit arguments for older-page loading.
  • sendText sends an idempotent text message.
  • sendAttachment sends a provider-neutral attachment descriptor.
  • editOwnTextPart replaces the actor's text part when its expected revision matches.
  • deleteOwnMessage creates a delete-for-everyone tombstone and returns attachment keys for host cleanup.
  • setReaction toggles an allowlisted reaction.
  • markReadThrough advances the actor's read watermark monotonically.

Presence

  • heartbeatOnline, disconnectOnline, and listOnline maintain app-level availability scoped to chat participants.
  • heartbeatPresence, disconnectPresence, and listPresence maintain conversation sessions used for typing.
  • setTyping updates the actor's conversation-scoped typing state.

Applications may omit the presence wrappers when presence is disabled by product policy.

Trusted membership access

Hosts can call components.chat.conversations.getMemberAccess and components.chat.conversations.setMemberAccess from trusted Convex functions. The mutation requires the current membership revision. It projects host policy to read_write, read_only, or none without moving relationship rules into the component.

Do not expose these component functions directly to clients. Authenticate the caller and apply product policy in the host mutation first. A nested component mutation participates in the host mutation transaction, so both changes roll back if either operation fails.

See the generated TypeScript declarations and package README for the exact arguments available in the current release candidate.

On this page