Interface ChatGroupEventListener

The group event listener.

For descriptions of callback methods in the listener, user A acts as the current user and user B serves as the peer user.

interface ChatGroupEventListener {
    onAdminAdded?(params: {
        admin: string;
        groupId: string;
    }): void;
    onAdminRemoved?(params: {
        admin: string;
        groupId: string;
    }): void;
    onAllGroupMemberMuteStateChanged?(params: {
        groupId: string;
        isAllMuted: boolean;
    }): void;
    onAllowListAdded?(params: {
        groupId: string;
        members: string[];
    }): void;
    onAllowListRemoved?(params: {
        groupId: string;
        members: string[];
    }): void;
    onAnnouncementChanged?(params: {
        announcement: string;
        groupId: string;
    }): void;
    onAutoAcceptInvitation?(params: {
        groupId: string;
        inviteMessage?: string;
        inviter: string;
    }): void;
    onDestroyed?(params: {
        groupId: string;
        groupName?: string;
    }): void;
    onDetailChanged?(group: ChatGroup): void;
    onInvitationAccepted?(params: {
        groupId: string;
        invitee: string;
        reason?: string;
    }): void;
    onInvitationDeclined?(params: {
        groupId: string;
        invitee: string;
        reason?: string;
    }): void;
    onInvitationReceived?(params: {
        groupId: string;
        groupName: string;
        inviter: string;
        reason?: string;
    }): void;
    onMemberAttributesChanged?(params: {
        attributes: any;
        groupId: string;
        member: string;
        operator: string;
    }): void;
    onMemberExited?(params: {
        groupId: string;
        member: string;
    }): void;
    onMemberJoined?(params: {
        groupId: string;
        member: string;
    }): void;
    onMemberRemoved?(params: {
        groupId: string;
        groupName?: string;
    }): void;
    onMuteListAdded?(params: {
        groupId: string;
        muteExpire?: number;
        mutes: string[];
    }): void;
    onMuteListRemoved?(params: {
        groupId: string;
        mutes: string[];
    }): void;
    onOwnerChanged?(params: {
        groupId: string;
        newOwner: string;
        oldOwner: string;
    }): void;
    onRequestToJoinAccepted?(params: {
        accepter: string;
        groupId: string;
        groupName?: string;
    }): void;
    onRequestToJoinDeclined?(params: {
        applicant?: string;
        decliner: string;
        groupId: string;
        groupName?: string;
        reason?: string;
    }): void;
    onRequestToJoinReceived?(params: {
        applicant: string;
        groupId: string;
        groupName?: string;
        reason?: string;
    }): void;
    onSharedFileAdded?(params: {
        groupId: string;
        sharedFile: string;
    }): void;
    onSharedFileDeleted?(params: {
        fileId: string;
        groupId: string;
    }): void;
    onStateChanged?(group: ChatGroup): void;
}

