> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Channels

> Create community, live, and conversation chat channels with the current SDK APIs.

Use channel creation when your app needs a new chat container before sending messages. The current public SDK creation surface covers community, live, and conversation channels.

For new integrations, let the SDK and server generate channel IDs. Custom channel IDs are not exposed on the current TypeScript, iOS, or Android creation APIs, and Flutter's custom `channelId` builder is deprecated.

## Platform Surface

| Platform   | Entry point                                                         | Channel types exposed here                                                                                     | Notes                                                                    |
| ---------- | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| TypeScript | `ChannelRepository.createChannel(...)`                              | `community`, `live`, `conversation`                                                                            | Conversation creation is distinct by membership.                         |
| iOS        | `AmityChannelRepository().createChannel(with:)`                     | `AmityCommunityChannelCreateOptions`, `AmityLiveChannelCreateOptions`, `AmityConversationChannelCreateOptions` | `AmityConversationChannelCreateOptions` defaults `isDistinct` to `true`. |
| Android    | `AmityChatClient.newChannelRepository().createChannel(displayName)` | `.community()`, `.live()`, `.conversation(...)`                                                                | Conversation accepts one user ID or a set of user IDs.                   |
| Flutter    | `AmityChatClient.newChannelRepository().createChannel()`            | `.communityType()`, `.liveType()`, `.conversationType()`                                                       | `withChannelId(...)` exists for community/live but is deprecated.        |

## Parameters

| Parameter            | Required | Description                                                                                            |
| -------------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| Channel type         | Yes      | Channel kind to create: community, live, or conversation.                                              |
| `displayName`        | Depends  | Human-readable channel name; required by Android's entry point and optional on some platform builders. |
| `userIds` / `userId` | Depends  | Initial members or conversation target user. Conversation creation requires at least one target user.  |
| `tags`               | No       | App-defined tags for later channel filtering.                                                          |
| `metadata`           | No       | App-defined JSON-style metadata stored with the channel.                                               |
| `isPublic`           | No       | Community-channel visibility flag where exposed.                                                       |
| `isDistinct`         | No       | Conversation de-duplication flag where exposed; iOS distinct conversations default to `true`.          |

## Create A Community Channel

Create a community channel when your app needs a group chat space with optional public visibility, tags, and metadata.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { ChannelRepository } from '@amityco/ts-sdk';

  const { data: channel } = await ChannelRepository.createChannel({
    type: 'community',
    displayName: 'Product support',
    userIds: ['user-id'],
    tags: ['support'],
    metadata: {
      queue: 'tier-1',
    },
    isPublic: true,
  });

  renderResults(channel);
  ```

  ```swift iOS theme={null}
  let options = AmityCommunityChannelCreateOptions()
  options.setDisplayName("Product support")
  options.setUserIds(["user-id"])
  options.setTags(["support"])
  options.setMetadata(["queue": "tier-1"])
  options.setIsChannelPublic(true)

  let channel = try await channelRepository.createChannel(with: options)
  showSuccessMessage(channel.channelId)
  ```

  ```kotlin Android theme={null}
  val metadata = JsonObject().apply {
      addProperty("queue", "tier-1")
  }

  val disposable = channelRepository
      .createChannel(displayName = "Product support")
      .community()
      .userIds(listOf(targetUserId))
      .tags(AmityTags(listOf("support")))
      .metadata(metadata)
      .isPublic(true)
      .build()
      .create()
      .subscribe(
          { channel -> showSuccessMessage(channel.getChannelId()) },
          { error -> handleGeneralError(error) },
      )
  ```

  ```dart Flutter theme={null}
  final channel = await AmityChatClient.newChannelRepository()
      .createChannel()
      .communityType()
      .withDisplayName('Product support')
      .userIds([targetUserId])
      .tags(['support'])
      .metadata({'queue': 'tier-1'})
      .isPublic(true)
      .create();

  final createdChannelId = channel.channelId;
  ```
</CodeGroup>

## Create A Conversation Channel

Conversation channels are for one-to-one or small-group private chat. Where the SDK exposes distinct conversation behavior, the default is to return the existing conversation for the same membership instead of creating a duplicate.

Create a conversation channel with one or more target users, and let distinct conversation behavior prevent duplicates where supported.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { ChannelRepository } from '@amityco/ts-sdk';

  const { data: conversation } = await ChannelRepository.createChannel({
    type: 'conversation',
    userIds: ['user-id'],
    displayName: 'Support DM',
    tags: ['support'],
  });

  renderResults(conversation);
  ```

  ```swift iOS theme={null}
  let options = AmityConversationChannelCreateOptions()
  options.setUserId("user-id")
  options.setDisplayName("Support DM")
  options.setTags(["support"])
  options.setIsDistinct(true)

  let conversation = try await channelRepository.createChannel(with: options)
  showSuccessMessage(conversation.channelId)
  ```

  ```kotlin Android theme={null}
  val disposable = channelRepository
      .createChannel(displayName = "Support DM")
      .conversation(userId = targetUserId)
      .tags(AmityTags(listOf("support")))
      .build()
      .create()
      .subscribe(
          { channel -> showSuccessMessage(channel.getChannelId()) },
          { error -> handleGeneralError(error) },
      )
  ```

  ```dart Flutter theme={null}
  final conversation = await AmityChatClient.newChannelRepository()
      .createChannel()
      .conversationType()
      .withUserId(targetUserId)
      .displayName('Support DM')
      .tags(['support'])
      .create();

  final channelId = conversation.channelId;
  ```
