Skip to main content

Content types with XMTP

All messages in XMTP are encoded with a content type to ensure interoperability and consistency of experience across the XMTP network.

Message payloads are transported as a set of bytes. This means that payloads can carry any content type that a client supports, such as plain text, JSON, or even non-text binary or media content.

The XMTP SDK allows developers to adopt new content types and put them to immediate use without going through a formal process. Client apps might choose to adopt those content types if they want to render those message types, but they can also rely on fall-back plain text.

Fall-back plain text is "alt text"-like description text that you can associate with original content if you are concerned that the receiving client app might not be able to handle the original content. If the receiving client app is unable to handle the original content, it displays the fall-back plain text instead.

Two predefined content types come bundled with the XMTP client SDK:

  1., which defines a default TextCodec for plaintext content
  2., which defines an optional CompositeCodec for multiple content types in a single message

The client SDK adopted these content types through the XMTP Improvement Proposal process, which enables a framework for community members to propose standards and achieve consensus about their adoption.

To learn more about content types, see Different types of content.

To learn how to use content types when developing a client app, see Use content types.

Questions? Give us feedback