---
source_url: https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/join
title: Join channels
description: Learn to join channels and manage memberships through Chat SDK with PubNub's documentation.
updated_at: 2026-09-30T07:20:08.000Z
---

# Join channels

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

:::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.md) 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.md).

:::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.md) a given channel and wait until you [get notified](https://www.pubnub.com/docs/chat/chat-sdk/build/features/channels/membership.md#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.md#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.md) 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 | n/a | Optional parameters for the membership. |
| > status | string | Optional | n/a | Tag that categorizes the membership by its state. |
| > type | string | Optional | n/a | Tag that categorizes the membership by its function. |
| > custom | ObjectCustom | Optional | n/a | 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/data-storage/metadata/filtering.md) 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)
})
```

Last updated at: 2026-09-30T07:20:08.000Z
