Skip to main content
This guide covers sending messages, working with different content types, and managing message delivery in LibXMTP groups.

Sending Text Messages

Basic Message Sending

Send a simple text message:
Messages are sent as encoded content that specifies the content type. This allows receivers to properly decode and display the message.

Send Message Options

Control message behavior with SendMessageOpts:

Optimistic Sending

Send messages without waiting for network confirmation:
Optimistic messages are visible locally immediately but may fail to send. Always call publish_messages() to ensure delivery.

Content Types

LibXMTP supports multiple content types for rich messaging.

Text Content

Reactions

Send reactions to messages:

Replies

Reply to specific messages:

Delete Messages

Delete your own messages or (as super admin) others’ messages:
Or use the helper method:

Reading Messages

Message Delivery Status

Check Delivery Status

Publish Pending Messages

Send all locally queued messages:

Advanced Usage

Custom Content Types

Define your own content type:

Message Count

Count messages matching criteria:

Read Receipts

Get last read times by sender:

TypeScript (Node.js) Examples

Error Handling

Best Practices

Next Steps

Permissions and Policies

Control who can send messages and perform actions

Consent Management

Manage user consent and block unwanted messages