Skip to content

Releases: xmtp/xmtp-js

@xmtp/browser-sdk@6.0.1

13 Jan 15:56
b5bba09

Choose a tag to compare

Fixed reply content type exports

@xmtp/browser-sdk@6.0.0

13 Jan 00:25
a53d973

Choose a tag to compare

This release introduces breaking changes and new features. If you've been building on a previous release, updating your app to use this release will require changes to your existing code.

BREAKING CHANGES

Removed features

  • Removed uploadDebugArchive method from Client.DebugInformation
  • Removed debugEventsEnabled client option
  • Removed deprecated Client.version static property (use Client.libxmtpVersion instead)
  • Removed Conversation.sendOptimistic method (use dedicated send methods with the optimistic parameter instead)
  • Removed codecFor, encodeContent, decodeContent, and prepareForSend client methods (content encoding is now handled by dedicated send methods)
  • Removed Conversation.isCommitLogForked property
  • Removed DecodedMessage.compression property
  • Removed DecodedMessage.parameters property
  • Removed MessageKind and MessageDeliveryStatus type exports (use GroupMessageKind and DeliveryStatus enums instead)
  • Removed most Safe* conversion types and functions from exports (these were mostly for internal usage and are no longer necessary):
    • Types: SafeContentTypeId, SafeEncodedContent, SafeMessage, SafeListMessagesOptions, SafeSendMessageOpts, SafeListConversationsOptions, SafePermissionPolicySet, SafeCreateGroupOptions, SafeCreateDmOptions, SafeInstallation, SafeInboxState, SafeConsent, SafeGroupMember, SafeHmacKey, SafeHmacKeys, SafeMessageDisappearingSettings, SafeKeyPackageStatus, SafeXMTPCursor, SafeConversationDebugInfo, SafeApiStats, SafeIdentityStats
    • Functions: toContentTypeId, fromContentTypeId, toSafeContentTypeId, fromSafeContentTypeId, toEncodedContent, fromEncodedContent, toSafeEncodedContent, fromSafeEncodedContent, toSafeMessage, toSafeListMessagesOptions, fromSafeListMessagesOptions, toSafeSendMessageOpts, fromSafeSendMessageOpts, toSafeListConversationsOptions, fromSafeListConversationsOptions, toSafePermissionPolicySet, fromSafePermissionPolicySet, toSafeCreateGroupOptions, fromSafeCreateGroupOptions, toSafeCreateDmOptions, fromSafeCreateDmOptions, toSafeInstallation, toSafeInboxState, toSafeConsent, fromSafeConsent, toSafeGroupMember, fromSafeGroupMember, toSafeHmacKey, toSafeMessageDisappearingSettings, fromSafeMessageDisappearingSettings, toSafeKeyPackageStatus, toSafeConversationDebugInfo, toSafeApiStats, toSafeIdentityStats

Updated types

Many types that were previously string literals or interfaces are now numeric enums.

The following types are now numeric enums:

  • ConsentEntityType
  • ConsentState
  • ContentType
  • ConversationType
  • DeliveryStatus
  • GroupMembershipState
  • GroupMessageKind
  • GroupPermissionsOptions
  • IdentifierKind
  • LogLevel
  • MetadataField
  • PermissionLevel
  • PermissionPolicy
  • PermissionUpdateType
  • SortDirection

Other type updates:

  • DecodedMessage.kind and deliveryStatus fields now use enum values instead of strings
  • Conversation type value is now an enum in metadata
  • loggingLevel client option is now uses LogLevel numeric enum
// DecodedMessage.kind and deliveryStatus now use enums

// OLD
if (message.kind === "application") { ... }
if (message.deliveryStatus === "published") { ... }

// NEW
import { GroupMessageKind, DeliveryStatus } from "@xmtp/browser-sdk";

if (message.kind === GroupMessageKind.Application) { ... }
if (message.deliveryStatus === DeliveryStatus.Published) { ... }

// `loggingLevel` client option is now uses `LogLevel` numeric enum
import { LogLevel } from "@xmtp/browser-sdk";

// OLD
const client = await Client.create(signer, { loggingLevel: "off" });

// NEW
const client = await Client.create(signer, { loggingLevel: LogLevel.Off });

// Conversation type value is now an enum in metadata

// OLD
if (conversation.metadata.conversationType === "group") { ... }

// NEW
import { ConversationType } from "@xmtp/browser-sdk";

if (conversation.metadata.conversationType === ConversationType.Group) { ... }

Refactored or renamed functions