Methods

  • Occurs when a member is set as an admin.

    Parameters

    • params: {
          admin: string;
          groupId: string;
      }
      • admin: string
      • groupId: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [admin] The user ID of the member that is set as an admin.
  • Occurs when the administrative privileges of an admin are removed.

    Parameters

    • params: {
          admin: string;
          groupId: string;
      }
      • admin: string
      • groupId: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [admin] The user ID of the admin whose administrative privileges are removed.
  • Occurs when all group members are muted or unmuted.

    Parameters

    • params: {
          groupId: string;
          isAllMuted: boolean;
      }
      • groupId: string
      • isAllMuted: boolean

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [isAllMuted] Whether all group members are muted.
      • true: Yes.
      • false: No.
  • Occurs when one or more group members are added to the allow list.

    Parameters

    • params: {
          groupId: string;
          members: string[];
      }
      • groupId: string
      • members: string[]

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [members] The user IDs of members that are added to the allow list of the group.
  • Occurs when one or more group members are removed from the allow list.

    Parameters

    • params: {
          groupId: string;
          members: string[];
      }
      • groupId: string
      • members: string[]

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [members] The user IDs of members that are removed from the allow list of the group.
  • Occurs when the group announcement is updated.

    Parameters

    • params: {
          announcement: string;
          groupId: string;
      }
      • announcement: string
      • groupId: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [announcement] The new announcement.
  • Occurs when the group invitation is accepted automatically by the current user.

    For example, after user B invites user A to join the group, as user A sets ChatOptions.autoAcceptGroupInvitation to true, the invitee joins the group automatically and receives this callback.

    Parameters

    • params: {
          groupId: string;
          inviteMessage?: string;
          inviter: string;
      }
      • groupId: string
      • OptionalinviteMessage?: string
      • inviter: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [inviter] The user ID of the inviter.
    • Param [inviteMessage] The invitation message.
  • Occurs when a group is destroyed.

    Parameters

    • params: {
          groupId: string;
          groupName?: string;
      }
      • groupId: string
      • OptionalgroupName?: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [groupName] The group name.
  • Occurs when the chat group detail change. All chat group members receive this event.

    Parameters

    Returns void

  • Occurs when a group invitation from the current user is accepted by the peer user.

    For example, after user B accepts a group invitation from user A, user A receives this callback.

    Parameters

    • params: {
          groupId: string;
          invitee: string;
          reason?: string;
      }
      • groupId: string
      • invitee: string
      • Optionalreason?: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [groupName] The group name.
    • Param [invitee] The user ID of the invitee.
    • Param [reason] The reason for accepting the group invitation.
  • Occurs when a group invitation from the current user is declined by the peer user.

    For example, after user B declines a group invitation from user A, user A receives this callback.

    Parameters

    • params: {
          groupId: string;
          invitee: string;
          reason?: string;
      }
      • groupId: string
      • invitee: string
      • Optionalreason?: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [invitee] The user ID of the invitee.
    • Param [reason] The reason for accepting the group invitation.
  • Occurs when the current user receives a group invitation.

    For example, after user B sends user A a group invitation, user A receives this callback.

    Parameters

    • params: {
          groupId: string;
          groupName: string;
          inviter: string;
          reason?: string;
      }
      • groupId: string
      • groupName: string
      • inviter: string
      • Optionalreason?: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [groupName] The group name.
    • Param [inviter] The user ID of the inviter.
    • Param [reason] The reason for invitation.
  • Occurs when a custom attribute(s) of a group member is/are changed.

    Parameters

    • params: {
          attributes: any;
          groupId: string;
          member: string;
          operator: string;
      }
      • attributes: any
      • groupId: string
      • member: string
      • operator: string

    Returns void

    params

    • groupId: The group ID.
    • member: The group member.
    • attributes: The modified custom attributes, in key-value format.
    • operator: The user ID of the operator.
  • Occurs when a member voluntarily leaves the group.

    Parameters

    • params: {
          groupId: string;
          member: string;
      }
      • groupId: string
      • member: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [member] The user ID of the member leaving the group.
  • Occurs when a user joins a group.

    Parameters

    • params: {
          groupId: string;
          member: string;
      }
      • groupId: string
      • member: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [member] The user ID of the new member.
  • Occurs when the current user is removed from the group.

    Parameters

    • params: {
          groupId: string;
          groupName?: string;
      }
      • groupId: string
      • OptionalgroupName?: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [groupName] The group name.
  • Occurs when one or more members are added to the mute list of the group.

    A user, when muted, can still see group messages, but cannot send messages in the group. However, a user on the block list can neither see nor send group messages.

    Parameters

    • params: {
          groupId: string;
          muteExpire?: number;
          mutes: string[];
      }
      • groupId: string
      • OptionalmuteExpire?: number
      • mutes: string[]

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [mutes] The user ID(s) of member(s) that are muted.
    • Param [muteExpire] Reserved parameter. The Unix timestamp when the mute expires. The unit is millisecond.
  • Occurs when one or more members are removed from the mute list of the group.

    Parameters

    • params: {
          groupId: string;
          mutes: string[];
      }
      • groupId: string
      • mutes: string[]

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [mutes] The user ID(s) of member(s) that is removed from the mute list.
  • Occurs when the group ownership is transferred.

    Parameters

    • params: {
          groupId: string;
          newOwner: string;
          oldOwner: string;
      }
      • groupId: string
      • newOwner: string
      • oldOwner: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [newOwner] The user ID of the new group owner.
    • Param [oldOwner] The user ID of the previous group owner.
  • Occurs when a join request from the current user is accepted by the peer user.

    For a group of the PublicJoinNeedApproval style, after user B accepts a join request from user A, user A receives this callback.

    Parameters

    • params: {
          accepter: string;
          groupId: string;
          groupName?: string;
      }
      • accepter: string
      • groupId: string
      • OptionalgroupName?: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [groupName] The group name.
    • Param [accepter] The ID of the user that accepts the join request.
  • Occurs when a join request from the current user is declined by the peer user.

    For example, for a group of the PublicJoinNeedApproval style, after user B declines a join request from user A, user A receives this callback.

    Parameters

    • params: {
          applicant?: string;
          decliner: string;
          groupId: string;
          groupName?: string;
          reason?: string;
      }
      • Optionalapplicant?: string
      • decliner: string
      • groupId: string
      • OptionalgroupName?: string
      • Optionalreason?: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [groupName] The group name.
    • Param [decliner] The ID of the user that declines the join request.
    • Param [applicant] The user ID of the applicant.
    • Param [reason] The reason for declining the join request.
  • Occurs when a join request from the current user is received by the peer user.

    For example, after user A sends a join request to user B, user B receives this callback.

    Parameters

    • params: {
          applicant: string;
          groupId: string;
          groupName?: string;
          reason?: string;
      }
      • applicant: string
      • groupId: string
      • OptionalgroupName?: string
      • Optionalreason?: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [groupName] The group name.
    • Param [applicant] The user ID of the applicant.
    • Param [reason] The reason for requesting to join the group.
  • Occurs when a shared file is added to the group.

    Parameters

    • params: {
          groupId: string;
          sharedFile: string;
      }
      • groupId: string
      • sharedFile: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [sharedFile] The ID of the new shared file.
  • Occurs when a shared file is removed from a group.

    Parameters

    • params: {
          fileId: string;
          groupId: string;
      }
      • fileId: string
      • groupId: string

    Returns void

    The parameter set.

    • Param [groupId] The group ID.
    • Param [fileId] The ID of the shared file that is deleted.
  • Occurs when the disabled state of group changes.

    Parameters

    Returns void