Invites

Invites allow you to add users to a channel with a pending state. The invited user receives a notification and can accept or reject the invite.

Unread counts are not incremented for channels with a pending invite.

Invite Users

await channel.inviteMembers(['nick']);

Accept an Invite

Call acceptInvite to accept a pending invite. You can optionally include a message parameter to post a system message when the user joins (e.g., "Nick joined this channel!").

// Initialize the channel
final channel = client.channel('messaging', id: 'awesome-chat');
await channel.watch();

// Accept the invite
await channel.acceptInvite();

// Or with a system message
await channel.acceptInvite(Message(text: 'Nick joined this channel!'));

Reject an Invite

Call rejectInvite to decline a pending invite. Client-side calls use the currently connected user. Server-side calls require a user_id parameter.

await channel.rejectInvite();

Query Invites by Status

Use queryChannels with the invite filter to retrieve channels based on invite status. Valid values are pending, accepted, and rejected.

Query Accepted Invites

final invites = await client.queryChannels(filter: Filter.equal('invite', 'accepted'));

Query Rejected Invites

final rejected = await client.queryChannels(filter: Filter.equal('invite', 'rejected'));

Query Pending Invites

final pending = await client.queryChannels(filter: Filter.equal('invite', 'pending'));