Method names have been updated to follow a consistent naming convention across the SDK. Methods that make network requests now use fetch prefix to distinguish them from local operations. Conversation creation methods now use create prefix for clarity. Several properties that could return variable internal state have been converted to functions.

  • Updated Conversation.send method signature
  • Renamed Client.getKeyPackageStatusesForInstallationIds to Client.fetchKeyPackageStatuses
  • Renamed Client.getInboxIdByIdentifier to Client.fetchInboxIdByIdentifier
  • Renamed static Client.inboxStateFromInboxIds to static Client.fetchInboxStates
  • Renamed Conversation.getHmacKeys to Conversation.hmacKeys
  • Conversation.consentState is now a function
  • Renamed Conversations.getDmByIdentifier to Conversations.fetchDmByIdentifier
  • Renamed Conversations.newGroupOptimistic to Conversations.createGroupOptimistic
  • Renamed Conversations.newGroupWithIdentifiers to Conversations.createGroupWithIdentifiers
  • Renamed Conversations.newDmWithIdentifier to Conversations.createDmWithIdentifier
  • Renamed Conversations.newGroup to Conversations.createGroup
  • Renamed Conversations.newDm to Conversations.createDm
  • Group.permissions is now a function
  • Group.isPendingRemoval is now a function
  • Group.admins property is now Group.listAdmins function
  • Group.superAdmins property is now Group.listSuperAdmins function
  • Removed Preferences.getLatestInboxState
  • Refactored Preferences.inboxState
  • Added Preferences.fetchInboxState
  • Refactored Preferences.inboxStateFromInboxIds into Preferences.getInboxStates and Preferences.fetchInboxStates
  • Renamed Dm.getDuplicateDms to Dm.duplicateDms
// Conversation.send method signature changed

// OLD
await conversation.send("hello");
await conversation.send(reactionContent, ContentTypeReaction);

// NEW - use dedicated send methods for built-in content types (see below for more details)
await conversation.sendText("hello");
await conversation.sendReaction(reaction);

// NEW - use send() for custom content types with EncodedContent
await conversation.send(encodedContent, {
  shouldPush: true,
  optimistic: false,
});

// Properties that are now functions

// OLD
const consentState = conversation.consentState;
const permissions = group.permissions;
const isPendingRemoval = group.isPendingRemoval;
const admins = group.admins;
const superAdmins = group.superAdmins;

// NEW
const consentState = conversation.consentState();
const permissions = group.permissions();
const isPendingRemoval = group.isPendingRemoval();
const admins = group.listAdmins();
const superAdmins = group.listSuperAdmins();

// Creating conversations

// OLD
const group = await client.conversations.newGroup(inboxIds);
const dm = await client.conversations.newDm(inboxId);
const groupWithIdentifiers =
  await client.conversations.newGroupWithIdentifiers(identifiers);

// NEW
const group = await client.conversations.createGroup(inboxIds);
const dm = await client.conversations.createDm(inboxId);
const groupWithIdentifiers =
  await client.conversations.createGroupWithIdentifiers(identifiers);

// Preferences inbox state methods

// OLD
const inboxState = await client.preferences.inboxState();
const latestInboxState = await client.preferences.inboxState(true);
const latestInboxStateForInboxId =
  await client.preferences.getLatestInboxState(inboxId); // this function removed
const inboxStates = await client.preferences.inboxStateFromInboxIds(
  inboxIds,
  false,
);
const latestInboxStates = await client.preferences.inboxStateFromInboxIds(
  inboxIds,
  true,
);

// NEW
const inboxState = await client.preferences.inboxState();
const latestInboxState = await client.preferences.fetchInboxState();
const inboxStates = await client.preferences.getInboxStates(inboxIds);
const latestInboxStates = await client.preferences.fetchInboxStates(inboxIds);

NEW FEATURES

Built-in content types

Previously, sending non-text messages required installing separate content type packages and registering codecs with the client. This release simplifies messaging by including all official content types directly in the SDK. You no longer need to manage codec registration, just use the dedicated send methods for each content type.

Supported content types include: text, markdown, reactions, replies, read receipts, transaction references, wallet send calls, actions, intents, attachments, remote attachments, and multiple remote attachments.

Enriched messages

To make it easier to build rich messaging experiences, messages now include additional context. Each message includes the number of replies it has received and an array of reaction messages. This eliminates the need for separate queries to count replies or fetch reactions for a message thread.

Reply messages also include the original message being replied to, allowing you to display the parent message context without an additional lookup.

