> For the complete documentation index, see [llms.txt](https://docs.mitter.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mitter.io/sdks/ios/create-a-channel.md).

# Create a Channel

To create a new channel using the SDK, you need to create at least 2 `Participant` instances with the participant user IDs and pass them as an array to either to `createDirectMessageChannel()` or `createGroupMessageChannel()` function depending on the number of participants you have.

Let’s initialise two participants and create a direct message channel.

```
let stan = Participant(id: "csrCy-SJL3u-8AKMT-Wqv6y")
let rahul = Participant(id: "E3CAM-jjw8A-WeqDe-cWFe7")
```

Substitute the user IDs with your own user IDs here.

Now, call the function:

```
appDelegate.mitter.channels.createGroupMessageChannel(participants: [stan, rahul]) { result in
            switch result {
            case .success(let channelId):
                print("New channel created: \(channelId)")
            case .error:
                print("Couldn't create channel")
            }
        }
```

Run your project and now you should see a *New channel created* message in your console log along with the ID of the newly created channel.

Note down the ID because we’ll use it to send and receive some messages


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mitter.io/sdks/ios/create-a-channel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
