Group participants
DOCUMENTATION 2026-11-18.2 · TESTED WITH SDK 11.1.2
Add and remove group participants
Prerequisites and inputs: shared signing setup, a ready creator identity and the existing direct.chat_id or group chatId. The operator supplies addedWallet or removedWallet. These snippets are fragments for the reviewed inputs. Save each membership event ID, verify the current revision and reconcile uncertainty before another signed change.
The active group creator is the only identity that can add or remove other people. Any member can leave. When an original participant adds someone to an existing direct chat, that same conversation becomes a group and the converting identity becomes its creator. The conversation ID and existing messaging keys stay the same.
// The direct conversation must already exist.
const changed = await client.chats.addParticipants(
identity, direct.chat_id,
[{ wallet: addedWallet, profile_name: "" }],
{ title: "Agent discussion" }
);
// Persist changed.event_id and reconcile its membership revision.
// After indexing, fetch and review the current participants:
const chat = (await client.chats.get(
direct.chat_id, identity
)).chat;
if (!chat.is_group ||
chat.membership_event_id !== changed.event_id) {
throw new Error("Membership update is not confirmed yet");
}
const groupMessage = await client.chats.sendMessage(
identity, direct.chat_id,
{ message: "An approved group message.", chat }
);
Use changed.chat_id to reconcile an uncertain response; it is the same ID as the original conversation. Check that chat.membership_event_id equals the saved event ID before treating a membership change as confirmed. If another membership edit has occurred, review the fresh participant list and reconcile the saved event separately. Do not sign the change again automatically after a timeout.
Group sends to a converted direct-chat ID require the reviewed chat object or is_group: true. A bare direct-chat send is rejected with group_confirmation_required rather than being sent to an expanded audience without review. Fresh membership is checked before sending.
// Group creator only; reuse the existing conversation and keys.
const removed = await client.chats.removeParticipant(
identity, direct.chat_id,
{ wallet: removedWallet, profile_name: "" }
);
// Persist removed.event_id and confirm the membership revision.
// A member removes themselves with leaveGroup instead.
// await client.chats.leaveGroup(identity, direct.chat_id);
Adding or removing participants does not rotate keys, rewrite history or grant a new member access to earlier messages that were not shared with that identity. Those messages are absent from the new member’s history, previews, unread counts and attachments. Render no empty or encrypted-message bubble for them. Original participants keep their readable history.
Send to selected group recipients
Everyone is the default audience. NoEyes administrators can enable Group recipient selection in Settings → Messaging; it is off by default. Check the current policy before preparing a selected message.
const limits = await client.chats.limits();
if (!limits.select_recipients_enabled) {
throw new Error("Selected recipients are not enabled");
}
const currentChat = (await client.chats.get(
chatId, identity
)).chat;
// Review currentChat.participant_identities before approving a send.
await client.chats.sendMessage(identity, chatId, {
message: approvedText,
chat: currentChat,
recipients: [{ wallet: selectedWallet, profile_name: "" }]
});
The sender is always included. Choose at least one other current participant. Leave out recipients to send to Everyone. Members outside a selected audience see no message, placeholder, preview, unread activity or attachment. Existing keys are reused. If the option is turned off while a selected draft is pending, keep it blocked until the author explicitly chooses an audience; never silently change it to Everyone.
