---
id: invites
sidebar_position: 11
title: Invites
---

### Inviting Users

Stream Chat provides the ability to invite users to a channel via the `channel` method with the `invites` array.
Upon invitation, the end-user will receive a notification that they were invited to the specified channel.

See the following for an example on how to invite a user by adding an invites array containing the user ID:

```dart
final invite = client.channel("messaging", id: "awesome-chat",
    extraData: {
      "name": "Founder Chat",
      "members": ["thierry", "tommaso", "nick"],
      "invites": ["nick"],
    });

await invite.create();
```

### Accepting an Invite

In order to accept an invite, you must use call the `acceptInvite` method.
The `acceptInvite` method accepts and object with an optional `message` property.
Please see below for an example of how to call `acceptInvite`:

```dart
final channel = client.channel("messaging", id: "awesome-chat");
await channel.acceptInvite();
```

### Rejecting an Invite

To reject an invite, call the `rejectInvite` method.
This method does not require a user ID as it pulls the user ID from the current session in store from the `connectUser` call.

```dart
await channel.rejectInvite();
```

### Query for Accepted Invites

Querying for accepted invites is done via the `queryChannels` method.
This allows you to return a list of accepted invites with a single call. See below for an example:

```dart
final invites = await client.queryChannels(filter: {"invite": "accepted"});
```

### Query for Rejected Invites

Similar to querying for accepted invites, you can query for rejected invites with `queryChannels`.
See below for an example:

```dart
final rejected = await client.queryChannels(filter: {"invite": "rejected"});
```