Skip to main content

Overview

LibXMTP uses a codec system to encode and decode different types of message content. Each content type has a unique identifier and version, following the format:
Example: xmtp.org/text:1.0

Standard content types

All standard content types use xmtp.org as the authority ID.

Text

Plain text messages with UTF-8 encoding. Type ID: xmtp.org/text:1.0 Structure:
Encoding (Node.js):
Decoding:
Triggers push: Yes

Markdown

Markdown-formatted text for rich content. Type ID: xmtp.org/markdown:1.0 Structure:
Encoding (Node.js):
Triggers push: Yes

Reaction

Emoji or text reactions to messages. Type ID: xmtp.org/reaction:2.0 Structure:
Encoding (Node.js):
Fallback text: "Reacted with \"👍\" to an earlier message" Triggers push: No Legacy support: Version 1.0 uses JSON encoding, automatically converted to v2

Reply

Threaded replies to previous messages. Type ID: xmtp.org/reply:1.0 Structure:
Encoding (Node.js):
Enrichment: When using listEnrichedMessages(), the in_reply_to field is populated with the referenced message. Fallback text: "Replied with \"Great point!\" to an earlier message" (for text replies) Triggers push: Yes

Attachment

Direct file attachments with content embedded. Type ID: xmtp.org/attachment:1.0 Structure:
Encoding (Node.js):
Fallback text: "Can't display document.pdf. This app doesn't support attachments." Triggers push: Yes Note: For large files, use RemoteAttachment instead.

RemoteAttachment

Reference to externally stored file. Type ID: xmtp.org/remoteAttachment:1.0 Structure:
Usage: Upload file to external storage (IPFS, S3, etc.), then send reference. Triggers push: Yes

MultiRemoteAttachment

Multiple remote file references in a single message. Type ID: xmtp.org/multiRemoteAttachment:1.0 Structure:
Triggers push: Yes

ReadReceipt

Indicates message has been read. Type ID: xmtp.org/readReceipt:1.0 Structure:
Encoding (Node.js):
Triggers push: No Note: Empty payload, presence indicates receipt.

TransactionReference

Reference to blockchain transaction. Type ID: xmtp.org/transactionReference:1.0 Structure:
Encoding (Node.js):
Triggers push: Yes

WalletSendCalls

Wallet function call data (EIP-5792). Type ID: xmtp.org/walletSendCalls:1.0 Structure:
Triggers push: Yes

GroupUpdated

Group metadata change notification. Type ID: xmtp.org/groupUpdated:1.0 Structure:
Triggers push: No Note: Automatically sent when group name, image, or description changes.

LeaveRequest

Request to leave a group. Type ID: xmtp.org/leaveRequest:1.0 Structure:
Triggers push: No

Intent

User intent or action. Type ID: xmtp.org/intent:1.0 Structure:
Triggers push: Varies

Actions

Interactive action buttons or options. Type ID: xmtp.org/actions:1.0 Structure:
Triggers push: Varies

System content types

DeletedMessage

Placeholder for deleted messages (read-only). Type ID: xmtp.org/deletedMessage:1.0 Structure:
Note: Cannot be sent directly. Created automatically when messages are deleted.

Custom content types

If LibXMTP encounters an unknown content type, it wraps it as MessageBody::Custom:
Accessing custom content:

ContentCodec trait

All content types implement the ContentCodec trait:

Implementing custom codecs

Content type detection

Check content type before accessing fields:

Fallback text

Most content types include fallback text for clients that don’t support them:
Fallback text is automatically generated during encoding based on content type.

Source code references

  • Rust content types: crates/xmtp_content_types/src/
  • Node.js bindings: bindings/node/src/content_types/
  • Core codec trait: crates/xmtp_content_types/src/lib.rs:94
  • Message body enum: crates/xmtp_mls/src/messages/decoded_message.rs:61