---
source_url: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/create
title: Create channels
updated_at: 2026-06-04T11:09:20.863Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Create channels

:::tip Channel naming
Before creating channels, take the time to carefully plan your [naming strategy](https://www.pubnub.com/docs/general/channels/channel-naming). Stick to consistent naming conventions and structure your channels thoughtfully. This preparation helps you avoid increased complexity, performance bottlenecks, and scalability issues, ensuring your app remains manageable and efficient as it grows.
:::

Create channels ([Channel](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/channel) objects) of one of these types:

* [Direct (1:1)](#create-direct-channel)
* [Group](#create-group-channel)
* [Public](#create-public-channel)

:::note Requires App Context
To store data about channels, you must [enable App Context](https://youtu.be/9UEoSlngpYI) for your app's keyset in the [Admin Portal](https://admin.pubnub.com/).
:::

:::warning No support for channel groups
Chat SDKs don't support channel groups. We recommend using a [Core SDK](https://www.pubnub.com/docs/sdks) to manage [channel groups](https://www.pubnub.com/docs/general/channels/subscribe#channel-groups).
:::

## Create direct channel

Direct channels enable private 1:1 conversations. Use cases include personal conversations and professional collaboration.

`createDirectConversation()` performs these actions:

1. Creates a channel with the `direct` type
2. Sets [channel membership](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/membership) for the channel owner
3. [Invites](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/invite#invite-one-user) the other user (generates an [invite event](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/custom-events#events-for-channel-initations))

If a conversation between the two users already exists, the method returns that existing channel.

:::note Receive messages
Call [onMessageReceived()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/watch) to start receiving messages on the channel.
:::

### Method signature

This method takes the following parameters:

```kotlin
chat.createDirectConversation(
    invitedUser: User,
    channelId: String?,
    channelName: String?,
    channelDescription: String?,
    channelCustom: CustomObject?,
    channelStatus: String?,
    membershipCustom: CustomObject?,
): PNFuture<CreateDirectConversationResult>
```

#### Input

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| invitedUser | User | Yes |  | User that you invite to join a channel. |
| channelId | String | Optional | `Automatically generated ID` | ID of the direct channel. The channel ID is created automatically by a hashing function that takes the string of two user names joined by `&`, computes a numeric value based on the characters in that string, and adds the `direct` prefix in front. For example, `direct.1234567890`. You can override this default value by providing your own ID. |
| channelName | String | Optional |  | Display name for the channel. If you don't provide the name, the channel will get the same name as [id](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/channel) (value of `channelId`). |
| channelDescription | String | Optional |  | Additional details about the channel. |
| channelCustom | CustomObject | Optional |  | Any custom properties or metadata associated with the channel in the form of a JSON object. Values must be scalar only; arrays or objects are not supported. [App Context filtering language](https://www.pubnub.com/docs/general/metadata/filtering) doesn’t support filtering by custom properties. |
| channelStatus | String | Optional |  | Current status of the channel, like `online`, `offline`, or `archived`. |
| membershipCustom | CustomObject | Optional |  | Any custom properties or metadata associated with the user-channel [membership](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/membership) in the form of a JSON object. Values must be scalar only; arrays or objects are not supported. [App Context filtering language](https://www.pubnub.com/docs/general/metadata/filtering) doesn’t support filtering by custom properties. |

:::tip API limits
To learn about the maximum length of parameters used to set channel metadata, refer to [REST API docs](https://www.pubnub.com/docs/sdks/rest-api/set-channel-metadata).
:::

#### Output

| Type | Description |
| --- | --- |
| `PNFuture<CreateDirectConversationResult>` | `PNFuture` containing the newly created channel object. |

### Sample code

Invite `agent-007` to a 1:1 conversation to talk about `customer XYZ`.

```kotlin
chat.createDirectConversation(
    invitedUser = userAgent7,
    channelName = "Quick sync on customer XYZ",
    channelCustom = mapOf("purpose" to "premium-support")
).async { result ->
    result.onSuccess {
        // handle success
    }.onFailure {
        // handle failure
    }
}
```

## Create group channel

Group channels enable multi-user conversations for team collaboration and community building. Access requires an invitation.

`createGroupConversation()` performs these actions:

1. Creates a channel with the `group` type
2. Sets channel membership for the channel owner
3. [Invites](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/invite#invite-multiple-users) other users to join

:::note Receive messages
Call [onMessageReceived()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/watch) to start receiving messages on the channel.
:::

### Method signature

This method takes the following parameters:

```kotlin
chat.createGroupConversation(
    invitedUsers: Collection<User>,
    channelId: String?,
    channelName: String?,
    channelDescription: String?,
    channelCustom: CustomObject?,
    channelStatus: String?,
    custom: CustomObject?,
): PNFuture<CreateGroupConversationResult>
```

#### Input

| Parameter | Description |
| --- | --- |
| `invitedUsers` *Type: `Collection<User>`Default: n/a | Users that you invite to join a channel. |
| `channelId`Type: `String`Default: Automatically generated ID | ID of the group channel. The channel ID is created automatically using the [v4 UUID generator](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)). You can override it by providing your own ID. |
| `channelName`Type: `String`Default: n/a | Display name for the channel. If you don't provide the name, the channel will get the same name as [id](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/channel) (value of `channelId`). |
| `channelDescription`Type: `String`Default: n/a | Additional details about the channel. |
| `channelCustom`Type: `CustomObject`Default: n/a | Any custom properties or metadata associated with the channel in the form of a JSON object. Values must be scalar only; arrays or objects are not supported. [App Context filtering language](https://www.pubnub.com/docs/general/metadata/filtering) doesn’t support filtering by custom properties. |
| `channelStatus`Type: `String`Default: n/a | Current status of the channel, like `online`, `offline`, or `archived`. |
| `membershipCustom`Type: `CustomObject`Default: n/a | Any custom properties or metadata associated with the user-channel [memberships](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/membership) in the form of a JSON object. Values must be scalar only; arrays or objects are not supported. [App Context filtering language](https://www.pubnub.com/docs/general/metadata/filtering) doesn’t support filtering by custom properties. |

:::tip API limits
To learn about the maximum length of parameters used to set channel metadata, refer to [REST API docs](https://www.pubnub.com/docs/sdks/rest-api/set-channel-metadata).
:::

#### Output

| Type | Description |
| --- | --- |
| `PNFuture<CreateGroupConversationResult>` | `PNFuture` containing the newly created channel object. |

### Sample code

Create a group conversation and invite `agent-007` and `agent-008` to have weekly syncs on `customer XYZ`.

```kotlin
// reference both agents you want to talk to
val invitedUsers = listOf(userAgent7, userAgent8)
// add the channel ID, name, and topic
chat.createGroupConversation(
    invitedUsers = invitedUsers,
    channelName = "Quick sync on customer XYZ",
    channelCustom = mapOf("purpose" to "premium-support")
).async { result ->
    result.onSuccess {
        // handle success
    }.onFailure {
        // handle failure
    }
}
```

## Create public channel

Public channels are open to anyone without invitation. Use cases include Q&A forums, knowledge sharing, and live event chat.

:::warning Supported features
Public channels do not support [typing indicators](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/typing-indicator) or [read receipts](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/messages/read-receipts). These features are impractical for large audiences.
:::

`createPublicConversation()` creates a channel with the `public` type and the specified metadata.

:::note Receive messages
Call [onMessageReceived()](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/channels/watch) to start receiving messages on the channel.
:::

### Method signature

This method takes the following parameters:

```kotlin
chat.createPublicConversation(
    channelId: String?,
    channelName: String?,
    channelDescription: String?,
    channelCustom: CustomObject?,
    channelStatus: String?,
): PNFuture<Channel>
```

#### Input

| Parameter | Description |
| --- | --- |
| `channelId`Type: `String`Default: Automatically generated UUIDv4 | ID of the public channel. The channel ID is created automatically using the [v4 UUID generator](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)). You can override it by providing your own ID. |
| `channelName`Type: `String`Default: n/a | Display name for the channel. If you don't provide the name, the channel will get the same name as [id](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/channel) (value of `channelId`). |
| `channelDescription`Type: `String`Default: n/a | Additional details about the channel. |
| `channelCustom`Type: `CustomObject`Default: n/a | Any custom properties or metadata associated with the channel in the form of a JSON object. Values must be scalar only; arrays or objects are not supported. [App Context filtering language](https://www.pubnub.com/docs/general/metadata/filtering) doesn’t support filtering by custom properties. |
| `channelStatus`Type: `String`Default: n/a | Current status of the channel, like `online`, `offline`, or `archived`. |

:::tip API limits
To learn about the maximum length of parameters used to set channel metadata, refer to [REST API docs](https://www.pubnub.com/docs/sdks/rest-api/set-channel-metadata).
:::

#### Output

| Type | Description |
| --- | --- |
| `PNFuture<Channel>` | `PNFuture` containing the created channel metadata. |

### Sample code

Create a public `ask-support` channel.

```kotlin
// define the channel ID, name, and description
val channelId = "support-channel-4"
val channelName = "ask-support"
val channelDescription = "Space dedicated to answering all support-related questions"

chat.createPublicConversation(
    channelId = channelId,
    channelName = channelName,
    channelDescription = channelDescription
).async { result ->
    result.onSuccess {
        // handle success
    }.onFailure {
        // handle failure
    }
}
```