The ChannelRepository provides comprehensive channel creation capabilities supporting Community, Live, and Conversation channel types. Each type offers unique characteristics and can be customized with metadata, tags, and specific configurations to match your communication needs.

Channel Creation Approaches

social.plus Chat SDK offers two standard methods for creating channels, giving you flexibility in ID management:

Custom Channel ID

Specify your own unique identifier
  • Full control over channel naming
  • Useful for integration with existing systems
  • Must ensure uniqueness to avoid conflicts

Auto-Generated ID

Let the SDK generate unique identifiers
  • Automatic conflict prevention
  • Simplified creation process
  • Recommended for most use cases
Conflict Prevention: If you attempt to create a channel with an ID that already exists, the API will return a conflict error (400900). When the channel ID parameter is undefined, the SDK automatically generates a unique ID to prevent conflicts.

Channel Types

Public channels discoverable by all usersCreate community channels for open discussions, team collaboration, and public forums.

Parameters

ParameterTypeRequiredDescription
displayNameStringPublic display name of the channel
avatarFileIdStringImage file ID for channel avatar
metadataObjectCustom fields for extended functionality
tagsArraySearchable tags for channel discovery
isPublicBooleanVisibility setting (public/private community)

Code Examples

do {
    let builder = AmityCommunityChannelBuilder()
    // Optional. If you don't provide channel id, sdk will create a unique channel id for you.
    builder.setUserIds(["steve", "john"])
    builder.setDisplayName("My Community Channel")
    builder.setTags(["ch-comm", "ios-sdk"])
    builder.setMetadata(["sdk_type": "ios"])
    // Create a channel by passing the builder
    let channel = try await channelRepository.createChannel(with: builder)
    print("A channel is created: \(channel.channelId)")
} catch {
    print("Unable to create a channel: \(error)")
}

Best Practices

Next Steps

Development Tip: Start with Community channels for general use cases, then implement specialized channel types as your requirements become more specific. The SDK’s automatic ID generation is recommended for most scenarios unless you need specific integration patterns.