import { contentTypeReply, type Reply } from "@xmtp/browser-sdk";
import { contentTypesAreEqual } from "@xmtp/content-type-primitives";

const messages = await group.messages();

for (const message of messages) {
  // number of replies to a message
  console.log(`message ${message.id} has ${message.numReplies} replies`);

  // message.reactions is an array of reaction messages
  console.log(
    `message ${message.id} has ${message.reactions.length} reactions`,
  );

  // reply messages include the original message
  // note: contentTypeReply() is async in browser SDK
  if (contentTypesAreEqual(message.contentType, await contentTypeReply())) {
    const reply = message.content as Reply;
    // the decoded content of the reply
    console.log(...
Read more

@xmtp/content-type-primitives@3.0.0

06 Jan 23:15
3e99355

Choose a tag to compare

This release introduces breaking changes and new features to replace previous functionality. If you've been building on a previous release, this one will require an update to your existing code.

BREAKING CHANGES

  • Updated ContentTypeId export
  • Updated EncodedContent export
  • Updated ContentCodec export
  • Removed CodecMap and CodecRegistry exports

New features

  • Added contentTypesAreEqual to replace ContentTypeId.sameAs
  • Added contentTypeToString to replace ContentTypeId.toString
  • Added contentTypeFromString to replace ContentTypeId.fromString

@xmtp/agent-sdk@1.2.4

05 Jan 19:57
8b5d56c

Choose a tag to compare

Patch Changes

  • 1f7e6ed: Exposed command list in CommandRouter middleware

@xmtp/agent-sdk@1.2.3

18 Dec 18:42
27a5b3c

Choose a tag to compare

Patch Changes

  • d655457: Added support for encrypted file attachments

@xmtp/node-sdk@4.6.0

17 Dec 15:21
877e984

Choose a tag to compare

This release introduces new features. If you've been building on a previous release, this one should be a drop-in replacement. Update as soon as possible to take advantage of these enhancements.

Self-removal from group chats

This feature enables a member to leave a group chat on their own. Previously, a member could be removed only by other members with appropriate permissions. This update addresses user privacy concerns and reduces the need for manual member removal by admins.

To see if a user has requested removal, check the new isPendingRemoval property.

// request removal from group
await group.requestRemoval();

console.log(group.isPendingRemoval); // true

To learn more, see Leave a group and XIP-75: Self-removal support for XMTP/MLS groups.

New appData metadata for groups

Groups now support an appData metadata field for storing custom application-specific data. This field enables developers to attach arbitrary data to groups, such as configuration settings.

The appData field can store up to 8,192 bytes of string data.

// access app data
const appData = group.appData;

// update app data with custom JSON
await group.updateAppData(
  JSON.stringify({
    muted: false,
    pinned: true,
  }),
);

// retrieve and parse the updated data
const appData = JSON.parse(group.appData);
console.log(appData.pinned); // true

@xmtp/content-type-remote-attachment@2.0.4

17 Dec 03:16
78a20c7

Choose a tag to compare

Patch Changes

  • cf4337e: Added error handling for fetching remote attachments

@xmtp/browser-sdk@5.3.0

17 Dec 15:21
877e984

Choose a tag to compare

This release introduces new features. If you've been building on a previous release, this one should be a drop-in replacement. Update as soon as possible to take advantage of these enhancements.

Self-removal from group chats

This feature enables a member to leave a group chat on their own. Previously, a member could be removed only by other members with appropriate permissions. This update addresses user privacy concerns and reduces the need for manual member removal by admins.

To see if a user has requested removal, check the new isPendingRemoval property.

// request removal from group
await group.requestRemoval();

console.log(group.isPendingRemoval); // true

To learn more, see Leave a group and XIP-75: Self-removal support for XMTP/MLS groups.

New appData metadata for groups

Groups now support an appData metadata field for storing custom application-specific data. This field enables developers to attach arbitrary data to groups, such as configuration settings.

The appData field can store up to 8,192 bytes of string data.

// access app data
const appData = group.appData;

// update app data with custom JSON
await group.updateAppData(
  JSON.stringify({
    muted: false,
    pinned: true,
  }),
);

// retrieve and parse the updated data
const appData = JSON.parse(group.appData);
console.log(appData.pinned); // true

@xmtp/agent-sdk@1.2.2

17 Dec 15:42
8f3b587

Choose a tag to compare

Upgraded Node SDK to 4.6.0

@xmtp/agent-sdk@1.2.1

11 Dec 18:11
6fd53b3

Choose a tag to compare

Patch Changes

  • 1f737c5: Fixed LibXMTP version reporting