</CodeGroup>

## Create A Live Channel

Live channels support event-style chat. The platform builders expose optional metadata, tags, and members; iOS and Android also expose live-channel linkage fields such as room or post IDs in their builders.

Create a live channel for event-style chat flows such as livestreams or scheduled events.

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { ChannelRepository } from '@amityco/ts-sdk';

  const { data: liveChannel } = await ChannelRepository.createChannel({
    type: 'live',
    displayName: 'Launch Q&A',
    userIds: ['user-id'],
    tags: ['event'],
  });

  renderResults(liveChannel);
  ```

  ```swift iOS theme={null}
  let options = AmityLiveChannelCreateOptions()
  options.setDisplayName("Launch Q&A")
  options.setUserIds(["user-id"])
  options.setTags(["event"])

  let liveChannel = try await channelRepository.createChannel(with: options)
  showSuccessMessage(liveChannel.channelId)
  ```

  ```kotlin Android theme={null}
  val disposable = channelRepository
      .createChannel(displayName = "Launch Q&A")
      .live()
      .userIds(listOf(targetUserId))
      .tags(AmityTags(listOf("event")))
      .build()
      .create()
      .subscribe(
          { channel -> showSuccessMessage(channel.getChannelId()) },
          { error -> handleGeneralError(error) },
      )
  ```

  ```dart Flutter theme={null}
  final liveChannel = await AmityChatClient.newChannelRepository()
      .createChannel()
      .liveType()
      .withDisplayName('Launch Q&A')
      .userIds([targetUserId])
      .tags(['event'])
      .create();

  final channelId = liveChannel.channelId;
  ```
</CodeGroup>

## Related Topics

<CardGroup cols={2}>
  <Card title="Get Channels" href="./get-channel" icon="file">
    Retrieve a single channel or load known channel IDs.
  </Card>

  <Card title="Query Channels" href="./query-channels" icon="list-filter">
    Build channel lists with type, membership, tag, and deletion filters.
  </Card>

  <Card title="Update Channels" href="./update-channel" icon="pen">
    Change display name, avatar, tags, metadata, or notification mode where supported.
  </Card>

  <Card title="Join and Leave" href="../members/join-leave-channel" icon="log-in">
    Manage membership for channels that require explicit joining.
  </Card>
</CardGroup>
