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:xmtp.org/text:1.0
Standard content types
All standard content types usexmtp.org as the authority ID.
Text
Plain text messages with UTF-8 encoding. Type ID:xmtp.org/text:1.0
Structure:
Markdown
Markdown-formatted text for rich content. Type ID:xmtp.org/markdown:1.0
Structure:
Reaction
Emoji or text reactions to messages. Type ID:xmtp.org/reaction:2.0
Structure:
"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:
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:
"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:
MultiRemoteAttachment
Multiple remote file references in a single message. Type ID:xmtp.org/multiRemoteAttachment:1.0
Structure:
ReadReceipt
Indicates message has been read. Type ID:xmtp.org/readReceipt:1.0
Structure:
TransactionReference
Reference to blockchain transaction. Type ID:xmtp.org/transactionReference:1.0
Structure:
WalletSendCalls
Wallet function call data (EIP-5792). Type ID:xmtp.org/walletSendCalls:1.0
Structure:
GroupUpdated
Group metadata change notification. Type ID:xmtp.org/groupUpdated:1.0
Structure:
LeaveRequest
Request to leave a group. Type ID:xmtp.org/leaveRequest:1.0
Structure:
Intent
User intent or action. Type ID:xmtp.org/intent:1.0
Structure:
Actions
Interactive action buttons or options. Type ID:xmtp.org/actions:1.0
Structure:
System content types
DeletedMessage
Placeholder for deleted messages (read-only). Type ID:xmtp.org/deletedMessage:1.0
Structure:
Custom content types
If LibXMTP encounters an unknown content type, it wraps it asMessageBody::Custom:
ContentCodec trait
All content types implement theContentCodec 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: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
