---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/join
title: Join channels
updated_at: 2026-06-01T12:01:18.350Z
---

> 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


# Join channels

:::note Requires App Context
Enable [App Context](https://youtu.be/9UEoSlngpYI) on your keyset in the [Admin Portal](https://admin.pubnub.com/) to manage memberships.
:::

Use `join()` to create a user's membership on a channel. To also receive messages, call [onMessageReceived()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/watch) separately.

## Interactive demo

Check what a sample implementation could look like in a React app showcasing user-channel [membership](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/membership).

:::tip Want to implement something similar?
Read [how to](https://www.pubnub.com/how-to/chat-sdk-manage-user-channel-membership/) do that or go straight to the demo's [source code](https://github.com/PubNubDevelopers/Chat-SDK-How-Tos/tree/main/membership).
:::

### Test it out

Choose whether you want to join or [leave](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/leave) a given channel and wait until you [get notified](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/membership#get-updates) when that happens.

## Method signature

##### Under the hood

`join()` calls App Context API and the JavaScript SDK [setMemberships()](https://www.pubnub.com/docs/sdks/javascript/api-reference/objects#set-channel-memberships) method.

`join()` creates a new `Membership` object that represents the user-channel relationship. Unlike previous versions, `join()` only sets membership. Use [onMessageReceived()](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/watch) to subscribe to incoming messages.

This method takes the following parameters:

```ts
channel.join(
    params?: {
        status?: string;
        type?: string;
        custom?: ObjectCustom
    }
): Promise<Membership>
```

### Input

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| params | object | Optional |  | Optional parameters for the membership. |
| > status | string | Optional |  | Tag that categorizes the membership by its state. |
| > type | string | Optional |  | Tag that categorizes the membership by its function. |
| > custom | ObjectCustom | Optional |  | Any custom properties or metadata associated with the channel-user membership in the form of a JSON. 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. |

### Output

| Type | Description |
| --- | --- |
| `Promise<Membership>` | Returned object containing all data on the newly created user-channel membership. |

## Sample code

Join the `support` channel and mark this membership as `premium` to add information about your support plan.

```ts
// reference the "channel" object
const channel = await chat.getChannel("support")

// join the channel and add metadata to the newly created membership
const membership = await channel.join({
    custom: { support_plan: "premium" }
})

// to also receive messages, call onMessageReceived() separately
channel.onMessageReceived((message) => {
    console.log("New message:", message.content.text)
})
```