Class Group<ContentTypes>

Type Parameters

  • ContentTypes extends DefaultContentTypes = DefaultContentTypes

Implements

Constructors

Properties

addedByInboxId: string
commitLogForkStatus?: CommitLogForkStatus
createdAt: number
groupDescription: string
groupImageUrl: string
groupName: string
isGroupActive: boolean
version: GROUP = ...

Methods

  • Parameters

    • inboxId: string

    Returns Promise<void>

    A Promise that resolves when the inboxId is added to the group admins. Will throw if the user does not have the required permissions.

  • Parameters

    • inboxId: string

    Returns Promise<void>

    A Promise that resolves when the inboxId is added to the group super admins. Will throw if the user does not have the required permissions.

  • Returns the app-specific data for this group. To get the latest app data from the network, call sync() first.

    Returns Promise<string>

    A Promise that resolves to the app data string.

  • Clears the disappearing message settings for this group. Will throw if the user does not have the required permissions.

    Returns Promise<void>

    A Promise that resolves when the settings are cleared.

  • This method returns a inbox id associated with the creator of the group.

    Returns Promise<string>

    A Promise that resolves to a InboxId.

  • Deletes a message from the dm. You must be the sender of the message or a super admin of the conversation in order to delete the message.

    Parameters

    • messageId: MessageId

      The id of the message to delete.

    Returns Promise<string>

    A Promise that resolves to the id of the deleted message.

  • Returns the group description. To get the latest group description from the network, call sync() first.

    Returns Promise<string>

    A Promise that resolves to the group description.

  • Returns the disappearing message settings. To get the latest settings from the network, call sync() first.

    Returns Promise<undefined | DisappearingMessageSettings>

    A Promise that resolves to the disappearing message settings.

  • This method returns an array of enriched messages (V2) associated with the group. Enriched messages include additional metadata like reactions, delivery status, and more. To get the latest messages from the network, call sync() first.

    Parameters

    • Optional opts: EnrichedMessagesOptions

      Optional parameters for filtering messages.

    Returns Promise<DecodedMessageUnionV2<ContentTypes>[]>

    A Promise that resolves to an array of DecodedMessageV2 objects.

  • Returns Promise<GetConversationHmacKeysResponse>

    A Promise that resolves to a list of hmac keys for this conversation that can be used to filter out self push notifications.

  • Returns Promise<ConversationTopic[]>

    A Promise that resolves to a list of conversation topics that can be used to subscribe to push notifications.

  • Returns the group image url square. To get the latest group image url square from the network, call sync() first.

    Returns Promise<string>

    A Promise that resolves to the group image url.

  • Returns whether the group is active. To get the latest active status from the network, call sync() first

    Returns Promise<boolean>

    A Promise that resolves if the group is active or not

  • Parameters

    • inboxId: string

    Returns Promise<boolean>

    whether a given inboxId is an admin of the group. To get the latest admin status from the network, call sync() first.

  • Checks if disappearing messages are enabled.

    Returns Promise<boolean>

    A Promise that resolves to a boolean indicating whether disappearing messages are enabled.

  • Parameters

    • inboxId: string

    Returns Promise<boolean>

    whether a given inboxId is a super admin of the group. To get the latest super admin status from the network, call sync() first.

  • Returns Promise<void>

    A Promise that resolves when the group is left.

  • Returns Promise<string[]>

    A Promise that resolves to an array of inboxIds that are admins of the group. To get the latest admin list from the network, call sync() first.

  • Returns Promise<string[]>

    A Promise that resolves to an array of inboxIds that are super admins of the group. To get the latest super admin list from the network, call sync() first.

  • This method returns an array of inbox ids associated with the group. To get the latest member inbox ids from the network, call sync() first.

    Returns Promise<string[]>

    A Promise that resolves to an array of InboxId objects.

  • Returns Promise<Member[]>

    A Promise that resolves to an array of Member objects. To get the latest member list from the network, call sync() first.

  • This method returns an array of messages associated with the group. To get the latest messages from the network, call sync() first.

    Parameters

    • Optional opts: MessagesOptions

    Returns Promise<DecodedMessageUnion<ContentTypes>[]>

    A Promise that resolves to an array of DecodedMessage objects.

  • This method returns an array of messages associated with the group. To get the latest messages from the network, call sync() first.

    Parameters

    • Optional opts: MessagesOptions

    Returns Promise<DecodedMessageUnion<ContentTypes>[]>

    A Promise that resolves to an array of DecodedMessage objects, each of which will contain any related reactions under the childMessages property.

  • Returns the group name. To get the latest group name from the network, call sync() first.

    Returns Promise<string>

    A Promise that resolves to the group name.

  • Returns Promise<string>

    A Promise that resolves to null unless the group is paused because of a minimum libxmtp version for the group. If the group is paused, the Promise resolves to the version string of the libxmtp that is required to join the group.

  • Returns Promise<PermissionPolicySet>

    A {PermissionPolicySet} object representing the group's permission policy set.

  • Prepare a group message to be sent.

    Type Parameters

    Parameters

    • content: ConversationSendPayload<SendContentTypes>

      The content of the message. It can be either a string or a structured MessageContent object.

    • Optional opts: SendOptions

      The options for the message.

    • Optional noSend: boolean

      When true, the prepared message will not be published until [publishMessage] is called with the returned message ID. When false (default), uses optimistic sending and the message will be published with the next [publishMessages] call.

    Returns Promise<MessageId>

    A Promise that resolves to a string identifier for the prepared message to be sent.

    Throws

    Throws an error if there is an issue with sending the message.

  • Publishes a message that was prepared with noSend = true.

    Parameters

    • messageId: MessageId

      The id of the message to publish.

    Returns Promise<void>

    A Promise that resolves when the message is published.

  • Publish all prepared messages.

    Returns Promise<any>

    Throws

    Throws an error if there is an issue finding the unpublished message

  • Parameters

    • inboxId: string

    Returns Promise<void>

    A Promise that resolves when the inboxId is removed from the group admins. Will throw if the user does not have the required permissions.

  • Parameters

    • inboxIds: string[]

      inboxIds to remove from the group

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Parameters

    • inboxId: string

    Returns Promise<void>

    A Promise that resolves when the inboxId is removed from the group super admins. Will throw if the user does not have the required permissions.

  • Sends a message to the current group.

    Type Parameters

    Parameters

    • content: ConversationSendPayload<SendContentTypes>

      The content of the message. It can be either a string or a structured MessageContent object.

    • Optional opts: SendOptions

    Returns Promise<MessageId>

    A Promise that resolves to a string identifier for the sent message.

    Throws

    Throws an error if there is an issue with sending the message.

  • Sets up a real-time message stream for the current group.

    This method subscribes to incoming messages in real-time and listens for new message events. When a new message is detected, the provided callback function is invoked with the details of the message. Additionally, this method returns a function that can be called to unsubscribe and end the message stream.

    Parameters

    • callback: ((message) => Promise<void>)

      A callback function that will be invoked with the new DecodedMessage when a message is received.

    • Optional onClose: (() => void)

      Optional callback to invoke when the stream is closed.

        • (): void
        • Returns void

    Returns Promise<(() => void)>

    A function that, when called, unsubscribes from the message stream and ends real-time updates.

  • Executes a network request to fetch the latest messages and membership changes associated with the group and saves them to the local state.

    Returns Promise<void>

  • Parameters

    • permissionOption: PermissionUpdateOption

    Returns Promise<void>

    A Promise that resolves when the addAdmin permission is updated for the group. Will throw if the user does not have the required permissions.

  • Parameters

    • permissionOption: PermissionUpdateOption

    Returns Promise<void>

    A Promise that resolves when the addMember permission is updated for the group. Will throw if the user does not have the required permissions.

  • Updates the app-specific data for this group. Will throw if the user does not have the required permissions.

    Parameters

    • appData: string

      new app data

    Returns Promise<void>

  • Parameters

    Returns Promise<void>

  • Updates the group description. Will throw if the user does not have the required permissions.

    Parameters

    • description: string

      new group description

    Returns Promise<void>

  • Parameters

    • permissionOption: PermissionUpdateOption

    Returns Promise<void>

    A Promise that resolves when the groupDescription permission is updated for the group. Will throw if the user does not have the required permissions.

  • Updates the disappearing message settings. Will throw if the user does not have the required permissions.

    Parameters

    Returns Promise<void>

    A Promise that resolves when the settings are updated.

  • Updates the group image url square. Will throw if the user does not have the required permissions.

    Parameters

    • imageUrl: string

      new group profile image url

    Returns Promise<void>

  • Parameters

    • permissionOption: PermissionUpdateOption

    Returns Promise<void>

    A Promise that resolves when the groupImageUrl permission is updated for the group. Will throw if the user does not have the required permissions.

  • Updates the group name. Will throw if the user does not have the required permissions.

    Parameters

    • groupName: string

      new group name

    Returns Promise<void>

  • Parameters

    • permissionOption: PermissionUpdateOption

    Returns Promise<void>

    A Promise that resolves when the groupName permission is updated for the group. Will throw if the user does not have the required permissions.

  • Parameters

    • permissionOption: PermissionUpdateOption

    Returns Promise<void>

    A Promise that resolves when the removeAdmin permission is updated for the group. Will throw if the user does not have the required permissions.

  • Parameters

    • permissionOption: PermissionUpdateOption

    Returns Promise<void>

    A Promise that resolves when the removeMember permission is updated for the group. Will throw if the user does not have the required permissions.